summaryrefslogtreecommitdiff
path: root/drivers/ata
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2008-05-15 22:14:57 +0900
committerChris Wright <chrisw@sous-sol.org>2008-06-09 11:26:59 -0700
commitc8b3aee8e35a6412bd73d124d0f12639feab9538 (patch)
tree04fcccb325bed50b8321799fe685875ac8147406 /drivers/ata
parent2e11e376bf8c26498fb1e5678b533f44902bb530 (diff)
libata: force hardreset if link is in powersave mode
Inhibiting link PM mode doesn't bring the link back online if it's already in powersave mode. If SRST is used in these cases, libata EH thinks that the link is offline and fails detection. Force hardreset if link is in powersave mode. Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: Jeff Garzik <jeff@garzik.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Diffstat (limited to 'drivers/ata')
-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 be95fdb69726..92da864a8bf1 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3947,6 +3947,7 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline)
struct ata_port *ap = link->ap;
struct ata_eh_context *ehc = &link->eh_context;
const unsigned long *timing = sata_ehc_deb_timing(ehc);
+ u32 sstatus;
int rc;
/* handle link resume */
@@ -3960,6 +3961,17 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline)
if (ap->flags & ATA_FLAG_PMP)
ehc->i.action |= ATA_EH_HARDRESET;
+ /* if link powersave is on, force hardreset */
+ if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) {
+ u8 ipm = sstatus >> 8;
+
+ if (ipm == 2 || ipm == 6) {
+ ata_link_printk(link, KERN_INFO, "link in powersave "
+ "mode (ipm=%d), forcing hardreset\n", ipm);
+ ehc->i.action |= ATA_EH_HARDRESET;
+ }
+ }
+
/* if we're about to do hardreset, nothing more to do */
if (ehc->i.action & ATA_EH_HARDRESET)
return 0;