aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/ahci.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-02-02 02:50:52 -0500
committerJeff Garzik <jeff@garzik.org>2007-05-01 07:49:54 -0400
commit9b89391cc861b8a1105551909eb66c024fe18ab2 (patch)
treef0783823927ea013c8d58c1041ad1e1d884eed9e /drivers/ata/ahci.c
parentd4b2bab4f26345ea1803feb23ea92fbe3f6b77bc (diff)
libata: improve 0xff status handling
For PATA, 0xff status indicates empty port. For SATA, it depends on how the controller emulates status register. On some controllers, 0xff is used to represent broken link or certain stage during reset. libata currently deals SATA the same. This hasn't caused any problem because problematic situations usually only occur after hotplug or other link disruption events and libata blindly waited for the device to spin up and settle after hotplug giving the link and device whatever time to go through those stages. libata is going to replace unconditional spinup wait with generic timed sequence of resets, so not only getting 0xff handling right for SATA is, well, the right thing to do, it's much more important now. This patch makes the following changes. * Make ata_bus_softreset() return -ENODEV if any of its wait fails due to 0xff status. * Fail soft/hardreset if status wait returns -ENODEV indicating 0xff status while SStatus says the link is online. e.g. Reset fails if status is 0xff after reset when SStatus reports the linke is online. If SCR registers are not available, everything is the same as before. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/ahci.c')
-rw-r--r--drivers/ata/ahci.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 0319f10d42d5..d9617892fc23 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -960,15 +960,13 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class,
960 */ 960 */
961 msleep(150); 961 msleep(150);
962 962
963 *class = ATA_DEV_NONE; 963 rc = ata_wait_ready(ap, deadline);
964 if (ata_port_online(ap)) { 964 /* link occupied, -ENODEV too is an error */
965 rc = ata_wait_ready(ap, deadline); 965 if (rc) {
966 if (rc && rc != -ENODEV) { 966 reason = "device not ready";
967 reason = "device not ready"; 967 goto fail;
968 goto fail;
969 }
970 *class = ahci_dev_classify(ap);
971 } 968 }
969 *class = ahci_dev_classify(ap);
972 970
973 DPRINTK("EXIT, class=%u\n", *class); 971 DPRINTK("EXIT, class=%u\n", *class);
974 return 0; 972 return 0;