From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Len Brown <lenb@kernel.org>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
Linux PCI <linux-pci@vger.kernel.org>,
Jesse Barnes <jbarnes@virtuousgeek.org>,
Matthew Garrett <mjg59@srcf.ucam.org>,
Henrique de Moraes Holschuh <hmh@hmh.eng.br>,
pm list <linux-pm@lists.linux-foundation.org>
Subject: [PATCH] ACPI / PM: Allow PCI root bridges to wake up the system
Date: Sun, 30 Aug 2009 00:41:14 +0200 [thread overview]
Message-ID: <200908300041.14541.rjw@sisk.pl> (raw)
From: Rafael J. Wysocki <rjw@sisk.pl>
If PCI root bridge is declared in the ACPI tables as a wake-up
device, allow it to wake up the system by default.
This allows add-on PCI devices to work as wake-up devices on some
systems, where PME# asserted by an add-on device causes the root
bridge GPE to generate a wake-up event, without using
/proc/acpi/wakeup to change the root bridge wake-up setting.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
drivers/acpi/glue.c | 3 +++
drivers/acpi/pci_root.c | 25 +++++++++++++------------
include/acpi/acpi_bus.h | 1 +
3 files changed, 17 insertions(+), 12 deletions(-)
Index: linux-2.6/drivers/acpi/glue.c
===================================================================
--- linux-2.6.orig/drivers/acpi/glue.c
+++ linux-2.6/drivers/acpi/glue.c
@@ -168,6 +168,9 @@ static int acpi_bind_one(struct device *
"physical_node");
if (acpi_dev->wakeup.flags.valid) {
device_set_wakeup_capable(dev, true);
+ /* Allow PCI root bridges to wake up the system. */
+ if (acpi_dev_is_root_bridge(acpi_dev))
+ acpi_dev->wakeup.state.enabled = true;
device_set_wakeup_enable(dev,
acpi_dev->wakeup.state.enabled);
}
Index: linux-2.6/drivers/acpi/pci_root.c
===================================================================
--- linux-2.6.orig/drivers/acpi/pci_root.c
+++ linux-2.6/drivers/acpi/pci_root.c
@@ -138,26 +138,27 @@ acpi_handle acpi_get_pci_rootbridge_hand
EXPORT_SYMBOL_GPL(acpi_get_pci_rootbridge_handle);
/**
+ * acpi_dev_is_root_bridge - determine if an ACPI device is a PCI root bridge
+ * @device: ACPI device to check.
+ */
+bool acpi_dev_is_root_bridge(struct acpi_device *device)
+{
+ return !acpi_match_device_ids(device, root_device_ids);
+}
+
+/**
* acpi_is_root_bridge - determine whether an ACPI CA node is a PCI root bridge
- * @handle - the ACPI CA node in question.
- *
- * Note: we could make this API take a struct acpi_device * instead, but
- * for now, it's more convenient to operate on an acpi_handle.
+ * @handle: the ACPI CA node in question.
*/
int acpi_is_root_bridge(acpi_handle handle)
{
int ret;
struct acpi_device *device;
- ret = acpi_bus_get_device(handle, &device);
+ ret = !acpi_bus_get_device(handle, &device);
if (ret)
- return 0;
-
- ret = acpi_match_device_ids(device, root_device_ids);
- if (ret)
- return 0;
- else
- return 1;
+ ret = acpi_dev_is_root_bridge(device);
+ return ret;
}
EXPORT_SYMBOL_GPL(acpi_is_root_bridge);
Index: linux-2.6/include/acpi/acpi_bus.h
===================================================================
--- linux-2.6.orig/include/acpi/acpi_bus.h
+++ linux-2.6/include/acpi/acpi_bus.h
@@ -371,6 +371,7 @@ struct device *acpi_get_physical_device(
/* helper */
acpi_handle acpi_get_child(acpi_handle, acpi_integer);
+bool acpi_dev_is_root_bridge(struct acpi_device *);
int acpi_is_root_bridge(acpi_handle);
acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
next reply other threads:[~2009-08-29 22:41 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-29 22:41 Rafael J. Wysocki [this message]
2009-08-31 19:41 ` [linux-pm] [PATCH] ACPI / PM: Allow PCI root bridges to wake up the system Rafael J. Wysocki
2009-08-31 21:24 ` [RFC][PATCH update] " Rafael J. Wysocki
2009-09-01 13:25 ` Matthew Garrett
2009-09-01 13:25 ` Matthew Garrett
2009-09-01 19:03 ` Rafael J. Wysocki
2009-09-01 22:41 ` [linux-pm] " Rafael J. Wysocki
2009-09-03 22:02 ` [RFC][PATCH 0/4] PCI/ACPI PM: Propagate wake-up enable upstream Rafael J. Wysocki
2009-09-03 22:02 ` Rafael J. Wysocki
2009-09-03 22:03 ` [RFC][PATCH 1/4] PCI PM: Simplify PCI wake-up code Rafael J. Wysocki
2009-09-03 22:03 ` Rafael J. Wysocki
2009-09-03 22:04 ` [RFC][PATCH 2/4] PCI/ACPI PM: Rework some debug messages Rafael J. Wysocki
2009-09-03 22:04 ` Rafael J. Wysocki
2009-09-03 22:05 ` [RFC][PATCH 3/4] PCI PM: Introduce device flag wakeup_prepared Rafael J. Wysocki
2009-09-03 22:05 ` Rafael J. Wysocki
2009-09-03 22:07 ` [RFC][PATCH 4/4] PCI/ACPI PM: Propagate wake-up enable for devices w/o ACPI support Rafael J. Wysocki
2009-09-03 22:07 ` Rafael J. Wysocki
2009-09-04 2:13 ` ykzhao
2009-09-04 2:13 ` ykzhao
2009-09-04 14:39 ` Rafael J. Wysocki
2009-09-04 14:56 ` Matthew Garrett
2009-09-04 22:00 ` Rafael J. Wysocki
2009-09-04 22:06 ` Matthew Garrett
2009-09-04 22:06 ` Matthew Garrett
2009-09-04 22:21 ` Rafael J. Wysocki
2009-09-04 22:21 ` Rafael J. Wysocki
2009-09-04 22:00 ` Rafael J. Wysocki
2009-09-04 14:56 ` Matthew Garrett
2009-09-04 14:39 ` Rafael J. Wysocki
2009-09-04 22:03 ` [linux-pm] " Rafael J. Wysocki
2009-09-04 22:05 ` [RFC][PATCH 4/4 replacement] ACPI PM: Replace wakeup.prepared with reference counter Rafael J. Wysocki
2009-09-04 22:05 ` Rafael J. Wysocki
2009-09-04 22:06 ` [RFC][PATCH 5] PCI/ACPI PM: Propagate wake-up enable for devices w/o ACPI support Rafael J. Wysocki
2009-09-04 22:06 ` Rafael J. Wysocki
2009-09-04 22:03 ` [RFC][PATCH 4/4] " Rafael J. Wysocki
2009-09-08 21:11 ` [PATCH 0/5 update] PCI / ACPI PM: Propagate wake-up enable upstream Rafael J. Wysocki
2009-09-08 21:11 ` Rafael J. Wysocki
2009-09-08 21:12 ` [PATCH 1/5] PCI PM: Simplify PCI wake-up code Rafael J. Wysocki
2009-09-09 21:20 ` Jesse Barnes
2009-09-09 21:20 ` Jesse Barnes
2009-09-08 21:12 ` Rafael J. Wysocki
2009-09-08 21:13 ` [PATCH 2/5] PCI / ACPI PM: Rework some debug messages Rafael J. Wysocki
2009-09-08 21:13 ` Rafael J. Wysocki
2009-09-08 21:14 ` [PATCH 3/5] PCI PM: Introduce device flag wakeup_prepared Rafael J. Wysocki
2009-09-08 21:14 ` Rafael J. Wysocki
2009-09-08 21:15 ` [PATCH 4/5] ACPI PM: Replace wakeup.prepared with reference counter Rafael J. Wysocki
2009-09-08 21:15 ` Rafael J. Wysocki
2009-09-08 21:16 ` [PATCH 5/5] PCI / ACPI PM: Propagate wake-up enable for devices w/o ACPI support Rafael J. Wysocki
2009-09-08 21:16 ` Rafael J. Wysocki
2009-09-01 22:41 ` [RFC][PATCH update] ACPI / PM: Allow PCI root bridges to wake up the system Rafael J. Wysocki
2009-09-01 19:03 ` Rafael J. Wysocki
2009-08-31 21:24 ` Rafael J. Wysocki
2009-08-31 19:41 ` [PATCH] " Rafael J. Wysocki
-- strict thread matches above, loose matches on Subject: below --
2009-08-29 22:41 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=200908300041.14541.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=hmh@hmh.eng.br \
--cc=jbarnes@virtuousgeek.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=mjg59@srcf.ucam.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.