fix for PIO mode detection in ATAng. etc.

Bruce Evans bde at zeta.org.au
Sat Sep 6 13:19:53 PDT 2003


Endianness-related cleanups in ATAng broke detection of the PIO mode capabilty
of old drives by getting the bytes in the retired_piomode word backwards.

%%%
Index: ata-all.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-all.c,v
retrieving revision 1.188
diff -u -2 -r1.188 ata-all.c
--- ata-all.c	1 Sep 2003 11:13:21 -0000	1.188
+++ ata-all.c	6 Sep 2003 19:51:40 -0000
@@ -833,7 +839,9 @@
 	    return ATA_PIO3;
     }
-    if ((ap->retired_piomode & ATA_RETIRED_PIO_MASK) == 2)
+#undef ATA_RETIRED_PIO_MASK	/* is 0x0003 in ata.h, but bits are in msb */
+#define ATA_RETIRED_PIO_MASK	0x0300
+    if ((ap->retired_piomode & ATA_RETIRED_PIO_MASK) == 0x0200)
 	return ATA_PIO2;
-    if ((ap->retired_piomode & ATA_RETIRED_PIO_MASK) == 1)
+    if ((ap->retired_piomode & ATA_RETIRED_PIO_MASK) == 0x0100)
 	return ATA_PIO1;
     if ((ap->retired_piomode & ATA_RETIRED_PIO_MASK) == 0)
%%%

Bruce


More information about the freebsd-current mailing list