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:53 -0400 |
commit | d4b2bab4f26345ea1803feb23ea92fbe3f6b77bc (patch) | |
tree | 30a9826351e597828de2b402f1c41b9fca94cf95 /drivers/ata/sata_via.c | |
parent | dc87c3985e9b442c60994308a96f887579addc39 (diff) |
libata: add deadline support to prereset and reset methods
Add @deadline to prereset and reset methods and make them honor it.
ata_wait_ready() which directly takes @deadline is implemented to be
used as the wait function. This patch is in preparation for EH timing
improvements.
* ata_wait_ready() never does busy sleep. It's only used from EH and
no wait in EH is that urgent. This function also prints 'be
patient' message automatically after 5 secs of waiting if more than
3 secs is remaining till deadline.
* ata_bus_post_reset() now fails with error code if any of its wait
fails. This is important because earlier reset tries will have
shorter timeout than the spec requires. If a device fails to
respond before the short timeout, reset should be retried with
longer timeout rather than silently ignoring the device.
There are three behavior differences.
1. Timeout is applied to both devices at once, not separately. This
is more consistent with what the spec says.
2. When a device passes devchk but fails to become ready before
deadline. Previouly, post_reset would just succeed and let
device classification remove the device. New code fails the
reset thus causing reset retry. After a few times, EH will give
up disabling the port.
3. When slave device passes devchk but fails to become accessible
(TF-wise) after reset. Original code disables dev1 after 30s
timeout and continues as if the device doesn't exist, while the
patched code fails reset. When this happens, new code fails
reset on whole port rather than proceeding with only the primary
device.
If the failing device is suffering transient problems, new code
retries reset which is a better behavior. If the failing device is
actually broken, the net effect is identical to it, but not to the
other device sharing the channel. In the previous code, reset would
have succeeded after 30s thus detecting the working one. In the new
code, reset fails and whole port gets disabled. IMO, it's a
pathological case anyway (broken device sharing bus with working
one) and doesn't really matter.
* ata_bus_softreset() is changed to return error code from
ata_bus_post_reset(). It used to return 0 unconditionally.
* Spin up waiting is to be removed and not converted to honor
deadline.
* To be on the safe side, deadline is set to 40s for the time being.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/sata_via.c')
-rw-r--r-- | drivers/ata/sata_via.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index 1d855f55f5f7..305ab7c68ca5 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -268,6 +268,7 @@ static void svia_noop_freeze(struct ata_port *ap) | |||
268 | /** | 268 | /** |
269 | * vt6420_prereset - prereset for vt6420 | 269 | * vt6420_prereset - prereset for vt6420 |
270 | * @ap: target ATA port | 270 | * @ap: target ATA port |
271 | * @deadline: deadline jiffies for the operation | ||
271 | * | 272 | * |
272 | * SCR registers on vt6420 are pieces of shit and may hang the | 273 | * SCR registers on vt6420 are pieces of shit and may hang the |
273 | * whole machine completely if accessed with the wrong timing. | 274 | * whole machine completely if accessed with the wrong timing. |
@@ -284,7 +285,7 @@ static void svia_noop_freeze(struct ata_port *ap) | |||
284 | * RETURNS: | 285 | * RETURNS: |
285 | * 0 on success, -errno otherwise. | 286 | * 0 on success, -errno otherwise. |
286 | */ | 287 | */ |
287 | static int vt6420_prereset(struct ata_port *ap) | 288 | static int vt6420_prereset(struct ata_port *ap, unsigned long deadline) |
288 | { | 289 | { |
289 | struct ata_eh_context *ehc = &ap->eh_context; | 290 | struct ata_eh_context *ehc = &ap->eh_context; |
290 | unsigned long timeout = jiffies + (HZ * 5); | 291 | unsigned long timeout = jiffies + (HZ * 5); |
@@ -329,7 +330,7 @@ static int vt6420_prereset(struct ata_port *ap) | |||
329 | 330 | ||
330 | skip_scr: | 331 | skip_scr: |
331 | /* wait for !BSY */ | 332 | /* wait for !BSY */ |
332 | ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT); | 333 | ata_wait_ready(ap, deadline); |
333 | 334 | ||
334 | return 0; | 335 | return 0; |
335 | } | 336 | } |