libata: fix drive side 80c cable check, take 3
authorTejun Heo <htejun@gmail.com>
Mon, 5 Feb 2007 14:21:19 +0000 (23:21 +0900)
committerJeff Garzik <jeff@garzik.org>
Thu, 15 Feb 2007 23:04:01 +0000 (18:04 -0500)
The 80c wire bit is bit 13, not 14.  Bit 14 is always 1 if word93 is
implemented.  This increases the chance of incorrect wire detection
especially because host side cable detection is often unreliable and
we sometimes soley depend on drive side cable detection.  Fix the test
and add word93 validity check.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
include/linux/ata.h

index 18e401f..272736e 100644 (file)
@@ -352,7 +352,7 @@ static inline int ata_drive_40wire(const u16 *dev_id)
 {
        if (ata_id_major_version(dev_id) >= 5 && ata_id_is_sata(dev_id))
                return 0;       /* SATA */
-       if (dev_id[93] & 0x4000)
+       if ((dev_id[93] & 0xE000) == 0x6000)
                return 0;       /* 80 wire */
        return 1;
 }