The long dead hand of the past has pushed forward useless bits in this
driver. Trim its fingernails by removing some useless bits before fixing the 'thread not terminated on detach' problem. o dmacnt is no longer used now that we allocate at attach time. Remove it from struct fdc_data. o ISPNP was only ever set, but never tested. It used to be used for the allocation routines to change how it allocated resources. Since that's no longer necessary, retire the flag. o ISPCMICA was only ever tested, but never set. GC it. This removes a special case in determining the drive type. The drive type is now set in fdc_pcmcia.c, so the hack isn't needed anymore. Sadly, this isn't tested with a Y-E Data pcmcia floppy drive because there are a number of other issues that preclude it from working. o Fix ifdef for reading from the rtc. I'm of the opinion that this ifdef should be moved into fdc_isa.c, but not today as ideally there'd be other fixes to the probing of children. So now we just read it on i386 ! pc98 (there's no #define for MACHINE_ARCH, just MACHINE, hence this slightly inelegant kludge) and amd64. The PC98 exclusion likely isn't meaningful since pc98 uses a different driver, but will be when merging of the pc98 floppy code into this driver is complete (this is the other reason I think this block of code belongs outside fdc.c). All of these changes are safe to MT5.
This commit is contained in:
parent
9468063a70
commit
27df52f999
@ -1778,29 +1778,13 @@ fd_probe(device_t dev)
|
||||
fd->type = type;
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX I think using __i386__ is wrong here since we actually want to probe
|
||||
* for the machine type, not the CPU type (so non-PC arch's like the PC98 will
|
||||
* fail the probe). However, for whatever reason, testing for _MACHINE_ARCH
|
||||
* == i386 breaks the test on FreeBSD/Alpha.
|
||||
*/
|
||||
#if defined(__i386__) || defined(__amd64__)
|
||||
#if (defined(__i386__) && !defined(PC98)) || defined(__amd64__)
|
||||
if (fd->type == FDT_NONE && (unit == 0 || unit == 1)) {
|
||||
/* Look up what the BIOS thinks we have. */
|
||||
if (unit == 0) {
|
||||
if ((fdc->flags & FDC_ISPCMCIA))
|
||||
/*
|
||||
* Somewhat special. No need to force the
|
||||
* user to set device flags, since the Y-E
|
||||
* Data PCMCIA floppy is always a 1.44 MB
|
||||
* device.
|
||||
*/
|
||||
fd->type = FDT_144M;
|
||||
else
|
||||
fd->type = (rtcin(RTC_FDISKETTE) & 0xf0) >> 4;
|
||||
} else {
|
||||
if (unit == 0)
|
||||
fd->type = (rtcin(RTC_FDISKETTE) & 0xf0) >> 4;
|
||||
else
|
||||
fd->type = rtcin(RTC_FDISKETTE) & 0x0f;
|
||||
}
|
||||
if (fd->type == FDT_288M_1)
|
||||
fd->type = FDT_288M;
|
||||
}
|
||||
|
@ -104,7 +104,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->flags |= FDC_ISPNP;
|
||||
|
||||
/* Initialize variables and get a temporary buffer for _FDE. */
|
||||
error = ENXIO;
|
||||
|
@ -197,10 +197,6 @@ fdc_isa_attach(device_t dev)
|
||||
int error;
|
||||
|
||||
fdc = device_get_softc(dev);
|
||||
error = ISA_PNP_PROBE(device_get_parent(dev), dev, fdc_ids);
|
||||
if (error == 0)
|
||||
fdc->flags |= FDC_ISPNP;
|
||||
|
||||
error = fdc_isa_alloc_resources(dev, fdc);
|
||||
if (error == 0)
|
||||
error = fdc_attach(dev);
|
||||
|
@ -39,7 +39,6 @@ enum fdc_type {
|
||||
*/
|
||||
struct fdc_data {
|
||||
int fdcu; /* our unit number */
|
||||
int dmacnt;
|
||||
int dmachan;
|
||||
int flags;
|
||||
#define FDC_HASDMA 0x01
|
||||
@ -47,8 +46,6 @@ struct fdc_data {
|
||||
#define FDC_HAS_FIFO 0x10
|
||||
#define FDC_NEEDS_RESET 0x20
|
||||
#define FDC_NODMA 0x40
|
||||
#define FDC_ISPNP 0x80
|
||||
#define FDC_ISPCMCIA 0x100
|
||||
struct fd_data *fd; /* The active drive */
|
||||
int retry;
|
||||
int fdout; /* mirror of the w/o digital output reg */
|
||||
|
Loading…
Reference in New Issue
Block a user