From: Matthew Garrett <mjg59@srcf.ucam.org>
To: Tejun Heo <htejun@gmail.com>
Cc: linux-ide@vger.kernel.org, Jeff Garzik <jeff@garzik.org>, hmacht@suse.de
Subject: Re: 2.6.25 semantic change in bay handling?
Date: Tue, 6 May 2008 10:17:18 +0100 [thread overview]
Message-ID: <20080506091718.GA11617@srcf.ucam.org> (raw)
In-Reply-To: <48201C7D.1070303@gmail.com>
On Tue, May 06, 2008 at 05:53:17PM +0900, Tejun Heo wrote:
> Matthew Garrett wrote:
> >Yeah, but I can't see an easy way of doing that. It's not enough to keep
> >track of the current state and assume that it's either an insertion or
> >removal as a result - some machines fire bus checks on resume, even if
> >the bay device hasn't been changed.
>
> All we need is separate out the ejection case out. For suspend, resume,
> attach or whatever can be handled the same way. The problem occurs
> because some controllers get very unhappy when certain registers are
> accessed when there's no device attached to it.
Ok. What we probably ought to be doing then is checking the _STA method
on the bay when we receive a bus check. That should be sufficient for
determining whether the device is actually there (if so, perform a
hotplug) or not (flag the device as detached, don't probe). I don't have
the hardware here right now, but something like...
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index 8c1cfc6..f1d5c87 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -126,37 +126,49 @@ static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev,
struct ata_eh_info *ehi;
struct kobject *kobj = NULL;
int wait = 0;
- unsigned long flags;
+ unsigned long flags, sta;
+ acpi_status status;
+ acpi_handle handle;
if (!ap)
ap = dev->link->ap;
ehi = &ap->link.eh_info;
+ if (dev)
+ handle = dev->acpi_handle;
+ else
+ handle = ap->handle;
+
spin_lock_irqsave(ap->lock, flags);
switch (event) {
case ACPI_NOTIFY_BUS_CHECK:
case ACPI_NOTIFY_DEVICE_CHECK:
+ status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
+ if (!ACPI_SUCCESS(status)) {
+ printk(KERN_ERR "Unable to evaluate bay status\n");
+ break;
+ }
ata_ehi_push_desc(ehi, "ACPI event");
- ata_ehi_hotplugged(ehi);
- ata_port_freeze(ap);
- break;
-
- case ACPI_NOTIFY_EJECT_REQUEST:
- ata_ehi_push_desc(ehi, "ACPI event");
- if (dev)
- dev->flags |= ATA_DFLAG_DETACH;
- else {
- struct ata_link *tlink;
- struct ata_device *tdev;
-
- ata_port_for_each_link(tlink, ap)
- ata_link_for_each_dev(tdev, tlink)
+ if (sta) {
+ ata_ehi_hotplugged(ehi);
+ ata_port_freeze(ap);
+ } else {
+ /* The device has gone - unplug it */
+ if (dev)
+ dev->flags |= ATA_DFLAG_DETACH;
+ else {
+ struct ata_link *tlink;
+ struct ata_device *tdev;
+
+ ata_port_for_each_link(tlink, ap)
+ ata_link_for_each_dev(tdev, tlink)
tdev->flags |= ATA_DFLAG_DETACH;
+ }
+ wait = 1;
+ ata_port_freeze(ap);
+ ata_port_schedule_eh(ap);
}
-
- ata_port_schedule_eh(ap);
- wait = 1;
break;
}
Might work. Possibly. I'll be able to test on real hardware sometime
next week, but I don't have access to an ACPI dock with an internal bay.
I'm not sure how that case would be handled off-hand.
--
Matthew Garrett | mjg59@srcf.ucam.org
next prev parent reply other threads:[~2008-05-06 9:17 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-05 22:33 2.6.25 semantic change in bay handling? Matthew Garrett
2008-05-06 8:13 ` Holger Macht
2008-05-06 8:21 ` Matthew Garrett
2008-05-06 8:40 ` Tejun Heo
2008-05-06 8:46 ` Matthew Garrett
2008-05-06 8:53 ` Tejun Heo
2008-05-06 9:17 ` Matthew Garrett [this message]
2008-05-06 11:21 ` Holger Macht
2008-05-06 11:31 ` Matthew Garrett
2008-05-06 17:27 ` Holger Macht
2008-05-06 17:48 ` Matthew Garrett
2008-05-06 18:36 ` Holger Macht
2008-05-06 18:48 ` Matthew Garrett
2008-05-06 22:06 ` Holger Macht
2008-05-06 9:29 ` Holger Macht
2008-05-06 9:39 ` Matthew Garrett
2008-05-06 9:26 ` Holger Macht
2008-05-06 9:36 ` Matthew Garrett
2008-05-19 16:29 ` [PATCH] Fixups to ATA ACPI hotplug Matthew Garrett
2008-05-20 7:44 ` Holger Macht
2008-05-20 10:20 ` Matthew Garrett
2008-05-20 13:18 ` Holger Macht
2008-05-20 13:22 ` Matthew Garrett
2008-05-20 13:58 ` Holger Macht
2008-05-20 14:00 ` Matthew Garrett
2008-05-21 22:26 ` Andrew Morton
2008-05-20 8:49 ` Holger Macht
2008-05-06 8:40 ` 2.6.25 semantic change in bay handling? Holger Macht
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=20080506091718.GA11617@srcf.ucam.org \
--to=mjg59@srcf.ucam.org \
--cc=hmacht@suse.de \
--cc=htejun@gmail.com \
--cc=jeff@garzik.org \
--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 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.