Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Apr 2003 13:07:02 +0300
From:      Maxim Sobolev <sobomax@portaone.com>
To:        sos@FreeBSD.org
Cc:        current@FreeBSD.org
Subject:   Workaround for some broken BIOSes that forgot to enable ATA channels [patch]
Message-ID:  <20030414100702.GC22229@vega.vega.com>

next in thread | raw e-mail | index | archive | help

--NzB8fVQJ5HfG6fxh
Content-Type: text/plain; charset=koi8-r
Content-Disposition: inline

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

--NzB8fVQJ5HfG6fxh
Content-Type: text/plain; charset=koi8-r
Content-Disposition: attachment; filename="ata.diff"

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;

--NzB8fVQJ5HfG6fxh--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030414100702.GC22229>