diff options
author | Tejun Heo <htejun@gmail.com> | 2007-02-02 02:50:52 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-05-01 07:49:54 -0400 |
commit | b8cffc6ad8c000410186815b7bcc6b76ef1bbb13 (patch) | |
tree | 5f85107a671c03dab5030d00d51ad93295524996 /drivers/ata | |
parent | 9b89391cc861b8a1105551909eb66c024fe18ab2 (diff) |
libata: improve ata_std_prereset()
This patch updates ata_std_prereset() as follows.
* Don't fail on phy resume failure. Just whine and continue. Failure
from prereset makes libata abort whole reset sequence and give up
the port, so prereset() should be best effort. This is more
important with the coming EH updates as prereset() will be called
with shorter timeout.
* If ata_wait_ready() fails, whine and request hardreset instead.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-core.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 49d26675932e..12717fa5e888 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -3338,7 +3338,11 @@ static void ata_wait_spinup(struct ata_port *ap, unsigned long deadline) | |||
3338 | * @ap: ATA port to be reset | 3338 | * @ap: ATA port to be reset |
3339 | * @deadline: deadline jiffies for the operation | 3339 | * @deadline: deadline jiffies for the operation |
3340 | * | 3340 | * |
3341 | * @ap is about to be reset. Initialize it. | 3341 | * @ap is about to be reset. Initialize it. Failure from |
3342 | * prereset makes libata abort whole reset sequence and give up | ||
3343 | * that port, so prereset should be best-effort. It does its | ||
3344 | * best to prepare for reset sequence but if things go wrong, it | ||
3345 | * should just whine, not fail. | ||
3342 | * | 3346 | * |
3343 | * LOCKING: | 3347 | * LOCKING: |
3344 | * Kernel thread context (may sleep) | 3348 | * Kernel thread context (may sleep) |
@@ -3368,19 +3372,23 @@ int ata_std_prereset(struct ata_port *ap, unsigned long deadline) | |||
3368 | /* if SATA, resume phy */ | 3372 | /* if SATA, resume phy */ |
3369 | if (ap->cbl == ATA_CBL_SATA) { | 3373 | if (ap->cbl == ATA_CBL_SATA) { |
3370 | rc = sata_phy_resume(ap, timing, deadline); | 3374 | rc = sata_phy_resume(ap, timing, deadline); |
3371 | if (rc && rc != -EOPNOTSUPP) { | 3375 | /* whine about phy resume failure but proceed */ |
3372 | /* phy resume failed */ | 3376 | if (rc && rc != -EOPNOTSUPP) |
3373 | ata_port_printk(ap, KERN_WARNING, "failed to resume " | 3377 | ata_port_printk(ap, KERN_WARNING, "failed to resume " |
3374 | "link for reset (errno=%d)\n", rc); | 3378 | "link for reset (errno=%d)\n", rc); |
3375 | return rc; | ||
3376 | } | ||
3377 | } | 3379 | } |
3378 | 3380 | ||
3379 | /* Wait for !BSY if the controller can wait for the first D2H | 3381 | /* Wait for !BSY if the controller can wait for the first D2H |
3380 | * Reg FIS and we don't know that no device is attached. | 3382 | * Reg FIS and we don't know that no device is attached. |
3381 | */ | 3383 | */ |
3382 | if (!(ap->flags & ATA_FLAG_SKIP_D2H_BSY) && !ata_port_offline(ap)) | 3384 | if (!(ap->flags & ATA_FLAG_SKIP_D2H_BSY) && !ata_port_offline(ap)) { |
3383 | ata_wait_ready(ap, deadline); | 3385 | rc = ata_wait_ready(ap, deadline); |
3386 | if (rc) { | ||
3387 | ata_port_printk(ap, KERN_WARNING, "device not ready " | ||
3388 | "(errno=%d), forcing hardreset\n", rc); | ||
3389 | ehc->i.action |= ATA_EH_HARDRESET; | ||
3390 | } | ||
3391 | } | ||
3384 | 3392 | ||
3385 | return 0; | 3393 | return 0; |
3386 | } | 3394 | } |