fix for PIO mode detection in ATAng. etc.

From: Bruce Evans <bde_at_zeta.org.au>
Date: Sun, 7 Sep 2003 06:19:49 +1000 (EST)
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
_at__at_ -833,7 +839,9 _at__at_
 	    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
Received on Sat Sep 06 2003 - 11:19:53 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:21 UTC