aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-10-25 05:30:36 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-29 06:15:25 -0400
commit054a5fbaceb2eb3a31ea843c1cf0b8e10b91478c (patch)
treecbf21985f3894b11fe00666cef8ac33bae4f007d /drivers/ata/libata-core.c
parent4dbfa39b6c95eb9d0aedb5bd00bb552b91c31e3d (diff)
libata: track SLEEP state and issue SRST to wake it up
ATA devices in SLEEP mode don't respond to any commands. SRST is necessary to wake it up. Till now, when a command is issued to a device in SLEEP mode, the command times out, which makes EH reset the device and retry the command after that, causing a long delay. This patch makes libata track SLEEP state and issue SRST automatically if a command is about to be issued to a device in SLEEP. Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: Bruce Allen <ballen@gravity.phys.uwm.edu> Cc: Andrew Paprocki <andrew@ishiboo.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r--drivers/ata/libata-core.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 5aedd1af06e6..50ae20101d10 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5630,6 +5630,10 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
5630 ehi->dev_action[dev->devno] |= ATA_EH_REVALIDATE; 5630 ehi->dev_action[dev->devno] |= ATA_EH_REVALIDATE;
5631 ata_port_schedule_eh(ap); 5631 ata_port_schedule_eh(ap);
5632 break; 5632 break;
5633
5634 case ATA_CMD_SLEEP:
5635 dev->flags |= ATA_DFLAG_SLEEPING;
5636 break;
5633 } 5637 }
5634 5638
5635 __ata_qc_complete(qc); 5639 __ata_qc_complete(qc);
@@ -5769,6 +5773,14 @@ void ata_qc_issue(struct ata_queued_cmd *qc)
5769 qc->flags &= ~ATA_QCFLAG_DMAMAP; 5773 qc->flags &= ~ATA_QCFLAG_DMAMAP;
5770 } 5774 }
5771 5775
5776 /* if device is sleeping, schedule softreset and abort the link */
5777 if (unlikely(qc->dev->flags & ATA_DFLAG_SLEEPING)) {
5778 link->eh_info.action |= ATA_EH_SOFTRESET;
5779 ata_ehi_push_desc(&link->eh_info, "waking up from sleep");
5780 ata_link_abort(link);
5781 return;
5782 }
5783
5772 ap->ops->qc_prep(qc); 5784 ap->ops->qc_prep(qc);
5773 5785
5774 qc->err_mask |= ap->ops->qc_issue(qc); 5786 qc->err_mask |= ap->ops->qc_issue(qc);