aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2008-03-23 02:16:53 -0400
committerJeff Garzik <jeff@garzik.org>2008-03-24 22:09:38 -0400
commit1ffc151fcddf524d0c76709d7e7a2af0255acb6b (patch)
treea13ad1dd628fe302ed64672ef282c21d31f251b9
parentb63b133165b876838e8685350ef469620f4abd99 (diff)
libata: assume no device is attached if both IDENTIFYs are aborted
This is to fix bugzilla #10254. QSI cdrom attached to pata_sis as secondary master appears as phantom device for the slave. Interestingly, instead of not setting DRQ after IDENTIFY which triggers NODEV_HINT, it aborts both IDENTIFY and IDENTIFY PACKET which makes EH retry. Modify EH such that it assumes no device is attached if both flavors of IDENTIFY are aborted by the device. There really isn't much point in retrying when the device actively aborts the commands. While at it, convert NODEV detection message to ata_dev_printk() to help debugging obscure detection problems. This problem was reported by Jan Bücken. Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: Jan Bücken <jb.faq@gmx.de> Acked-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/ata/libata-core.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 4bbe31f98ef8..c9c52803d0c2 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2092,24 +2092,34 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
2092 id, sizeof(id[0]) * ATA_ID_WORDS, 0); 2092 id, sizeof(id[0]) * ATA_ID_WORDS, 0);
2093 if (err_mask) { 2093 if (err_mask) {
2094 if (err_mask & AC_ERR_NODEV_HINT) { 2094 if (err_mask & AC_ERR_NODEV_HINT) {
2095 DPRINTK("ata%u.%d: NODEV after polling detection\n", 2095 ata_dev_printk(dev, KERN_DEBUG,
2096 ap->print_id, dev->devno); 2096 "NODEV after polling detection\n");
2097 return -ENOENT; 2097 return -ENOENT;
2098 } 2098 }
2099 2099
2100 /* Device or controller might have reported the wrong 2100 if ((err_mask == AC_ERR_DEV) && (tf.feature & ATA_ABORTED)) {
2101 * device class. Give a shot at the other IDENTIFY if 2101 /* Device or controller might have reported
2102 * the current one is aborted by the device. 2102 * the wrong device class. Give a shot at the
2103 */ 2103 * other IDENTIFY if the current one is
2104 if (may_fallback && 2104 * aborted by the device.
2105 (err_mask == AC_ERR_DEV) && (tf.feature & ATA_ABORTED)) { 2105 */
2106 may_fallback = 0; 2106 if (may_fallback) {
2107 may_fallback = 0;
2107 2108
2108 if (class == ATA_DEV_ATA) 2109 if (class == ATA_DEV_ATA)
2109 class = ATA_DEV_ATAPI; 2110 class = ATA_DEV_ATAPI;
2110 else 2111 else
2111 class = ATA_DEV_ATA; 2112 class = ATA_DEV_ATA;
2112 goto retry; 2113 goto retry;
2114 }
2115
2116 /* Control reaches here iff the device aborted
2117 * both flavors of IDENTIFYs which happens
2118 * sometimes with phantom devices.
2119 */
2120 ata_dev_printk(dev, KERN_DEBUG,
2121 "both IDENTIFYs aborted, assuming NODEV\n");
2122 return -ENOENT;
2113 } 2123 }
2114 2124
2115 rc = -EIO; 2125 rc = -EIO;