From: Tejun Heo <htejun@gmail.com>
To: Greg KH <greg@kroah.com>
Cc: jgarzik@pobox.com, linux-ide@vger.kernel.org
Subject: Re: long boot delay for SATA cdrom on current 2.6.17-git
Date: Fri, 30 Jun 2006 13:49:12 +0900 [thread overview]
Message-ID: <20060630044912.GA2592@htj.dyndns.org> (raw)
In-Reply-To: <20060630025341.GA4675@kroah.com>
On Thu, Jun 29, 2006 at 07:53:41PM -0700, Greg KH wrote:
> With Linus's current -git tree (like 2.6.17-git13), it takes a long time
> to boot my laptop. Turns out the SATA cdrom discovery process is taking
> up many seconds.
Was any previous version okay? No timeout messages on boot?
> This laptop does not have a SATA hard drive, only a SATA cdrom drive.
> I've included the boot log below and trimmed it after the delay
> happened, as I doubt anything after it would be relevant.
>
> Is there any patch I can test to help fix this?
This seems to be the ghost device problem which occurs when the first
device is ATAPI but the second slot is empty.
> My .config is also attached, if that helps any.
Please try the following patch.
[PATCH] ata_piix: fix ghost device probing by honoring PCS present bits
Move out PCS handling from piix_sata_prereset() into
piix_sata_present_mask() and use it from newly implemented
piix_sata_softreset(). Class codes for devices which are indicated to
be absent by PCS are cleared to ATA_DEV_NONE. This fixes ghost device
problem reported on ICH6 and 7.
This patch moves PCS handling from prereset to softreset, which makes
two behavior changes.
* perform softreset even when PCS indicates no device
* PCS handling is repeated before retrying softresets due to reset
failures.
Both behavior changes are intended and more consistent with how other
drivers behave.
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
This patch fixes ghost device problem on my machine and also somehow
allows me to warm plug the second slot successfully (e.g. if PM is
occupied and PS not, I couldn't warm plug PS, but with this patch, it
works).
This patch is against upstream + set-PIO-0-patch + all hotplug
patches, and is also available from for-jeff git tree, tagged with
fj-ata_piix-fix-ghost.
drivers/scsi/ata_piix.c | 51 ++++++++++++++++++++++++++++++++++++-----------
1 files changed, 39 insertions(+), 12 deletions(-)
cafaa04becd7fa90c562d4af10513c0acdc7fe7c
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
index 521b718..c8fdad5 100644
--- a/drivers/scsi/ata_piix.c
+++ b/drivers/scsi/ata_piix.c
@@ -491,21 +491,20 @@ static void piix_pata_error_handler(stru
}
/**
- * piix_sata_prereset - prereset for SATA host controller
+ * piix_sata_present_mask - determine present mask for SATA host controller
* @ap: Target port
*
* Reads and configures SATA PCI device's PCI config register
* Port Configuration and Status (PCS) to determine port and
- * device availability. Return -ENODEV to skip reset if no
- * device is present.
+ * device availability.
*
* LOCKING:
- * None (inherited from caller).
+ * Kernel thread context (may sleep).
*
* RETURNS:
- * 0 if device is present, -ENODEV otherwise.
+ * determined present_mask
*/
-static int piix_sata_prereset(struct ata_port *ap)
+static unsigned int piix_sata_present_mask(struct ata_port *ap)
{
struct pci_dev *pdev = to_pci_dev(ap->host_set->dev);
const unsigned int *map = ap->host_set->private_data;
@@ -547,18 +546,46 @@ static int piix_sata_prereset(struct ata
DPRINTK("ata%u: LEAVE, pcs=0x%x present_mask=0x%x\n",
ap->id, pcs, present_mask);
- if (!present_mask) {
- ata_port_printk(ap, KERN_INFO, "SATA port has no device.\n");
- ap->eh_context.i.action &= ~ATA_EH_RESET_MASK;
- return 0;
+ return present_mask;
+}
+
+/**
+ * piix_sata_softreset - reset SATA host port via ATA SRST
+ * @ap: port to reset
+ * @classes: resulting classes of attached devices
+ *
+ * Reset SATA host port via ATA SRST. On controllers with
+ * reliable PCS present bits, the bits are used to determine
+ * device presence.
+ *
+ * LOCKING:
+ * Kernel thread context (may sleep)
+ *
+ * RETURNS:
+ * 0 on success, -errno otherwise.
+ */
+static int piix_sata_softreset(struct ata_port *ap, unsigned int *classes)
+{
+ unsigned int present_mask;
+ int i, rc;
+
+ present_mask = piix_sata_present_mask(ap);
+
+ rc = ata_std_softreset(ap, classes);
+ if (rc)
+ return rc;
+
+ for (i = 0; i < ATA_MAX_DEVICES; i++) {
+ if (!(present_mask & (1 << i)))
+ classes[i] = ATA_DEV_NONE;
}
- return ata_std_prereset(ap);
+ return 0;
}
static void piix_sata_error_handler(struct ata_port *ap)
{
- ata_bmdma_drive_eh(ap, piix_sata_prereset, ata_std_softreset, NULL,
+ ata_bmdma_drive_eh(ap, ata_std_prereset, piix_sata_softreset, NULL,
ata_std_postreset);
}
--
1.3.2
next prev parent reply other threads:[~2006-06-30 4:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-30 2:53 long boot delay for SATA cdrom on current 2.6.17-git Greg KH
2006-06-30 4:49 ` Tejun Heo [this message]
2006-06-30 5:10 ` Greg KH
2006-06-30 5:20 ` Greg KH
2006-06-30 5:26 ` Tejun Heo
2006-06-30 22:10 ` Greg KH
2006-07-08 15:19 ` Tejun Heo
2006-07-11 2:30 ` Albert Lee
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=20060630044912.GA2592@htj.dyndns.org \
--to=htejun@gmail.com \
--cc=greg@kroah.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).