summaryrefslogtreecommitdiffstats
path: root/sys/isa
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1999-12-06 06:59:09 +0000
committerpeter <peter@FreeBSD.org>1999-12-06 06:59:09 +0000
commitf57de250e017306d4d0e84625cda4cc11417f0f6 (patch)
tree5749ed468c7a7d3aa543d7bec0e878bcaf521a96 /sys/isa
parent8bc1a5a150daf9df021bcc80b17669a09a64da12 (diff)
downloadFreeBSD-src-f57de250e017306d4d0e84625cda4cc11417f0f6.zip
FreeBSD-src-f57de250e017306d4d0e84625cda4cc11417f0f6.tar.gz
Add a truely evil workaround (hack!) for some unfortunate BIOS
programming practices. It seems that newer fdc chips have an alternative way of setting the transfer speed (including high speed modes for floppy tape) that doesn't use the control register (which we don't support - we use the old way only). So, they (the BIOS programmers) sometimes leave out the 0x3f6 control register from the PnP ports descriptor(!!). "Hey, it works with windows, so what's the problem?" :-( Anyway, this hack tries to compensate for that. This was discussed with dfr (who did the pnp attachment).
Diffstat (limited to 'sys/isa')
-rw-r--r--sys/isa/fd.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/sys/isa/fd.c b/sys/isa/fd.c
index 69e9795..86b79d1 100644
--- a/sys/isa/fd.c
+++ b/sys/isa/fd.c
@@ -640,13 +640,30 @@ fdc_probe(device_t dev)
fdc->portt = rman_get_bustag(fdc->res_ioport);
fdc->porth = rman_get_bushandle(fdc->res_ioport);
+ /*
+ * Some bios' report the device at 0x3f2-0x3f5,0x3f7 and some at
+ * 0x3f0-0x3f5,0x3f7. We detect the former by checking the size
+ * and adjust the port address accordingly.
+ *
+ * And some (!!) report 0x3f2-0x3f5 and completely leave out the
+ * control register! It seems that some non-antique controller chips
+ * have a different method of programming the transfer speed which
+ * doesn't require the control register, but it's mighty bogus as the
+ * chip still responds to the address for the control register.
+ * This hack is truely evil as we use the 6th port in a 4-port chunk.
+ */
+ /* 0x3f2-0x3f5 */
+ if (bus_get_resource_count(dev, SYS_RES_IOPORT, 0) == 4 &&
+ bus_get_resource_count(dev, SYS_RES_IOPORT, 1) == 0) {
+ fdc->port_off = -2;
+ ispnp = 0; /* hack, don't reserve second port chunk */
+ }
+ /* 0x3f0-0x3f5 */
+ if (bus_get_resource_count(dev, SYS_RES_IOPORT, 0) == 6 &&
+ bus_get_resource_count(dev, SYS_RES_IOPORT, 1) == 0) {
+ ispnp = 0; /* hack, don't reserve second port chunk */
+ }
if (ispnp) {
- /*
- * Some bios' report the device at 0x3f2-0x3f5,0x3f7
- * and some at 0x3f0-0x3f5,0x3f7. We detect the former
- * by checking the size and adjust the port address
- * accordingly.
- */
if (bus_get_resource_count(dev, SYS_RES_IOPORT, 0) == 4)
fdc->port_off = -2;
fdc->flags |= FDC_ISPNP;
OpenPOWER on IntegriCloud