Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Sep 2005 02:07:23 -0400
From:      Tim Howe <tim.howe@celebrityresorts.com>
To:        freebsd-stable@freebsd.org
Subject:   [PATCH] option to re-enable aggressive ATA probing (was: 5.3 -> 5.4 breaks ATA (Intel ICH2))
Message-ID:  <87vf0noxgk.fsf_-_@beaker.data-secure.net>
In-Reply-To: <87ll1jzqoa.fsf@beaker.data-secure.net> (Tim Howe's message of "Mon, 26 Sep 2005 13:26:13 -0400")
References:  <87y85nuqhy.fsf@beaker.data-secure.net> <4335D1D2.9060501@leadhill.net> <87ll1jzqoa.fsf@beaker.data-secure.net>

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

Tim Howe <tim.howe@celebrityresorts.com> writes:

> ata0-master: stat=0xd0 err=0xd0 lsb=0xd0 msb=0xd0

This turned out to be the key.

Version 1.51 of ata-lowlevel.c added a check for stat0/1, err, lsb, and
msb being identical.  If they are, it aborts the probe.  The attached
patch creates an option ATA_AGGRESSIVE_PROBE which disables this for the
old aggressive behavior (which may wait up to the full 31 seconds).

I also took the liberty of reworking the still-busy check from 3
equality tests to 2 bitmask tests.  It seems simpler to my eye with
identical results, but if I missed something or the other style was
preferred please let me know.

The patch is against 5-STABLE because that's what I have.

-- 
Tim Howe
Software Engineer
Celebrity Resorts, Inc.

--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline; filename=ata_aggressive_probe.patch

--- sys/conf/options.stock	Tue Sep 27 00:28:50 2005
+++ sys/conf/options	Tue Sep 27 00:55:53 2005
@@ -301,6 +301,7 @@
 # Options used in the 'ata' ATA/ATAPI driver
 ATA_STATIC_ID		opt_ata.h
 ATA_NOPCI		opt_ata.h
+ATA_AGGRESSIVE_PROBE	opt_ata.h
 DEV_ATADISK		opt_ata.h
 DEV_ATAPICD		opt_ata.h
 DEV_ATAPIST		opt_ata.h
--- sys/conf/NOTES.stock	Tue Sep 27 00:30:28 2005
+++ sys/conf/NOTES	Tue Sep 27 00:56:39 2005
@@ -1501,8 +1501,11 @@
 #
 # ATA_STATIC_ID:	controller numbering is static ie depends on location
 #			else the device numbers are dynamically allocated.
+# ATA_AGGRESSIVE_PROBE:	Does not give up on probing when all err, lsb, and
+			msb are identical.
 
 options 	ATA_STATIC_ID
+#options	ATA_AGGRESSIVE_PROBE
 
 #
 # Standard floppy disk controllers and floppy tapes, supports
--- sys/dev/ata/ata-lowlevel.c.stock	Tue Sep 27 00:31:10 2005
+++ sys/dev/ata/ata-lowlevel.c	Tue Sep 27 00:59:19 2005
@@ -604,24 +604,21 @@
 		}
 	    }
 	}
-	if (mask == 0x01)	/* wait for master only */
-	    if (!(stat0 & ATA_S_BUSY) || (stat0 == 0xff && timeout > 5) ||
-		(stat0 == err && lsb == err && msb == err && timeout > 5))
-		break;
-	if (mask == 0x02)	/* wait for slave only */
-	    if (!(stat1 & ATA_S_BUSY) || (stat1 == 0xff && timeout > 5) ||
-		(stat1 == err && lsb == err && msb == err && timeout > 5))
-		break;
-	if (mask == 0x03) {	/* wait for both master & slave */
-	    if (!(stat0 & ATA_S_BUSY) && !(stat1 & ATA_S_BUSY))
-		break;
-	    if ((stat0 == 0xff && timeout > 5) ||
-		(stat0 == err && lsb == err && msb == err && timeout > 5))
-		mask &= ~0x01;
-	    if ((stat1 == 0xff && timeout > 5) ||
-		(stat1 == err && lsb == err && msb == err && timeout > 5))
-		mask &= ~0x02;
-	}
+
+        if (mask & 0x01)        /* waiting for master */
+            if (!(stat0 & ATA_S_BUSY) || (stat0 == 0xff && timeout > 5)
+#ifndef ATA_AGGRESSIVE_PROBE
+                || (stat0 == err && lsb == err && msb == err && timeout > 5)
+#endif
+                )
+                mask &= ~0x01;
+        if (mask & 0x02)        /* waiting for slave */
+            if (!(stat1 & ATA_S_BUSY) || (stat1 = 0xff && timeout > 5)
+#ifndef ATA_AGGRESSIVE_PROBE
+                || (stat1 == err && lsb == err && msb == err && timeout > 5)
+#endif
+                )
+                mask &= ~0x02;
 	if (mask == 0 && !(stat0 & ATA_S_BUSY) && !(stat1 & ATA_S_BUSY))
 	    break;
 

--=-=-=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87vf0noxgk.fsf_-_>