All of lore.kernel.org
 help / color / mirror / Atom feed
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: Re: ata2: SATA link down (SStatus 611 SControl 300)
Date: Wed, 16 Apr 2008 09:33:50 +0900	[thread overview]
Message-ID: <4805496E.7000306@gmail.com> (raw)
In-Reply-To: <48054515.4020202@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 862 bytes --]

Tejun Heo wrote:
> Paul Collins wrote:
>> Tejun Heo <htejun@gmail.com> writes:
>>
>>> Paul Collins wrote:
>>>> I found a setting labelled "SATA Power Management".  It was set to
>>>> "Enable".  When I set it to "Disable", 2.6.25-rc9 detected the optical
>>>> drive.
>>> This can't be something changed between 2.6.24 and 2.6.25-rc9.  Can
>>> you please double check that?
>>
>> I double-checked as follows:
>>
>> * Verified "SATA Power Management" set to "Enable"
>> * Verified optical device present in 2.6.24.3
>> * Verified optical device not present in 2.6.25-rc9
> 
> Thanks for checking.  Yeah, on the second though, ata_piix as of 
> 2.6.24.3 doesn't have SCR access at all, so it would have just worked. 
> Maybe what's necessary is more refined link onlineness test.  I'll prep 
> a patch.
> 

Can you please try the attached patch?  Thanks.

-- 
tejun

[-- Attachment #2: ata_piix-debug-3.patch --]
[-- Type: text/x-patch, Size: 1188 bytes --]

diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
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
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c

  reply	other threads:[~2008-04-16  0:34 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 [this message]
2008-04-16  1:06                     ` Paul Collins
2008-04-16  1:27                       ` [PATCH #upstream-fixes] libata: force hardreset if the link is in powersave mode Tejun Heo

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=4805496E.7000306@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.