Workaround for some broken BIOSes that forgot to enable ATA
channels [patch]
Maxim Sobolev
sobomax at portaone.com
Mon Apr 14 03:06:57 PDT 2003
Hi,
Attached please find a patch, which workaround a bug found in
some BIOSes, which forget to enable ATA channels properly.
This results in ATA driver not attaching properly and inability
to use disk devices.
Thanks!
-Maxim
-------------- next part --------------
Index: conf/NOTES
===================================================================
RCS file: /home/ncvs/src/sys/conf/NOTES,v
retrieving revision 1.1140
diff -d -u -r1.1140 NOTES
--- conf/NOTES 22 Mar 2003 14:18:21 -0000 1.1140
+++ conf/NOTES 14 Apr 2003 09:59:48 -0000
@@ -1370,8 +1370,11 @@
#
# ATA_STATIC_ID: controller numbering is static ie depends on location
# else the device numbers are dynamically allocated.
+# ATA_ENABLE_CHANNELS: forcefully enable channels if they appear disabled
+# by BIOS. Some buggy BIOSes "forget" to enable them.
options ATA_STATIC_ID
+#options ATA_ENABLE_CHANNELS
#
# Standard floppy disk controllers and floppy tapes, supports
Index: conf/options
===================================================================
RCS file: /home/ncvs/src/sys/conf/options,v
retrieving revision 1.383
diff -d -u -r1.383 options
--- conf/options 25 Mar 2003 05:45:04 -0000 1.383
+++ conf/options 14 Apr 2003 09:59:49 -0000
@@ -299,6 +300,7 @@
# Options used in the 'ata' ATA/ATAPI driver
ATA_STATIC_ID opt_ata.h
+ATA_ENABLE_CHANNELS opt_ata.h
ATA_NOPCI opt_ata.h
DEV_ATADISK opt_ata.h
DEV_ATAPICD opt_ata.h
Index: dev/ata/ata-pci.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-pci.c,v
retrieving revision 1.57
diff -d -u -r1.57 ata-pci.c
--- dev/ata/ata-pci.c 25 Feb 2003 14:46:30 -0000 1.57
+++ dev/ata/ata-pci.c 14 Apr 2003 09:59:49 -0000
@@ -129,6 +129,13 @@
subclass = pci_get_subclass(dev);
cmd = pci_read_config(dev, PCIR_COMMAND, 2);
+#ifdef ATA_ENABLE_CHANNELS
+ if (!(cmd & PCIM_CMD_PORTEN)) {
+ pci_write_config(dev, PCIR_COMMAND, cmd | PCIM_CMD_PORTEN, 2);
+ cmd = pci_read_config(dev, PCIR_COMMAND, 2);
+ }
+#endif
+
if (!(cmd & PCIM_CMD_PORTEN)) {
device_printf(dev, "ATA channel disabled by BIOS\n");
return 0;
More information about the freebsd-current
mailing list