|
18 | 18 | #include <linux/pm_qos.h>
|
19 | 19 | #include "pci.h"
|
20 | 20 |
|
21 |
| -/** |
22 |
| - * pci_acpi_wake_bus - Root bus wakeup notification fork function. |
23 |
| - * @work: Work item to handle. |
24 |
| - */ |
25 |
| -static void pci_acpi_wake_bus(struct work_struct *work) |
26 |
| -{ |
27 |
| - struct acpi_device *adev; |
28 |
| - struct acpi_pci_root *root; |
29 |
| - |
30 |
| - adev = container_of(work, struct acpi_device, wakeup.context.work); |
31 |
| - root = acpi_driver_data(adev); |
32 |
| - pci_pme_wakeup_bus(root->bus); |
33 |
| -} |
34 |
| - |
35 |
| -/** |
36 |
| - * pci_acpi_wake_dev - PCI device wakeup notification work function. |
37 |
| - * @handle: ACPI handle of a device the notification is for. |
38 |
| - * @work: Work item to handle. |
39 |
| - */ |
40 |
| -static void pci_acpi_wake_dev(struct work_struct *work) |
41 |
| -{ |
42 |
| - struct acpi_device_wakeup_context *context; |
43 |
| - struct pci_dev *pci_dev; |
44 |
| - |
45 |
| - context = container_of(work, struct acpi_device_wakeup_context, work); |
46 |
| - pci_dev = to_pci_dev(context->dev); |
47 |
| - |
48 |
| - if (pci_dev->pme_poll) |
49 |
| - pci_dev->pme_poll = false; |
50 |
| - |
51 |
| - if (pci_dev->current_state == PCI_D3cold) { |
52 |
| - pci_wakeup_event(pci_dev); |
53 |
| - pm_runtime_resume(&pci_dev->dev); |
54 |
| - return; |
55 |
| - } |
56 |
| - |
57 |
| - /* Clear PME Status if set. */ |
58 |
| - if (pci_dev->pme_support) |
59 |
| - pci_check_pme_status(pci_dev); |
60 |
| - |
61 |
| - pci_wakeup_event(pci_dev); |
62 |
| - pm_runtime_resume(&pci_dev->dev); |
63 |
| - |
64 |
| - if (pci_dev->subordinate) |
65 |
| - pci_pme_wakeup_bus(pci_dev->subordinate); |
66 |
| -} |
67 |
| - |
68 |
| -/** |
69 |
| - * pci_acpi_add_bus_pm_notifier - Register PM notifier for root PCI bus. |
70 |
| - * @dev: PCI root bridge ACPI device. |
71 |
| - */ |
72 |
| -acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev) |
73 |
| -{ |
74 |
| - return acpi_add_pm_notifier(dev, NULL, pci_acpi_wake_bus); |
75 |
| -} |
76 |
| - |
77 |
| -/** |
78 |
| - * pci_acpi_add_pm_notifier - Register PM notifier for given PCI device. |
79 |
| - * @dev: ACPI device to add the notifier for. |
80 |
| - * @pci_dev: PCI device to check for the PME status if an event is signaled. |
81 |
| - */ |
82 |
| -acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev, |
83 |
| - struct pci_dev *pci_dev) |
84 |
| -{ |
85 |
| - return acpi_add_pm_notifier(dev, &pci_dev->dev, pci_acpi_wake_dev); |
86 |
| -} |
87 |
| - |
88 | 21 | phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle)
|
89 | 22 | {
|
90 | 23 | acpi_status status = AE_NOT_EXIST;
|
@@ -346,6 +279,73 @@ int pci_get_hp_params(struct pci_dev *dev, struct hotplug_params *hpp)
|
346 | 279 | }
|
347 | 280 | EXPORT_SYMBOL_GPL(pci_get_hp_params);
|
348 | 281 |
|
| 282 | +/** |
| 283 | + * pci_acpi_wake_bus - Root bus wakeup notification fork function. |
| 284 | + * @work: Work item to handle. |
| 285 | + */ |
| 286 | +static void pci_acpi_wake_bus(struct work_struct *work) |
| 287 | +{ |
| 288 | + struct acpi_device *adev; |
| 289 | + struct acpi_pci_root *root; |
| 290 | + |
| 291 | + adev = container_of(work, struct acpi_device, wakeup.context.work); |
| 292 | + root = acpi_driver_data(adev); |
| 293 | + pci_pme_wakeup_bus(root->bus); |
| 294 | +} |
| 295 | + |
| 296 | +/** |
| 297 | + * pci_acpi_wake_dev - PCI device wakeup notification work function. |
| 298 | + * @handle: ACPI handle of a device the notification is for. |
| 299 | + * @work: Work item to handle. |
| 300 | + */ |
| 301 | +static void pci_acpi_wake_dev(struct work_struct *work) |
| 302 | +{ |
| 303 | + struct acpi_device_wakeup_context *context; |
| 304 | + struct pci_dev *pci_dev; |
| 305 | + |
| 306 | + context = container_of(work, struct acpi_device_wakeup_context, work); |
| 307 | + pci_dev = to_pci_dev(context->dev); |
| 308 | + |
| 309 | + if (pci_dev->pme_poll) |
| 310 | + pci_dev->pme_poll = false; |
| 311 | + |
| 312 | + if (pci_dev->current_state == PCI_D3cold) { |
| 313 | + pci_wakeup_event(pci_dev); |
| 314 | + pm_runtime_resume(&pci_dev->dev); |
| 315 | + return; |
| 316 | + } |
| 317 | + |
| 318 | + /* Clear PME Status if set. */ |
| 319 | + if (pci_dev->pme_support) |
| 320 | + pci_check_pme_status(pci_dev); |
| 321 | + |
| 322 | + pci_wakeup_event(pci_dev); |
| 323 | + pm_runtime_resume(&pci_dev->dev); |
| 324 | + |
| 325 | + if (pci_dev->subordinate) |
| 326 | + pci_pme_wakeup_bus(pci_dev->subordinate); |
| 327 | +} |
| 328 | + |
| 329 | +/** |
| 330 | + * pci_acpi_add_bus_pm_notifier - Register PM notifier for root PCI bus. |
| 331 | + * @dev: PCI root bridge ACPI device. |
| 332 | + */ |
| 333 | +acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev) |
| 334 | +{ |
| 335 | + return acpi_add_pm_notifier(dev, NULL, pci_acpi_wake_bus); |
| 336 | +} |
| 337 | + |
| 338 | +/** |
| 339 | + * pci_acpi_add_pm_notifier - Register PM notifier for given PCI device. |
| 340 | + * @dev: ACPI device to add the notifier for. |
| 341 | + * @pci_dev: PCI device to check for the PME status if an event is signaled. |
| 342 | + */ |
| 343 | +acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev, |
| 344 | + struct pci_dev *pci_dev) |
| 345 | +{ |
| 346 | + return acpi_add_pm_notifier(dev, &pci_dev->dev, pci_acpi_wake_dev); |
| 347 | +} |
| 348 | + |
349 | 349 | /*
|
350 | 350 | * _SxD returns the D-state with the highest power
|
351 | 351 | * (lowest D-state number) supported in the S-state "x".
|
|
0 commit comments