Messages in this thread Patch in this message | | | Date | Wed, 16 Apr 2008 09:33:50 +0900 | From | Tejun Heo <> | Subject | Re: ata2: SATA link down (SStatus 611 SControl 300) |
| |
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 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 | |