From: Tejun Heo <htejun@gmail.com>
To: Paul Collins <paul@burly.ondioline.org>
Cc: Jeff Garzik <jeff@garzik.org>, linux-kernel@vger.kernel.org
Subject: [PATCH #upstream-fixes] libata: force hardreset if the link is in powersave mode
Date: Wed, 16 Apr 2008 10:27:37 +0900 [thread overview]
Message-ID: <48055609.3020403@gmail.com> (raw)
In-Reply-To: <87k5iywquy.fsf@burly.wgtn.ondioline.org>
Currently, libata doesn't support link powersave modes and always
disables link PS modes. However, if the link is already in powersave
mode when libata begis probing, inhibiting powersave modes by setting
IPM isn't enough. Link should be manually transited into active mode
using SPM or hardreset.
As SPM isn't avalable on all controllers and we're gonna prefer
hardreset in future anyway, force hardreset if link is in powersave
mode.
Reported-by: Paul Collins <paul@burly.ondioline.org>
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
Jeff, this isn't necessary for #upstream.
drivers/ata/libata-core.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
index be95fdb..e3ddefd 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3966,11 +3966,26 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline)
/* if SATA, resume link */
if (ap->flags & ATA_FLAG_SATA) {
+ u32 sstatus;
+
rc = sata_link_resume(link, timing, deadline);
/* whine about phy resume failure but proceed */
if (rc && rc != -EOPNOTSUPP)
ata_link_printk(link, KERN_WARNING, "failed to resume "
"link for reset (errno=%d)\n", rc);
+
+ /* force hardreset if the link is sleeping */
+ 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 %s mode, forcing hardreset\n",
+ ipm == 2 ? "partial" : "slumber");
+ ehc->i.action |= ATA_EH_HARDRESET;
+ return 0;
+ }
+ }
}
/* Wait for !BSY if the controller can wait for the first D2H
prev parent reply other threads:[~2008-04-16 1:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-14 21:48 ata2: SATA link down (SStatus 611 SControl 300) Paul Collins
2008-04-15 1:53 ` Tejun Heo
2008-04-15 2:30 ` Paul Collins
2008-04-15 2:57 ` Tejun Heo
2008-04-15 3:24 ` Paul Collins
2008-04-15 4:01 ` Tejun Heo
2008-04-15 21:12 ` Paul Collins
2008-04-15 22:26 ` Tejun Heo
2008-04-15 22:43 ` Paul Collins
2008-04-16 0:15 ` Tejun Heo
2008-04-16 0:33 ` Tejun Heo
2008-04-16 1:06 ` Paul Collins
2008-04-16 1:27 ` Tejun Heo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48055609.3020403@gmail.com \
--to=htejun@gmail.com \
--cc=jeff@garzik.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paul@burly.ondioline.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox