diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2011-01-06 18:55:09 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2011-01-14 11:55:41 -0500 |
commit | 415e12b2379239973feab91850b0dce985c6058a (patch) | |
tree | aa79c7a87fd30ac13ae3fd146aad5a44e854c4bc /drivers/acpi/pci_root.c | |
parent | 6e8af08dfa40b747002207d3ce8e8b43a050d99f (diff) |
PCI/ACPI: Request _OSC control once for each root bridge (v3)
Move the evaluation of acpi_pci_osc_control_set() (to request control of
PCI Express native features) into acpi_pci_root_add() to avoid calling
it many times for the same root complex with the same arguments.
Additionally, check if all of the requisite _OSC support bits are set
before calling acpi_pci_osc_control_set() for a given root complex.
References: https://bugzilla.kernel.org/show_bug.cgi?id=20232
Reported-by: Ozan Caglayan <ozan@pardus.org.tr>
Tested-by: Ozan Caglayan <ozan@pardus.org.tr>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/acpi/pci_root.c')
-rw-r--r-- | drivers/acpi/pci_root.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 96668ad09622..d9766797cd98 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
37 | #include <acpi/acpi_bus.h> | 37 | #include <acpi/acpi_bus.h> |
38 | #include <acpi/acpi_drivers.h> | 38 | #include <acpi/acpi_drivers.h> |
39 | #include <acpi/apei.h> | ||
39 | 40 | ||
40 | #define PREFIX "ACPI: " | 41 | #define PREFIX "ACPI: " |
41 | 42 | ||
@@ -47,6 +48,11 @@ static int acpi_pci_root_add(struct acpi_device *device); | |||
47 | static int acpi_pci_root_remove(struct acpi_device *device, int type); | 48 | static int acpi_pci_root_remove(struct acpi_device *device, int type); |
48 | static int acpi_pci_root_start(struct acpi_device *device); | 49 | static int acpi_pci_root_start(struct acpi_device *device); |
49 | 50 | ||
51 | #define ACPI_PCIE_REQ_SUPPORT (OSC_EXT_PCI_CONFIG_SUPPORT \ | ||
52 | | OSC_ACTIVE_STATE_PWR_SUPPORT \ | ||
53 | | OSC_CLOCK_PWR_CAPABILITY_SUPPORT \ | ||
54 | | OSC_MSI_SUPPORT) | ||
55 | |||
50 | static const struct acpi_device_id root_device_ids[] = { | 56 | static const struct acpi_device_id root_device_ids[] = { |
51 | {"PNP0A03", 0}, | 57 | {"PNP0A03", 0}, |
52 | {"", 0}, | 58 | {"", 0}, |
@@ -566,6 +572,33 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device) | |||
566 | if (flags != base_flags) | 572 | if (flags != base_flags) |
567 | acpi_pci_osc_support(root, flags); | 573 | acpi_pci_osc_support(root, flags); |
568 | 574 | ||
575 | if (!pcie_ports_disabled | ||
576 | && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) { | ||
577 | flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL | ||
578 | | OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | ||
579 | | OSC_PCI_EXPRESS_PME_CONTROL; | ||
580 | |||
581 | if (pci_aer_available()) { | ||
582 | if (aer_acpi_firmware_first()) | ||
583 | dev_dbg(root->bus->bridge, | ||
584 | "PCIe errors handled by BIOS.\n"); | ||
585 | else | ||
586 | flags |= OSC_PCI_EXPRESS_AER_CONTROL; | ||
587 | } | ||
588 | |||
589 | dev_info(root->bus->bridge, | ||
590 | "Requesting ACPI _OSC control (0x%02x)\n", flags); | ||
591 | |||
592 | status = acpi_pci_osc_control_set(device->handle, &flags, | ||
593 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); | ||
594 | if (ACPI_SUCCESS(status)) | ||
595 | dev_info(root->bus->bridge, | ||
596 | "ACPI _OSC control (0x%02x) granted\n", flags); | ||
597 | else | ||
598 | dev_dbg(root->bus->bridge, | ||
599 | "ACPI _OSC request failed (code %d)\n", status); | ||
600 | } | ||
601 | |||
569 | pci_acpi_add_bus_pm_notifier(device, root->bus); | 602 | pci_acpi_add_bus_pm_notifier(device, root->bus); |
570 | if (device->wakeup.flags.run_wake) | 603 | if (device->wakeup.flags.run_wake) |
571 | device_set_run_wake(root->bus->bridge, true); | 604 | device_set_run_wake(root->bus->bridge, true); |
@@ -603,6 +636,8 @@ static int __init acpi_pci_root_init(void) | |||
603 | if (acpi_pci_disabled) | 636 | if (acpi_pci_disabled) |
604 | return 0; | 637 | return 0; |
605 | 638 | ||
639 | acpi_hest_init(); | ||
640 | |||
606 | pci_acpi_crs_quirks(); | 641 | pci_acpi_crs_quirks(); |
607 | if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0) | 642 | if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0) |
608 | return -ENODEV; | 643 | return -ENODEV; |