summaryrefslogtreecommitdiffstats
path: root/sys/dev/fdc/fdc_acpi.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-08-20 15:14:25 +0000
committerphk <phk@FreeBSD.org>2004-08-20 15:14:25 +0000
commit91de1b896dea3928223e2531589b4c7c0d422ada (patch)
treeb948c22d12f559b0c58f576fc7da5d69acc1c8ef /sys/dev/fdc/fdc_acpi.c
parentca124b900b50e6642bad1e763cd2750ba4776602 (diff)
downloadFreeBSD-src-91de1b896dea3928223e2531589b4c7c0d422ada.zip
FreeBSD-src-91de1b896dea3928223e2531589b4c7c0d422ada.tar.gz
Rewrite of the floppy driver to make it MPsafe & GEOM friendly:
Centralize the fdctl_wr() function by adding the offset in the resource to the softc structure. Bugfix: Read the drive-change signal from the correct place: same place as the ctl register. Remove the cdevsw{} related code and implement a GEOM class. Ditch the state-engine and park a thread on each controller to service the queue. Make the interrupt FAST & MPSAFE since it is just a simple wakeup(9) call. Rely on a per controller mutex to protect the bioqueues. Grab GEOMs topology lock when we have to and Giant when ISADMA needs it. Since all access to the hardware is isolated in the per controller thread, the rest of the driver is lock & Giant free. Create a per-drive queue where requests are parked while the motor spins up. When the motor is running the requests are purged to the per controller queue. This allows requests to other drives to be serviced during spin-up. Only setup the motor-off timeout when we finish the last request on the queue and cancel it when a new request arrives. This fixes the bug in the old code where the motor turned off while we were still retrying a request. Make the "drive-change" work reliably. Probe the drive on first opens. Probe with a recal and a seek to cyl=1 to reset the drive change line and check again to see if we have a media. When we see the media disappear we destroy the geom provider, create a new one, and flag that autodetection should happen next time we see a media (unless a specific format is configured). Add sysctl tunables for a lot of drive related parameters. If you spend a lot of time waiting for floppies you can grab the i82078 pdf from Intels web-page and try tuning these. Add sysctl debug.fdc.debugflags which will enable various kinds of debugging printfs. Add central definitions of our well known floppy formats. Simplify datastructures for autoselection of format and call the code at the right times. Bugfix: Remove at least one piece of code which would have made 2.88M floppies not work. Use implied seeks on enhanced controllers. Use multisector transfers on all controllers. Increase ISADMA bounce buffers accordingly. Fall back to single sector when retrying. Reset retry count on every successful transaction. Sort functions in a more sensible order and generally tidy up a fair bit here and there. Assorted related fixes and adjustments in userland utilities. WORKAROUNDS: Do allow r/w opens of r/o media but refuse actual write operations. This is necessary until the p4::phk_bufwork branch gets integrated (This problem relates to remounting not reopening devices, see sys/*/*/${fs}_vfsops.c for details). Keep PC98's private copy of the old floppy driver compiling and presumably working (see below). TODO (planned) Move probing of drives until after interrupts/timeouts work (like for ATA/SCSI drives). TODO (unplanned) This driver should be made to work on PC98 as well. Test on YE-DATA PCMCIA floppy drive. Fix 2.88M media. This is a MT5 candidate (depends on the bioq_takefirst() addition).
Diffstat (limited to 'sys/dev/fdc/fdc_acpi.c')
-rw-r--r--sys/dev/fdc/fdc_acpi.c31
1 files changed, 1 insertions, 30 deletions
diff --git a/sys/dev/fdc/fdc_acpi.c b/sys/dev/fdc/fdc_acpi.c
index 7b85500..af7bb62 100644
--- a/sys/dev/fdc/fdc_acpi.c
+++ b/sys/dev/fdc/fdc_acpi.c
@@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$");
#include "acpi.h"
#include <dev/acpica/acpivar.h>
-#include <dev/fdc/fdcreg.h>
#include <dev/fdc/fdcvar.h>
static int fdc_acpi_probe(device_t dev);
@@ -46,7 +45,6 @@ static int fdc_acpi_probe_children(device_t bus, device_t dev,
void *fde);
static ACPI_STATUS fdc_acpi_probe_child(ACPI_HANDLE h, device_t *dev,
int level, void *arg);
-static void fdctl_wr_acpi(fdc_p fdc, u_int8_t v);
/* Maximum number of child devices of a controller (4 floppy + 1 tape.) */
#define ACPI_FDC_MAXDEVS 5
@@ -72,12 +70,6 @@ struct fdc_walk_ctx {
device_t dev;
};
-static void
-fdctl_wr_acpi(fdc_p fdc, u_int8_t v)
-{
- bus_space_write_1(fdc->ctlt, fdc->ctlh, 0, v);
-}
-
static int
fdc_acpi_probe(device_t dev)
{
@@ -101,7 +93,7 @@ fdc_acpi_attach(device_t dev)
struct fdc_data *sc;
ACPI_BUFFER buf;
device_t bus;
- int error, i, ic_type;
+ int error, i;
ACPI_OBJECT *obj, *pkg;
ACPI_HANDLE h;
uint32_t *fde;
@@ -109,7 +101,6 @@ fdc_acpi_attach(device_t dev)
/* Get our softc and use the same accessor as ISA. */
sc = device_get_softc(dev);
sc->fdc_dev = dev;
- sc->fdctl_wr = fdctl_wr_acpi;
sc->flags |= FDC_ISPNP;
/* Initialize variables and get a temporary buffer for _FDE. */
@@ -130,26 +121,6 @@ fdc_acpi_attach(device_t dev)
if (error != 0)
goto out;
- /* Check that the controller is working and get its type. */
- error = fdc_initial_reset(sc);
- if (error)
- goto out;
- if (fd_cmd(sc, 1, NE7CMD_VERSION, 1, &ic_type) == 0) {
- ic_type = (u_char)ic_type;
- switch (ic_type) {
- case 0x80:
- sc->fdct = FDC_NE765;
- break;
- case 0x81: /* not mentioned in any hardware doc */
- case 0x90:
- sc->fdct = FDC_ENHANCED;
- break;
- default:
- sc->fdct = FDC_UNKNOWN;
- break;
- }
- }
-
/*
* Enumerate _FDE, which lists floppy drives that are present. If
* this fails, fall back to the ISA hints-based probe method.
OpenPOWER on IntegriCloud