[PATCH] libata: check Word 88 validity in ata_id_xfer_mask()
authorTejun Heo <htejun@gmail.com>
Sun, 12 Mar 2006 03:34:35 +0000 (12:34 +0900)
committerJeff Garzik <jeff@garzik.org>
Sun, 12 Mar 2006 17:51:11 +0000 (12:51 -0500)
Check bit 2 of Word 53 for Word 88 validity before using Word 88 to
determine UDMA mask.  Note that the original xfer mask implementation
using ata_get_mode_mask() didn't consider bit 2 of Word 53.  This
patch introduces different (correct) behavior.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/scsi/libata-core.c

index c17df3f22fd15a3c420b1fce6908c510e3881119..439b6db138024b3a1edb0baa8d7d3b47715d4f45 100644 (file)
@@ -819,7 +819,10 @@ static unsigned int ata_id_xfermask(const u16 *id)
        }
 
        mwdma_mask = id[ATA_ID_MWDMA_MODES] & 0x07;
-       udma_mask = id[ATA_ID_UDMA_MODES] & 0xff;
+
+       udma_mask = 0;
+       if (id[ATA_ID_FIELD_VALID] & (1 << 2))
+               udma_mask = id[ATA_ID_UDMA_MODES] & 0xff;
 
        return ata_pack_xfermask(pio_mask, mwdma_mask, udma_mask);
 }