diff options
author | Tejun Heo <tj@kernel.org> | 2008-11-12 20:04:46 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-11-14 18:51:57 -0500 |
commit | 6a6b97d360702b98c02c7fca4c4e088dcf3a2985 (patch) | |
tree | 6b0d6a504c11bbea7096706065c31bd12e7d7e78 /drivers | |
parent | 58e20d8d344b0ee083febb18c2b021d2427e56ca (diff) |
libata: improve phantom device detection
Currently libata uses four methods to detect device presence.
1. PHY status if available.
2. TF register R/W test (only promotes presence, never demotes)
3. device signature after reset
4. IDENTIFY failure detection in SFF state machine
Combination of the above works well in most cases but recently there
have been a few reports where a phantom device causes unnecessary
delay during probe. In both cases, PHY status wasn't available. In
one case, it passed #2 and #3 and failed IDENTIFY with ATA_ERR which
didn't qualify as #4. The other failed #2 but as it passed #3 and #4,
it still caused failure.
In both cases, phantom device reported diagnostic failure, so these
cases can be safely worked around by considering any !ATA_DRQ IDENTIFY
failure as NODEV_HINT if diagnostic failure is set.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/libata-sff.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 4b4739486327..9033d164c4ec 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -1227,10 +1227,19 @@ fsm_start: | |||
1227 | /* ATA PIO protocol */ | 1227 | /* ATA PIO protocol */ |
1228 | if (unlikely((status & ATA_DRQ) == 0)) { | 1228 | if (unlikely((status & ATA_DRQ) == 0)) { |
1229 | /* handle BSY=0, DRQ=0 as error */ | 1229 | /* handle BSY=0, DRQ=0 as error */ |
1230 | if (likely(status & (ATA_ERR | ATA_DF))) | 1230 | if (likely(status & (ATA_ERR | ATA_DF))) { |
1231 | /* device stops HSM for abort/error */ | 1231 | /* device stops HSM for abort/error */ |
1232 | qc->err_mask |= AC_ERR_DEV; | 1232 | qc->err_mask |= AC_ERR_DEV; |
1233 | else { | 1233 | |
1234 | /* If diagnostic failed and this is | ||
1235 | * IDENTIFY, it's likely a phantom | ||
1236 | * device. Mark hint. | ||
1237 | */ | ||
1238 | if (qc->dev->horkage & | ||
1239 | ATA_HORKAGE_DIAGNOSTIC) | ||
1240 | qc->err_mask |= | ||
1241 | AC_ERR_NODEV_HINT; | ||
1242 | } else { | ||
1234 | /* HSM violation. Let EH handle this. | 1243 | /* HSM violation. Let EH handle this. |
1235 | * Phantom devices also trigger this | 1244 | * Phantom devices also trigger this |
1236 | * condition. Mark hint. | 1245 | * condition. Mark hint. |