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>
This commit is contained in:
@@ -5630,6 +5630,10 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
|
||||
ehi->dev_action[dev->devno] |= ATA_EH_REVALIDATE;
|
||||
ata_port_schedule_eh(ap);
|
||||
break;
|
||||
|
||||
case ATA_CMD_SLEEP:
|
||||
dev->flags |= ATA_DFLAG_SLEEPING;
|
||||
break;
|
||||
}
|
||||
|
||||
__ata_qc_complete(qc);
|
||||
@@ -5769,6 +5773,14 @@ void ata_qc_issue(struct ata_queued_cmd *qc)
|
||||
qc->flags &= ~ATA_QCFLAG_DMAMAP;
|
||||
}
|
||||
|
||||
/* if device is sleeping, schedule softreset and abort the link */
|
||||
if (unlikely(qc->dev->flags & ATA_DFLAG_SLEEPING)) {
|
||||
link->eh_info.action |= ATA_EH_SOFTRESET;
|
||||
ata_ehi_push_desc(&link->eh_info, "waking up from sleep");
|
||||
ata_link_abort(link);
|
||||
return;
|
||||
}
|
||||
|
||||
ap->ops->qc_prep(qc);
|
||||
|
||||
qc->err_mask |= ap->ops->qc_issue(qc);
|
||||
|
Reference in New Issue
Block a user