From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: "Li, Shaohua" <shaohua.li@intel.com>
Cc: "Zhao, Yakui" <yakui.zhao@intel.com>,
"linux-pm@lists.linux-foundation.org"
<linux-pm@lists.linux-foundation.org>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"stern@rowland.harvard.edu" <stern@rowland.harvard.edu>,
"dbrownell@users.sourceforge.net"
<dbrownell@users.sourceforge.net>
Subject: Re: [RFC 5/5] ACPI GPE based wakeup event detection
Date: Tue, 9 Sep 2008 13:17:50 +0200 [thread overview]
Message-ID: <200809091317.51125.rjw@sisk.pl> (raw)
In-Reply-To: <76780B19A496DC4B80439008DAD7076C01AC7F3061@PDSMSX501.ccr.corp.intel.com>
On Tuesday, 9 of September 2008, Li, Shaohua wrote:
> >> > +
> >> > /**
> >> > * acpi_bus_notify
> >> > * ---------------
> >> > @@ -506,6 +519,8 @@ static void acpi_bus_notify(acpi_handle
> >> > int result = 0;
> >> > struct acpi_device *device = NULL;
> >> >
> >> > + blocking_notifier_call_chain(&acpi_bus_notify_list,
> >> > + type, (void *)handle);
> >>
> >> Hm, perhaps I'm too tired and I'm missing something obvious, but can you
> >> tell me please why that has to be a notifier chain? It looks like you
> >add only
> >> one notifier to it, so seemingly it could be replaced by a direct call to
> >a
> >> function like acpi_gpe_pme_handler() (with modified list of arguments).
> >When the notifier chain is used, it can work regardless of whether the
> >CONFIG_ACPI_GPE_WAKEUP is set.
> >If the CONFIG_ACPI_GPE_WAKEUP is set, what you said is also OK.
> I actually had another usage for this (I sent a patchset for docking station, which uses it)
>
> >> > if (acpi_bus_get_device(handle, &device))
> >> > return;
> >> > Index: linux/drivers/acpi/sleep/wakeup.c
> >> > ===================================================================
> >> > --- linux.orig/drivers/acpi/sleep/wakeup.c 2008-09-08
> >14:28:55.000000000 +0800
> >> > +++ linux/drivers/acpi/sleep/wakeup.c 2008-09-08
> >15:04:23.000000000 +0800
> >> > @@ -142,6 +142,70 @@ void acpi_disable_wakeup_device(u8 sleep
> >> > spin_unlock(&acpi_device_lock);
> >> > }
> >> >
> >> > +#ifdef CONFIG_ACPI_GPE_WAKEUP
> >> > +static int acpi_gpe_pme_check(struct acpi_device *dev)
> >> > +{
> >> > + struct device *ldev;
> >> > +
> >> > + ldev = acpi_get_physical_device(dev->handle);
> >> > + if (!ldev)
> >> > + return -ENODEV;
> >> > + /*
> >> > + * AML code might already clear the event, so ignore the return
> >value.
> >> > + * Actually we can't correctly detect which device invokes GPE if
> >the
> >> > + * event is cleared.
> >> > + */
> >> > + if (ldev->bus->pm && ldev->bus->pm->base.wakeup_event)
> >> > + ldev->bus->pm->base.wakeup_event(ldev);
> >> > +
> >> > + /*
> >> > + * We always send the event. AML code usually identifies the exact
> >> > + * device of the GPE, let's trust it
> >> > + */
> >> > + device_receive_wakeup_event(ldev);
> >> > +
> >> > + put_device(ldev);
> >> > + return 0;
> >> > +}
> >> > +
> >> > +static int acpi_gpe_pme_handler(struct notifier_block *nb,
> >> > + unsigned long type, void *data)
> >> > +{
> >> > + int ret;
> >> > + acpi_handle handle = data;
> >> > + struct acpi_device *dev;
> >> > +
> >> > + if (type != ACPI_NOTIFY_DEVICE_WAKE)
> >> > + return NOTIFY_DONE;
> >> > +
> >> > + if (acpi_bus_get_device(handle, &dev))
> >> > + return NOTIFY_DONE;
> >> > +
> >> > + ret = acpi_gpe_pme_check(dev);
> >> > +
> >> > + acpi_disable_gpe(dev->wakeup.gpe_device, dev->wakeup.gpe_number,
> >> > + ACPI_NOT_ISR);
> >> > +
> >>
> >> At which point are dev->wakeup.gpe_device and dev->wakeup.gpe_number
> >> determined, for example, for PCI devices, and how?
> >In the boot phase a PCI device will be bound with an ACPI device. In the
> >system based on ACPI(GPE) when a PCI device generates a wakeup event, an
> >ACPI interrupt will be triggered and the ACPI AML code will send the
> >device wakeup event to the corresponding ACPI device. In such case we
> >can get the gpe number for the PCI device.
> This is correct. For example:
>
> Method (_L07, 0, NotSerialized)
> {
> Notify (\_SB.PCI0.SMBS, 0x02)
> }
>
> Method (_L05, 0, NotSerialized)
> {
> Notify (\_SB.PCI0.MODM, 0x02)
> }
>
> GPE 5,7 are wakeup GPEs
Well, it is not clear to me, though, which one of them is associated with the
PME# signal.
Also, the question was what piece of code in the kernel was responsible for the
identification of the wake-up GPEs and for setting dev->wakeup.gpe_device
and dev->wakeup.gpe_number as appropriate. In particular, how do we figure
out which wake-up GPE will be used for signalling PME# for devices that are
not on-board?
Thanks,
Rafael
next prev parent reply other threads:[~2008-09-09 11:13 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-08 9:19 [RFC 0/5] device wakeup event support shaohua.li
2008-09-08 9:19 ` [RFC 1/5] devcore introduce wakeup_event callback shaohua.li
2008-09-09 2:56 ` David Brownell
2008-09-09 3:49 ` Li, Shaohua
2008-09-09 5:26 ` David Brownell
2008-09-09 8:36 ` Li, Shaohua
2008-09-09 11:45 ` Rafael J. Wysocki
2008-09-09 14:22 ` Alan Stern
2008-09-09 14:18 ` Alan Stern
2008-09-09 15:52 ` David Brownell
2008-09-09 18:39 ` Alan Stern
2008-09-08 9:19 ` [RFC 2/5] devcore adds generic wakeup event handler shaohua.li
2008-09-08 9:19 ` [RFC 3/5] pci wakeup handler shaohua.li
2008-09-08 13:09 ` Rafael J. Wysocki
2008-09-09 1:44 ` Li, Shaohua
2008-09-09 2:56 ` David Brownell
2008-09-09 3:38 ` Li, Shaohua
2008-09-09 2:56 ` David Brownell
2008-09-09 3:33 ` Li, Shaohua
2008-09-09 4:04 ` David Brownell
2008-09-09 11:09 ` Rafael J. Wysocki
2008-09-09 16:18 ` David Brownell
2008-09-08 9:19 ` [RFC 4/5] PCIe native PME detection shaohua.li
2008-09-08 21:36 ` Rafael J. Wysocki
2008-09-09 1:21 ` Li, Shaohua
2008-09-08 9:19 ` [RFC 5/5] ACPI GPE based wakeup event detection shaohua.li
2008-09-08 20:57 ` Rafael J. Wysocki
2008-09-09 1:13 ` Zhao Yakui
2008-09-09 1:08 ` Li, Shaohua
2008-09-09 11:17 ` Rafael J. Wysocki [this message]
2008-09-09 14:08 ` Alan Stern
2008-09-09 2:41 ` [RFC 0/5] device wakeup event support David Brownell
2008-09-09 3:54 ` Li, Shaohua
-- strict thread matches above, loose matches on Subject: below --
2008-09-11 6:30 [RFC 0/5] device wakeup event support v2 Shaohua Li
2008-09-11 6:30 ` [RFC 5/5] ACPI GPE based wakeup event detection Shaohua Li
2008-10-19 20:39 ` Rafael J. Wysocki
2008-10-22 6:51 ` Shaohua Li
2008-10-22 12:12 ` Rafael J. Wysocki
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=200809091317.51125.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=dbrownell@users.sourceforge.net \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=shaohua.li@intel.com \
--cc=stern@rowland.harvard.edu \
--cc=yakui.zhao@intel.com \
/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