Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933388AbYFGBTq (ORCPT ); Fri, 6 Jun 2008 21:19:46 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760389AbYFGBJ3 (ORCPT ); Fri, 6 Jun 2008 21:09:29 -0400 Received: from sous-sol.org ([216.99.217.87]:42506 "EHLO sous-sol.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757627AbYFGBJW (ORCPT ); Fri, 6 Jun 2008 21:09:22 -0400 Message-Id: <20080607010555.470605116@sous-sol.org> References: <20080607010215.358296706@sous-sol.org> User-Agent: quilt/0.46-1 Date: Fri, 06 Jun 2008 18:02:25 -0700 From: Chris Wright To: linux-kernel@vger.kernel.org, stable@kernel.org, Jeff Garzik , IDE/ATA development list Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , Michael Krufky , Chuck Ebbert , Domenico Andreoli , torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, Tejun Heo , matthieu.castet@parrot.com, Greg Kroah-Hartman Subject: [patch 10/50] libata: force hardreset if link is in powersave mode Content-Disposition: inline; filename=libata-force-hardreset-if-link-is-in-powersave-mode.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1778 Lines: 54 -stable review patch. If anyone has any objections, please let us know. --------------------- From: Tejun Heo 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 Cc: Jeff Garzik Signed-off-by: Greg Kroah-Hartman Signed-off-by: Chris Wright --- drivers/ata/libata-core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -3947,6 +3947,7 @@ int ata_std_prereset(struct ata_link *li 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 *li 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; -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/