]> err.no Git - linux-2.6/commitdiff
libata: assume ATA_DEV_ATA on diagnostic failure
authorTejun Heo <htejun@gmail.com>
Sun, 2 Sep 2007 14:24:48 +0000 (23:24 +0900)
committerJeff Garzik <jeff@garzik.org>
Fri, 12 Oct 2007 18:55:39 +0000 (14:55 -0400)
Certain device which reports diagnostic failure also reports invalid
device signature.  Assume ATA_DEV_ATA on diagnostic failure if reset
indicates device presence.

This is fix for bugzilla bug 8784.

  http://bugzilla.kernel.org/show_bug.cgi?id=8784

Signed-off-by: Tejun Heo <htejun@gmail.com>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Edward Amsden <amsden_linux@earthlink.net>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/ata/libata-core.c

index ea8c07b04f294c30da6b346a3944d58864cbd0e4..2116f27945805098da6538f8e9ddcd65f4a84576 100644 (file)
@@ -751,10 +751,20 @@ unsigned int ata_dev_try_classify(struct ata_device *dev, int present,
        /* determine if device is ATA or ATAPI */
        class = ata_dev_classify(&tf);
 
-       if (class == ATA_DEV_UNKNOWN)
-               return ATA_DEV_NONE;
-       if ((class == ATA_DEV_ATA) && (ata_chk_status(ap) == 0))
-               return ATA_DEV_NONE;
+       if (class == ATA_DEV_UNKNOWN) {
+               /* If the device failed diagnostic, it's likely to
+                * have reported incorrect device signature too.
+                * Assume ATA device if the device seems present but
+                * device signature is invalid with diagnostic
+                * failure.
+                */
+               if (present && (dev->horkage & ATA_HORKAGE_DIAGNOSTIC))
+                       class = ATA_DEV_ATA;
+               else
+                       class = ATA_DEV_NONE;
+       } else if ((class == ATA_DEV_ATA) && (ata_chk_status(ap) == 0))
+               class = ATA_DEV_NONE;
+
        return class;
 }