aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-08-06 23:34:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-06 23:34:19 -0400
commit7725131982477bffff8ffdea143434dcc69f5d90 (patch)
tree099440f6a8b11c8221ea99effec4c22818b3b577 /drivers/pci
parent6b22df74f7af62137772c280791c932855f7635b (diff)
parent7ef97e0e3a0f4b02601dde384127cc85d27e46e2 (diff)
Merge tag 'pm+acpi-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI and power management updates from Rafael Wysocki: "Again, ACPICA leads the pack (47 commits), followed by cpufreq (18 commits) and system suspend/hibernation (9 commits). From the new code perspective, the ACPICA update brings ACPI 5.1 to the table, including a new device configuration object called _DSD (Device Specific Data) that will hopefully help us to operate device properties like Device Trees do (at least to some extent) and changes related to supporting ACPI on ARM. Apart from that we have hibernation changes making it use radix trees to store memory bitmaps which should speed up some operations carried out by it quite significantly. We also have some power management changes related to suspend-to-idle (the "freeze" sleep state) support and more preliminary changes needed to support ACPI on ARM (outside of ACPICA). The rest is fixes and cleanups pretty much everywhere. Specifics: - ACPICA update to upstream version 20140724. That includes ACPI 5.1 material (support for the _CCA and _DSD predefined names, changes related to the DMAR and PCCT tables and ARM support among other things) and cleanups related to using ACPICA's header files. A major part of it is related to acpidump and the core code used by that utility. Changes from Bob Moore, David E Box, Lv Zheng, Sascha Wildner, Tomasz Nowicki, Hanjun Guo. - Radix trees for memory bitmaps used by the hibernation core from Joerg Roedel. - Support for waking up the system from suspend-to-idle (also known as the "freeze" sleep state) using ACPI-based PCI wakeup signaling (Rafael J Wysocki). - Fixes for issues related to ACPI button events (Rafael J Wysocki). - New device ID for an ACPI-enumerated device included into the Wildcat Point PCH from Jie Yang. - ACPI video updates related to backlight handling from Hans de Goede and Linus Torvalds. - Preliminary changes needed to support ACPI on ARM from Hanjun Guo and Graeme Gregory. - ACPI PNP core cleanups from Arjun Sreedharan and Zhang Rui. - Cleanups related to ACPI_COMPANION() and ACPI_HANDLE() macros (Rafael J Wysocki). - ACPI-based device hotplug cleanups from Wei Yongjun and Rafael J Wysocki. - Cleanups and improvements related to system suspend from Lan Tianyu, Randy Dunlap and Rafael J Wysocki. - ACPI battery cleanup from Wei Yongjun. - cpufreq core fixes from Viresh Kumar. - Elimination of a deadband effect from the cpufreq ondemand governor and intel_pstate driver cleanups from Stratos Karafotis. - 350MHz CPU support for the powernow-k6 cpufreq driver from Mikulas Patocka. - Fix for the imx6 cpufreq driver from Anson Huang. - cpuidle core and governor cleanups from Daniel Lezcano, Sandeep Tripathy and Mohammad Merajul Islam Molla. - Build fix for the big_little cpuidle driver from Sachin Kamat. - Configuration fix for the Operation Performance Points (OPP) framework from Mark Brown. - APM cleanup from Jean Delvare. - cpupower utility fixes and cleanups from Peter Senna Tschudin, Andrey Utkin, Himangi Saraogi, Rickard Strandqvist, Thomas Renninger" * tag 'pm+acpi-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (118 commits) ACPI / LPSS: add LPSS device for Wildcat Point PCH ACPI / PNP: Replace faulty is_hex_digit() by isxdigit() ACPICA: Update version to 20140724. ACPICA: ACPI 5.1: Update for PCCT table changes. ACPICA/ARM: ACPI 5.1: Update for GTDT table changes. ACPICA/ARM: ACPI 5.1: Update for MADT changes. ACPICA/ARM: ACPI 5.1: Update for FADT changes. ACPICA: ACPI 5.1: Support for the _CCA predifined name. ACPICA: ACPI 5.1: New notify value for System Affinity Update. ACPICA: ACPI 5.1: Support for the _DSD predefined name. ACPICA: Debug object: Add current value of Timer() to debug line prefix. ACPICA: acpihelp: Add UUID support, restructure some existing files. ACPICA: Utilities: Fix local printf issue. ACPICA: Tables: Update for DMAR table changes. ACPICA: Remove some extraneous printf arguments. ACPICA: Update for comments/formatting. No functional changes. ACPICA: Disassembler: Add support for the ToUUID opererator (macro). ACPICA: Remove a redundant cast to acpi_size for ACPI_OFFSET() macro. ACPICA: Work around an ancient GCC bug. ACPI / processor: Make it possible to get local x2apic id via _MAT ...
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c33
-rw-r--r--drivers/pci/pci-acpi.c76
2 files changed, 40 insertions, 69 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 602d153c7055..70741c8c46a0 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -80,8 +80,9 @@ static struct acpiphp_context *acpiphp_init_context(struct acpi_device *adev)
80 return NULL; 80 return NULL;
81 81
82 context->refcount = 1; 82 context->refcount = 1;
83 acpi_set_hp_context(adev, &context->hp, acpiphp_hotplug_notify, NULL, 83 context->hp.notify = acpiphp_hotplug_notify;
84 acpiphp_post_dock_fixup); 84 context->hp.fixup = acpiphp_post_dock_fixup;
85 acpi_set_hp_context(adev, &context->hp);
85 return context; 86 return context;
86} 87}
87 88
@@ -369,20 +370,6 @@ static acpi_status acpiphp_add_context(acpi_handle handle, u32 lvl, void *data,
369 return AE_OK; 370 return AE_OK;
370} 371}
371 372
372static struct acpiphp_bridge *acpiphp_dev_to_bridge(struct acpi_device *adev)
373{
374 struct acpiphp_bridge *bridge = NULL;
375
376 acpi_lock_hp_context();
377 if (adev->hp) {
378 bridge = to_acpiphp_root_context(adev->hp)->root_bridge;
379 if (bridge)
380 get_bridge(bridge);
381 }
382 acpi_unlock_hp_context();
383 return bridge;
384}
385
386static void cleanup_bridge(struct acpiphp_bridge *bridge) 373static void cleanup_bridge(struct acpiphp_bridge *bridge)
387{ 374{
388 struct acpiphp_slot *slot; 375 struct acpiphp_slot *slot;
@@ -753,9 +740,15 @@ static void acpiphp_sanitize_bus(struct pci_bus *bus)
753 740
754void acpiphp_check_host_bridge(struct acpi_device *adev) 741void acpiphp_check_host_bridge(struct acpi_device *adev)
755{ 742{
756 struct acpiphp_bridge *bridge; 743 struct acpiphp_bridge *bridge = NULL;
757 744
758 bridge = acpiphp_dev_to_bridge(adev); 745 acpi_lock_hp_context();
746 if (adev->hp) {
747 bridge = to_acpiphp_root_context(adev->hp)->root_bridge;
748 if (bridge)
749 get_bridge(bridge);
750 }
751 acpi_unlock_hp_context();
759 if (bridge) { 752 if (bridge) {
760 pci_lock_rescan_remove(); 753 pci_lock_rescan_remove();
761 754
@@ -884,7 +877,7 @@ void acpiphp_enumerate_slots(struct pci_bus *bus)
884 goto err; 877 goto err;
885 878
886 root_context->root_bridge = bridge; 879 root_context->root_bridge = bridge;
887 acpi_set_hp_context(adev, &root_context->hp, NULL, NULL, NULL); 880 acpi_set_hp_context(adev, &root_context->hp);
888 } else { 881 } else {
889 struct acpiphp_context *context; 882 struct acpiphp_context *context;
890 883
@@ -927,7 +920,7 @@ void acpiphp_enumerate_slots(struct pci_bus *bus)
927 kfree(bridge); 920 kfree(bridge);
928} 921}
929 922
930void acpiphp_drop_bridge(struct acpiphp_bridge *bridge) 923static void acpiphp_drop_bridge(struct acpiphp_bridge *bridge)
931{ 924{
932 if (pci_is_root_bus(bridge->pci_bus)) { 925 if (pci_is_root_bus(bridge->pci_bus)) {
933 struct acpiphp_root_context *root_context; 926 struct acpiphp_root_context *root_context;
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index ca4927ba8433..37263b0ebfe3 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -18,31 +18,31 @@
18#include "pci.h" 18#include "pci.h"
19 19
20/** 20/**
21 * pci_acpi_wake_bus - Wake-up notification handler for root buses. 21 * pci_acpi_wake_bus - Root bus wakeup notification fork function.
22 * @handle: ACPI handle of a device the notification is for. 22 * @work: Work item to handle.
23 * @event: Type of the signaled event.
24 * @context: PCI root bus to wake up devices on.
25 */ 23 */
26static void pci_acpi_wake_bus(acpi_handle handle, u32 event, void *context) 24static void pci_acpi_wake_bus(struct work_struct *work)
27{ 25{
28 struct pci_bus *pci_bus = context; 26 struct acpi_device *adev;
27 struct acpi_pci_root *root;
29 28
30 if (event == ACPI_NOTIFY_DEVICE_WAKE && pci_bus) 29 adev = container_of(work, struct acpi_device, wakeup.context.work);
31 pci_pme_wakeup_bus(pci_bus); 30 root = acpi_driver_data(adev);
31 pci_pme_wakeup_bus(root->bus);
32} 32}
33 33
34/** 34/**
35 * pci_acpi_wake_dev - Wake-up notification handler for PCI devices. 35 * pci_acpi_wake_dev - PCI device wakeup notification work function.
36 * @handle: ACPI handle of a device the notification is for. 36 * @handle: ACPI handle of a device the notification is for.
37 * @event: Type of the signaled event. 37 * @work: Work item to handle.
38 * @context: PCI device object to wake up.
39 */ 38 */
40static void pci_acpi_wake_dev(acpi_handle handle, u32 event, void *context) 39static void pci_acpi_wake_dev(struct work_struct *work)
41{ 40{
42 struct pci_dev *pci_dev = context; 41 struct acpi_device_wakeup_context *context;
42 struct pci_dev *pci_dev;
43 43
44 if (event != ACPI_NOTIFY_DEVICE_WAKE || !pci_dev) 44 context = container_of(work, struct acpi_device_wakeup_context, work);
45 return; 45 pci_dev = to_pci_dev(context->dev);
46 46
47 if (pci_dev->pme_poll) 47 if (pci_dev->pme_poll)
48 pci_dev->pme_poll = false; 48 pci_dev->pme_poll = false;
@@ -65,23 +65,12 @@ static void pci_acpi_wake_dev(acpi_handle handle, u32 event, void *context)
65} 65}
66 66
67/** 67/**
68 * pci_acpi_add_bus_pm_notifier - Register PM notifier for given PCI bus. 68 * pci_acpi_add_bus_pm_notifier - Register PM notifier for root PCI bus.
69 * @dev: ACPI device to add the notifier for. 69 * @dev: PCI root bridge ACPI device.
70 * @pci_bus: PCI bus to walk checking for PME status if an event is signaled.
71 */
72acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev,
73 struct pci_bus *pci_bus)
74{
75 return acpi_add_pm_notifier(dev, pci_acpi_wake_bus, pci_bus);
76}
77
78/**
79 * pci_acpi_remove_bus_pm_notifier - Unregister PCI bus PM notifier.
80 * @dev: ACPI device to remove the notifier from.
81 */ 70 */
82acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev) 71acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev)
83{ 72{
84 return acpi_remove_pm_notifier(dev, pci_acpi_wake_bus); 73 return acpi_add_pm_notifier(dev, NULL, pci_acpi_wake_bus);
85} 74}
86 75
87/** 76/**
@@ -92,16 +81,7 @@ acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev)
92acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev, 81acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev,
93 struct pci_dev *pci_dev) 82 struct pci_dev *pci_dev)
94{ 83{
95 return acpi_add_pm_notifier(dev, pci_acpi_wake_dev, pci_dev); 84 return acpi_add_pm_notifier(dev, &pci_dev->dev, pci_acpi_wake_dev);
96}
97
98/**
99 * pci_acpi_remove_pm_notifier - Unregister PCI device PM notifier.
100 * @dev: ACPI device to remove the notifier from.
101 */
102acpi_status pci_acpi_remove_pm_notifier(struct acpi_device *dev)
103{
104 return acpi_remove_pm_notifier(dev, pci_acpi_wake_dev);
105} 85}
106 86
107phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle) 87phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle)
@@ -170,14 +150,13 @@ static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev)
170 150
171static bool acpi_pci_power_manageable(struct pci_dev *dev) 151static bool acpi_pci_power_manageable(struct pci_dev *dev)
172{ 152{
173 acpi_handle handle = ACPI_HANDLE(&dev->dev); 153 struct acpi_device *adev = ACPI_COMPANION(&dev->dev);
174 154 return adev ? acpi_device_power_manageable(adev) : false;
175 return handle ? acpi_bus_power_manageable(handle) : false;
176} 155}
177 156
178static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) 157static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
179{ 158{
180 acpi_handle handle = ACPI_HANDLE(&dev->dev); 159 struct acpi_device *adev = ACPI_COMPANION(&dev->dev);
181 static const u8 state_conv[] = { 160 static const u8 state_conv[] = {
182 [PCI_D0] = ACPI_STATE_D0, 161 [PCI_D0] = ACPI_STATE_D0,
183 [PCI_D1] = ACPI_STATE_D1, 162 [PCI_D1] = ACPI_STATE_D1,
@@ -188,7 +167,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
188 int error = -EINVAL; 167 int error = -EINVAL;
189 168
190 /* If the ACPI device has _EJ0, ignore the device */ 169 /* If the ACPI device has _EJ0, ignore the device */
191 if (!handle || acpi_has_method(handle, "_EJ0")) 170 if (!adev || acpi_has_method(adev->handle, "_EJ0"))
192 return -ENODEV; 171 return -ENODEV;
193 172
194 switch (state) { 173 switch (state) {
@@ -202,7 +181,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
202 case PCI_D1: 181 case PCI_D1:
203 case PCI_D2: 182 case PCI_D2:
204 case PCI_D3hot: 183 case PCI_D3hot:
205 error = acpi_bus_set_power(handle, state_conv[state]); 184 error = acpi_device_set_power(adev, state_conv[state]);
206 } 185 }
207 186
208 if (!error) 187 if (!error)
@@ -214,9 +193,8 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
214 193
215static bool acpi_pci_can_wakeup(struct pci_dev *dev) 194static bool acpi_pci_can_wakeup(struct pci_dev *dev)
216{ 195{
217 acpi_handle handle = ACPI_HANDLE(&dev->dev); 196 struct acpi_device *adev = ACPI_COMPANION(&dev->dev);
218 197 return adev ? acpi_device_can_wakeup(adev) : false;
219 return handle ? acpi_bus_can_wakeup(handle) : false;
220} 198}
221 199
222static void acpi_pci_propagate_wakeup_enable(struct pci_bus *bus, bool enable) 200static void acpi_pci_propagate_wakeup_enable(struct pci_bus *bus, bool enable)