aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/libata.h
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:53 -0400
commitd4b2bab4f26345ea1803feb23ea92fbe3f6b77bc (patch)
tree30a9826351e597828de2b402f1c41b9fca94cf95 /include/linux/libata.h
parentdc87c3985e9b442c60994308a96f887579addc39 (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 'include/linux/libata.h')
-rw-r--r--include/linux/libata.h24
1 files changed, 15 insertions, 9 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index d8cfc72ea9c1..69fc1b8a9215 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -348,8 +348,9 @@ struct ata_queued_cmd;
348 348
349/* typedefs */ 349/* typedefs */
350typedef void (*ata_qc_cb_t) (struct ata_queued_cmd *qc); 350typedef void (*ata_qc_cb_t) (struct ata_queued_cmd *qc);
351typedef int (*ata_prereset_fn_t)(struct ata_port *ap); 351typedef int (*ata_prereset_fn_t)(struct ata_port *ap, unsigned long deadline);
352typedef int (*ata_reset_fn_t)(struct ata_port *ap, unsigned int *classes); 352typedef int (*ata_reset_fn_t)(struct ata_port *ap, unsigned int *classes,
353 unsigned long deadline);
353typedef void (*ata_postreset_fn_t)(struct ata_port *ap, unsigned int *classes); 354typedef void (*ata_postreset_fn_t)(struct ata_port *ap, unsigned int *classes);
354 355
355struct ata_ioports { 356struct ata_ioports {
@@ -688,13 +689,17 @@ extern void __sata_phy_reset(struct ata_port *ap);
688extern void sata_phy_reset(struct ata_port *ap); 689extern void sata_phy_reset(struct ata_port *ap);
689extern void ata_bus_reset(struct ata_port *ap); 690extern void ata_bus_reset(struct ata_port *ap);
690extern int sata_set_spd(struct ata_port *ap); 691extern int sata_set_spd(struct ata_port *ap);
691extern int sata_phy_debounce(struct ata_port *ap, const unsigned long *param); 692extern int sata_phy_debounce(struct ata_port *ap, const unsigned long *param,
692extern int sata_phy_resume(struct ata_port *ap, const unsigned long *param); 693 unsigned long deadline);
693extern int ata_std_prereset(struct ata_port *ap); 694extern int sata_phy_resume(struct ata_port *ap, const unsigned long *param,
694extern int ata_std_softreset(struct ata_port *ap, unsigned int *classes); 695 unsigned long deadline);
695extern int sata_port_hardreset(struct ata_port *ap, 696extern int ata_std_prereset(struct ata_port *ap, unsigned long deadline);
696 const unsigned long *timing); 697extern int ata_std_softreset(struct ata_port *ap, unsigned int *classes,
697extern int sata_std_hardreset(struct ata_port *ap, unsigned int *class); 698 unsigned long deadline);
699extern int sata_port_hardreset(struct ata_port *ap, const unsigned long *timing,
700 unsigned long deadline);
701extern int sata_std_hardreset(struct ata_port *ap, unsigned int *class,
702 unsigned long deadline);
698extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes); 703extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes);
699extern void ata_port_disable(struct ata_port *); 704extern void ata_port_disable(struct ata_port *);
700extern void ata_std_ports(struct ata_ioports *ioaddr); 705extern void ata_std_ports(struct ata_ioports *ioaddr);
@@ -750,6 +755,7 @@ extern void ata_host_resume(struct ata_host *host);
750extern int ata_ratelimit(void); 755extern int ata_ratelimit(void);
751extern int ata_busy_sleep(struct ata_port *ap, 756extern int ata_busy_sleep(struct ata_port *ap,
752 unsigned long timeout_pat, unsigned long timeout); 757 unsigned long timeout_pat, unsigned long timeout);
758extern int ata_wait_ready(struct ata_port *ap, unsigned long deadline);
753extern void ata_port_queue_task(struct ata_port *ap, work_func_t fn, 759extern void ata_port_queue_task(struct ata_port *ap, work_func_t fn,
754 void *data, unsigned long delay); 760 void *data, unsigned long delay);
755extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, 761extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,