diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-01-17 08:10:27 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-01-17 08:10:27 -0500 |
commit | 6a8dd80821c215bc49bf6b108e85c1738c82bf43 (patch) | |
tree | 3c8a42ca07fd69f9e11e0093e9eb041cad82c1c6 /drivers/pci/pci-acpi.c | |
parent | 9931faca02c604c22335f5a935a501bb2ace6e20 (diff) | |
parent | 5993c4670ea2453ef5abb45b312f150e994e6eb9 (diff) |
Merge branch 'acpi-scan' into acpi-pm
The following commits depend on the 'acpi-scan' material.
Diffstat (limited to 'drivers/pci/pci-acpi.c')
-rw-r--r-- | drivers/pci/pci-acpi.c | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 1af4008182fd..42736e213f25 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -283,7 +283,6 @@ static struct pci_platform_pm_ops acpi_pci_platform_pm = { | |||
283 | .is_manageable = acpi_pci_power_manageable, | 283 | .is_manageable = acpi_pci_power_manageable, |
284 | .set_state = acpi_pci_set_power_state, | 284 | .set_state = acpi_pci_set_power_state, |
285 | .choose_state = acpi_pci_choose_state, | 285 | .choose_state = acpi_pci_choose_state, |
286 | .can_wakeup = acpi_pci_can_wakeup, | ||
287 | .sleep_wake = acpi_pci_sleep_wake, | 286 | .sleep_wake = acpi_pci_sleep_wake, |
288 | .run_wake = acpi_pci_run_wake, | 287 | .run_wake = acpi_pci_run_wake, |
289 | }; | 288 | }; |
@@ -321,10 +320,67 @@ static int acpi_pci_find_root_bridge(struct device *dev, acpi_handle *handle) | |||
321 | return 0; | 320 | return 0; |
322 | } | 321 | } |
323 | 322 | ||
323 | static void pci_acpi_setup(struct device *dev) | ||
324 | { | ||
325 | struct pci_dev *pci_dev = to_pci_dev(dev); | ||
326 | acpi_handle handle = ACPI_HANDLE(dev); | ||
327 | struct acpi_device *adev; | ||
328 | acpi_status status; | ||
329 | acpi_handle dummy; | ||
330 | |||
331 | /* | ||
332 | * Evaluate and parse _PRT, if exists. This code allows parsing of | ||
333 | * _PRT objects within the scope of non-bridge devices. Note that | ||
334 | * _PRTs within the scope of a PCI bridge assume the bridge's | ||
335 | * subordinate bus number. | ||
336 | * | ||
337 | * TBD: Can _PRTs exist within the scope of non-bridge PCI devices? | ||
338 | */ | ||
339 | status = acpi_get_handle(handle, METHOD_NAME__PRT, &dummy); | ||
340 | if (ACPI_SUCCESS(status)) { | ||
341 | unsigned char bus; | ||
342 | |||
343 | bus = pci_dev->subordinate ? | ||
344 | pci_dev->subordinate->number : pci_dev->bus->number; | ||
345 | acpi_pci_irq_add_prt(handle, pci_domain_nr(pci_dev->bus), bus); | ||
346 | } | ||
347 | |||
348 | acpi_power_resource_register_device(dev, handle); | ||
349 | if (acpi_bus_get_device(handle, &adev) || !adev->wakeup.flags.valid) | ||
350 | return; | ||
351 | |||
352 | device_set_wakeup_capable(dev, true); | ||
353 | acpi_pci_sleep_wake(pci_dev, false); | ||
354 | |||
355 | pci_acpi_add_pm_notifier(adev, pci_dev); | ||
356 | if (adev->wakeup.flags.run_wake) | ||
357 | device_set_run_wake(dev, true); | ||
358 | } | ||
359 | |||
360 | static void pci_acpi_cleanup(struct device *dev) | ||
361 | { | ||
362 | struct pci_dev *pci_dev = to_pci_dev(dev); | ||
363 | acpi_handle handle = ACPI_HANDLE(dev); | ||
364 | struct acpi_device *adev; | ||
365 | |||
366 | if (!acpi_bus_get_device(handle, &adev) && adev->wakeup.flags.valid) { | ||
367 | device_set_wakeup_capable(dev, false); | ||
368 | device_set_run_wake(dev, false); | ||
369 | pci_acpi_remove_pm_notifier(adev); | ||
370 | } | ||
371 | acpi_power_resource_unregister_device(dev, handle); | ||
372 | |||
373 | if (pci_dev->subordinate) | ||
374 | acpi_pci_irq_del_prt(pci_domain_nr(pci_dev->bus), | ||
375 | pci_dev->subordinate->number); | ||
376 | } | ||
377 | |||
324 | static struct acpi_bus_type acpi_pci_bus = { | 378 | static struct acpi_bus_type acpi_pci_bus = { |
325 | .bus = &pci_bus_type, | 379 | .bus = &pci_bus_type, |
326 | .find_device = acpi_pci_find_device, | 380 | .find_device = acpi_pci_find_device, |
327 | .find_bridge = acpi_pci_find_root_bridge, | 381 | .find_bridge = acpi_pci_find_root_bridge, |
382 | .setup = pci_acpi_setup, | ||
383 | .cleanup = pci_acpi_cleanup, | ||
328 | }; | 384 | }; |
329 | 385 | ||
330 | static int __init acpi_pci_init(void) | 386 | static int __init acpi_pci_init(void) |