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/pata_artop.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/pata_artop.c')
-rw-r--r-- | drivers/ata/pata_artop.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c index 00e9ec342db0..d472894a983b 100644 --- a/drivers/ata/pata_artop.c +++ b/drivers/ata/pata_artop.c | |||
@@ -39,7 +39,7 @@ | |||
39 | 39 | ||
40 | static int clock = 0; | 40 | static int clock = 0; |
41 | 41 | ||
42 | static int artop6210_pre_reset(struct ata_port *ap) | 42 | static int artop6210_pre_reset(struct ata_port *ap, unsigned long deadline) |
43 | { | 43 | { |
44 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 44 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
45 | const struct pci_bits artop_enable_bits[] = { | 45 | const struct pci_bits artop_enable_bits[] = { |
@@ -49,7 +49,8 @@ static int artop6210_pre_reset(struct ata_port *ap) | |||
49 | 49 | ||
50 | if (!pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no])) | 50 | if (!pci_test_config_bits(pdev, &artop_enable_bits[ap->port_no])) |
51 | return -ENOENT; | 51 | return -ENOENT; |
52 | return ata_std_prereset(ap); | 52 | |
53 | return ata_std_prereset(ap, deadline); | ||
53 | } | 54 | } |
54 | 55 | ||
55 | /** | 56 | /** |
@@ -70,12 +71,13 @@ static void artop6210_error_handler(struct ata_port *ap) | |||
70 | /** | 71 | /** |
71 | * artop6260_pre_reset - check for 40/80 pin | 72 | * artop6260_pre_reset - check for 40/80 pin |
72 | * @ap: Port | 73 | * @ap: Port |
74 | * @deadline: deadline jiffies for the operation | ||
73 | * | 75 | * |
74 | * The ARTOP hardware reports the cable detect bits in register 0x49. | 76 | * The ARTOP hardware reports the cable detect bits in register 0x49. |
75 | * Nothing complicated needed here. | 77 | * Nothing complicated needed here. |
76 | */ | 78 | */ |
77 | 79 | ||
78 | static int artop6260_pre_reset(struct ata_port *ap) | 80 | static int artop6260_pre_reset(struct ata_port *ap, unsigned long deadline) |
79 | { | 81 | { |
80 | static const struct pci_bits artop_enable_bits[] = { | 82 | static const struct pci_bits artop_enable_bits[] = { |
81 | { 0x4AU, 1U, 0x02UL, 0x02UL }, /* port 0 */ | 83 | { 0x4AU, 1U, 0x02UL, 0x02UL }, /* port 0 */ |