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
--
| Tomasz Kłoczko | Is it time for remove (crap) ALSA from kernel tree ? |
| Aubrey | O_DIRECT question |
| Linus Torvalds | Linux 2.6.27-rc8 |
| David Miller | Slow DOWN, please!!! |
git: | |
| Francis Moreau | emacs and git... |
| Linus Torvalds | I'm a total push-over.. |
| Keith Packard | Re: parsecvs tool now creates git repositories |
| Junio C Hamano | Re: [PATCH] Teach remote machinery about remotes.default config variable |
| Jason Dixon | Wasting our Freedom |
| Richard Stallman | Real men don't attack straw men |
| Edwin Eyan Moragas | poll(2) vs kqueue(2) performance |
| James Hartley | scp batch mode? |
| Karen Xie | [RFC][PATCH 1/1] cxgb3i: cxgb3 iSCSI initiator |
| Lennert Buytenhek | [PATCH 14/39] mv643xx_eth: remove port serial status register bit defines |
| Alan Cox | Re: [PATCH] drivers/net: remove network drivers' last few uses of IRQF_SAMPLE_RANDOM |
| Andrew Morton | Re: [Bugme-new] [Bug 11036] New: atl1 tx busy and hw csum wrong |
| high memory | 1 hour ago | Linux kernel |
| semaphore access speed | 4 hours ago | Applications and Utilities |
| the kernel how to power off the machine | 5 hours ago | Linux kernel |
| Easter Eggs in windows XP | 8 hours ago | Windows |
| Shared swap partition | 9 hours ago | Linux general |
| Root password | 9 hours ago | Linux general |
| Where/when DNOTIFY is used? | 11 hours ago | Linux kernel |
| How to convert Linux Kernel built-in module into a loadable module | 13 hours ago | Linux kernel |
| Linux 2.6.24 and I/O schedulers | 14 hours ago | Linux kernel |
| USB Driver -- Interrupt Polling -- A Little Help Please | 19 hours ago | Linux general |
