aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-24 18:51:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-24 18:51:02 -0500
commit09da8dfa98682d871987145ed11e3232accac860 (patch)
tree152a9bb1e52f70db6efb66fffbdc4871f749d7df /drivers/pci
parent3aacd625f20129f5a41ea3ff3b5353b0e4dabd01 (diff)
parent7744064731a9543105e207504e0262f883bc14c0 (diff)
Merge tag 'pm+acpi-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI and power management updates from Rafael Wysocki: "As far as the number of commits goes, the top spot belongs to ACPI this time with cpufreq in the second position and a handful of PM core, PNP and cpuidle updates. They are fixes and cleanups mostly, as usual, with a couple of new features in the mix. The most visible change is probably that we will create struct acpi_device objects (visible in sysfs) for all devices represented in the ACPI tables regardless of their status and there will be a new sysfs attribute under those objects allowing user space to check that status via _STA. Consequently, ACPI device eject or generally hot-removal will not delete those objects, unless the table containing the corresponding namespace nodes is unloaded, which is extremely rare. Also ACPI container hotplug will be handled quite a bit differently and cpufreq will support CPU boost ("turbo") generically and not only in the acpi-cpufreq driver. Specifics: - ACPI core changes to make it create a struct acpi_device object for every device represented in the ACPI tables during all namespace scans regardless of the current status of that device. In accordance with this, ACPI hotplug operations will not delete those objects, unless the underlying ACPI tables go away. - On top of the above, new sysfs attribute for ACPI device objects allowing user space to check device status by triggering the execution of _STA for its ACPI object. From Srinivas Pandruvada. - ACPI core hotplug changes reducing code duplication, integrating the PCI root hotplug with the core and reworking container hotplug. - ACPI core simplifications making it use ACPI_COMPANION() in the code "glueing" ACPI device objects to "physical" devices. - ACPICA update to upstream version 20131218. This adds support for the DBG2 and PCCT tables to ACPICA, fixes some bugs and improves debug facilities. From Bob Moore, Lv Zheng and Betty Dall. - Init code change to carry out the early ACPI initialization earlier. That should allow us to use ACPI during the timekeeping initialization and possibly to simplify the EFI initialization too. From Chun-Yi Lee. - Clenups of the inclusions of ACPI headers in many places all over from Lv Zheng and Rashika Kheria (work in progress). - New helper for ACPI _DSM execution and rework of the code in drivers that uses _DSM to execute it via the new helper. From Jiang Liu. - New Win8 OSI blacklist entries from Takashi Iwai. - Assorted ACPI fixes and cleanups from Al Stone, Emil Goode, Hanjun Guo, Lan Tianyu, Masanari Iida, Oliver Neukum, Prarit Bhargava, Rashika Kheria, Tang Chen, Zhang Rui. - intel_pstate driver updates, including proper Baytrail support, from Dirk Brandewie and intel_pstate documentation from Ramkumar Ramachandra. - Generic CPU boost ("turbo") support for cpufreq from Lukasz Majewski. - powernow-k6 cpufreq driver fixes from Mikulas Patocka. - cpufreq core fixes and cleanups from Viresh Kumar, Jane Li, Mark Brown. - Assorted cpufreq drivers fixes and cleanups from Anson Huang, John Tobias, Paul Bolle, Paul Walmsley, Sachin Kamat, Shawn Guo, Viresh Kumar. - cpuidle cleanups from Bartlomiej Zolnierkiewicz. - Support for hibernation APM events from Bin Shi. - Hibernation fix to avoid bringing up nonboot CPUs with ACPI EC disabled during thaw transitions from Bjørn Mork. - PM core fixes and cleanups from Ben Dooks, Leonardo Potenza, Ulf Hansson. - PNP subsystem fixes and cleanups from Dmitry Torokhov, Levente Kurusa, Rashika Kheria. - New tool for profiling system suspend from Todd E Brandt and a cpupower tool cleanup from One Thousand Gnomes" * tag 'pm+acpi-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (153 commits) thermal: exynos: boost: Automatic enable/disable of BOOST feature (at Exynos4412) cpufreq: exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ Documentation: cpufreq / boost: Update BOOST documentation cpufreq: exynos: Extend Exynos cpufreq driver to support boost cpufreq / boost: Kconfig: Support for software-managed BOOST acpi-cpufreq: Adjust the code to use the common boost attribute cpufreq: Add boost frequency support in core intel_pstate: Add trace point to report internal state. cpufreq: introduce cpufreq_generic_get() routine ARM: SA1100: Create dummy clk_get_rate() to avoid build failures cpufreq: stats: create sysfs entries when cpufreq_stats is a module cpufreq: stats: free table and remove sysfs entry in a single routine cpufreq: stats: remove hotplug notifiers cpufreq: stats: handle cpufreq_unregister_driver() and suspend/resume properly cpufreq: speedstep: remove unused speedstep_get_state platform: introduce OF style 'modalias' support for platform bus PM / tools: new tool for suspend/resume performance optimization ACPI: fix module autoloading for ACPI enumerated devices ACPI: add module autoloading support for ACPI enumerated devices ACPI: fix create_modalias() return value handling ...
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c2
-rw-r--r--drivers/pci/hotplug/acpiphp_ibm.c3
-rw-r--r--drivers/pci/hotplug/pciehp.h2
-rw-r--r--drivers/pci/ioapic.c1
-rw-r--r--drivers/pci/pci-acpi.c17
-rw-r--r--drivers/pci/pci-label.c130
6 files changed, 45 insertions, 110 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index ee26bac2d378..cd929aed3613 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -494,7 +494,7 @@ static void acpiphp_bus_add(acpi_handle handle)
494 494
495 acpi_bus_scan(handle); 495 acpi_bus_scan(handle);
496 acpi_bus_get_device(handle, &adev); 496 acpi_bus_get_device(handle, &adev);
497 if (adev) 497 if (acpi_device_enumerated(adev))
498 acpi_device_set_power(adev, ACPI_STATE_D0); 498 acpi_device_set_power(adev, ACPI_STATE_D0);
499} 499}
500 500
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
index ecfac7e72d91..8dcccffd6e21 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -31,12 +31,11 @@
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <acpi/acpi_bus.h>
35#include <linux/sysfs.h> 34#include <linux/sysfs.h>
36#include <linux/kobject.h> 35#include <linux/kobject.h>
37#include <asm/uaccess.h>
38#include <linux/moduleparam.h> 36#include <linux/moduleparam.h>
39#include <linux/pci.h> 37#include <linux/pci.h>
38#include <asm/uaccess.h>
40 39
41#include "acpiphp.h" 40#include "acpiphp.h"
42#include "../pci.h" 41#include "../pci.h"
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index ccb0925bcd7b..88b37cad4b35 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -162,8 +162,6 @@ static inline const char *slot_name(struct slot *slot)
162} 162}
163 163
164#ifdef CONFIG_ACPI 164#ifdef CONFIG_ACPI
165#include <acpi/acpi.h>
166#include <acpi/acpi_bus.h>
167#include <linux/pci-acpi.h> 165#include <linux/pci-acpi.h>
168 166
169void __init pciehp_acpi_slot_detection_init(void); 167void __init pciehp_acpi_slot_detection_init(void);
diff --git a/drivers/pci/ioapic.c b/drivers/pci/ioapic.c
index 2c2930ea06ad..6b2b7dddbbdb 100644
--- a/drivers/pci/ioapic.c
+++ b/drivers/pci/ioapic.c
@@ -20,7 +20,6 @@
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/acpi.h> 21#include <linux/acpi.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <acpi/acpi_bus.h>
24 23
25struct ioapic { 24struct ioapic {
26 acpi_handle handle; 25 acpi_handle handle;
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 2bdbc0080204..f49abef88485 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -12,9 +12,6 @@
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/pci-aspm.h> 14#include <linux/pci-aspm.h>
15#include <acpi/acpi.h>
16#include <acpi/acpi_bus.h>
17
18#include <linux/pci-acpi.h> 15#include <linux/pci-acpi.h>
19#include <linux/pm_runtime.h> 16#include <linux/pm_runtime.h>
20#include <linux/pm_qos.h> 17#include <linux/pm_qos.h>
@@ -306,10 +303,10 @@ void acpi_pci_remove_bus(struct pci_bus *bus)
306} 303}
307 304
308/* ACPI bus type */ 305/* ACPI bus type */
309static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) 306static struct acpi_device *acpi_pci_find_companion(struct device *dev)
310{ 307{
311 struct pci_dev *pci_dev = to_pci_dev(dev); 308 struct pci_dev *pci_dev = to_pci_dev(dev);
312 bool is_bridge; 309 bool check_children;
313 u64 addr; 310 u64 addr;
314 311
315 /* 312 /*
@@ -317,14 +314,12 @@ static int acpi_pci_find_device(struct device *dev, acpi_handle *handle)
317 * is set only after acpi_pci_find_device() has been called for the 314 * is set only after acpi_pci_find_device() has been called for the
318 * given device. 315 * given device.
319 */ 316 */
320 is_bridge = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE 317 check_children = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE
321 || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS; 318 || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS;
322 /* Please ref to ACPI spec for the syntax of _ADR */ 319 /* Please ref to ACPI spec for the syntax of _ADR */
323 addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); 320 addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn);
324 *handle = acpi_find_child(ACPI_HANDLE(dev->parent), addr, is_bridge); 321 return acpi_find_child_device(ACPI_COMPANION(dev->parent), addr,
325 if (!*handle) 322 check_children);
326 return -ENODEV;
327 return 0;
328} 323}
329 324
330static void pci_acpi_setup(struct device *dev) 325static void pci_acpi_setup(struct device *dev)
@@ -367,7 +362,7 @@ static bool pci_acpi_bus_match(struct device *dev)
367static struct acpi_bus_type acpi_pci_bus = { 362static struct acpi_bus_type acpi_pci_bus = {
368 .name = "PCI", 363 .name = "PCI",
369 .match = pci_acpi_bus_match, 364 .match = pci_acpi_bus_match,
370 .find_device = acpi_pci_find_device, 365 .find_companion = acpi_pci_find_companion,
371 .setup = pci_acpi_setup, 366 .setup = pci_acpi_setup,
372 .cleanup = pci_acpi_cleanup, 367 .cleanup = pci_acpi_cleanup,
373}; 368};
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
index 6f5d343d251c..45113daaa778 100644
--- a/drivers/pci/pci-label.c
+++ b/drivers/pci/pci-label.c
@@ -29,7 +29,6 @@
29#include <linux/nls.h> 29#include <linux/nls.h>
30#include <linux/acpi.h> 30#include <linux/acpi.h>
31#include <linux/pci-acpi.h> 31#include <linux/pci-acpi.h>
32#include <acpi/acpi_bus.h>
33#include "pci.h" 32#include "pci.h"
34 33
35#define DEVICE_LABEL_DSM 0x07 34#define DEVICE_LABEL_DSM 0x07
@@ -162,7 +161,6 @@ static const char device_label_dsm_uuid[] = {
162}; 161};
163 162
164enum acpi_attr_enum { 163enum acpi_attr_enum {
165 ACPI_ATTR_NONE = 0,
166 ACPI_ATTR_LABEL_SHOW, 164 ACPI_ATTR_LABEL_SHOW,
167 ACPI_ATTR_INDEX_SHOW, 165 ACPI_ATTR_INDEX_SHOW,
168}; 166};
@@ -170,84 +168,61 @@ enum acpi_attr_enum {
170static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf) 168static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf)
171{ 169{
172 int len; 170 int len;
173 len = utf16s_to_utf8s((const wchar_t *)obj-> 171 len = utf16s_to_utf8s((const wchar_t *)obj->string.pointer,
174 package.elements[1].string.pointer, 172 obj->string.length,
175 obj->package.elements[1].string.length,
176 UTF16_LITTLE_ENDIAN, 173 UTF16_LITTLE_ENDIAN,
177 buf, PAGE_SIZE); 174 buf, PAGE_SIZE);
178 buf[len] = '\n'; 175 buf[len] = '\n';
179} 176}
180 177
181static int 178static int
182dsm_get_label(acpi_handle handle, int func, 179dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr)
183 struct acpi_buffer *output,
184 char *buf, enum acpi_attr_enum attribute)
185{ 180{
186 struct acpi_object_list input; 181 acpi_handle handle;
187 union acpi_object params[4]; 182 union acpi_object *obj, *tmp;
188 union acpi_object *obj; 183 int len = -1;
189 int len = 0; 184
190 185 handle = ACPI_HANDLE(dev);
191 int err; 186 if (!handle)
192
193 input.count = 4;
194 input.pointer = params;
195 params[0].type = ACPI_TYPE_BUFFER;
196 params[0].buffer.length = sizeof(device_label_dsm_uuid);
197 params[0].buffer.pointer = (char *)device_label_dsm_uuid;
198 params[1].type = ACPI_TYPE_INTEGER;
199 params[1].integer.value = 0x02;
200 params[2].type = ACPI_TYPE_INTEGER;
201 params[2].integer.value = func;
202 params[3].type = ACPI_TYPE_PACKAGE;
203 params[3].package.count = 0;
204 params[3].package.elements = NULL;
205
206 err = acpi_evaluate_object(handle, "_DSM", &input, output);
207 if (err)
208 return -1; 187 return -1;
209 188
210 obj = (union acpi_object *)output->pointer; 189 obj = acpi_evaluate_dsm(handle, device_label_dsm_uuid, 0x2,
211 190 DEVICE_LABEL_DSM, NULL);
212 switch (obj->type) { 191 if (!obj)
213 case ACPI_TYPE_PACKAGE: 192 return -1;
214 if (obj->package.count != 2) 193
215 break; 194 tmp = obj->package.elements;
216 len = obj->package.elements[0].integer.value; 195 if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 2 &&
217 if (buf) { 196 tmp[0].type == ACPI_TYPE_INTEGER &&
218 if (attribute == ACPI_ATTR_INDEX_SHOW) 197 tmp[1].type == ACPI_TYPE_STRING) {
219 scnprintf(buf, PAGE_SIZE, "%llu\n", 198 /*
220 obj->package.elements[0].integer.value); 199 * The second string element is optional even when
221 else if (attribute == ACPI_ATTR_LABEL_SHOW) 200 * this _DSM is implemented; when not implemented,
222 dsm_label_utf16s_to_utf8s(obj, buf); 201 * this entry must return a null string.
223 kfree(output->pointer); 202 */
224 return strlen(buf); 203 if (attr == ACPI_ATTR_INDEX_SHOW)
225 } 204 scnprintf(buf, PAGE_SIZE, "%llu\n", tmp->integer.value);
226 kfree(output->pointer); 205 else if (attr == ACPI_ATTR_LABEL_SHOW)
227 return len; 206 dsm_label_utf16s_to_utf8s(tmp + 1, buf);
228 break; 207 len = strlen(buf) > 0 ? strlen(buf) : -1;
229 default:
230 kfree(output->pointer);
231 } 208 }
232 return -1; 209
210 ACPI_FREE(obj);
211
212 return len;
233} 213}
234 214
235static bool 215static bool
236device_has_dsm(struct device *dev) 216device_has_dsm(struct device *dev)
237{ 217{
238 acpi_handle handle; 218 acpi_handle handle;
239 struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
240 219
241 handle = ACPI_HANDLE(dev); 220 handle = ACPI_HANDLE(dev);
242
243 if (!handle) 221 if (!handle)
244 return FALSE; 222 return false;
245 223
246 if (dsm_get_label(handle, DEVICE_LABEL_DSM, &output, NULL, 224 return !!acpi_check_dsm(handle, device_label_dsm_uuid, 0x2,
247 ACPI_ATTR_NONE) > 0) 225 1 << DEVICE_LABEL_DSM);
248 return TRUE;
249
250 return FALSE;
251} 226}
252 227
253static umode_t 228static umode_t
@@ -266,44 +241,13 @@ acpi_index_string_exist(struct kobject *kobj, struct attribute *attr, int n)
266static ssize_t 241static ssize_t
267acpilabel_show(struct device *dev, struct device_attribute *attr, char *buf) 242acpilabel_show(struct device *dev, struct device_attribute *attr, char *buf)
268{ 243{
269 struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL}; 244 return dsm_get_label(dev, buf, ACPI_ATTR_LABEL_SHOW);
270 acpi_handle handle;
271 int length;
272
273 handle = ACPI_HANDLE(dev);
274
275 if (!handle)
276 return -1;
277
278 length = dsm_get_label(handle, DEVICE_LABEL_DSM,
279 &output, buf, ACPI_ATTR_LABEL_SHOW);
280
281 if (length < 1)
282 return -1;
283
284 return length;
285} 245}
286 246
287static ssize_t 247static ssize_t
288acpiindex_show(struct device *dev, struct device_attribute *attr, char *buf) 248acpiindex_show(struct device *dev, struct device_attribute *attr, char *buf)
289{ 249{
290 struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL}; 250 return dsm_get_label(dev, buf, ACPI_ATTR_INDEX_SHOW);
291 acpi_handle handle;
292 int length;
293
294 handle = ACPI_HANDLE(dev);
295
296 if (!handle)
297 return -1;
298
299 length = dsm_get_label(handle, DEVICE_LABEL_DSM,
300 &output, buf, ACPI_ATTR_INDEX_SHOW);
301
302 if (length < 0)
303 return -1;
304
305 return length;
306
307} 251}
308 252
309static struct device_attribute acpi_attr_label = { 253static struct device_attribute acpi_attr_label = {