Tim Howe <[EMAIL PROTECTED]> 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.
--- 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;
 
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to