diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2010-08-23 17:53:11 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2010-08-24 16:44:40 -0400 |
commit | 75fb60f26befb59dbfa05cb122972642b7bdd219 (patch) | |
tree | be015dd00e7748e45f3691f04a16c204546b3026 /drivers/pci/pcie | |
parent | 2b8fd9186d9275b07aef43e5bb4e98cd571f9a7d (diff) |
ACPI/PCI: Negotiate _OSC control bits before requesting them
It is possible that the BIOS will not grant control of all _OSC
features requested via acpi_pci_osc_control_set(), so it is
recommended to negotiate the final set of _OSC features with the
query flag set before calling _OSC to request control of these
features.
To implement it, rework acpi_pci_osc_control_set() so that the caller
can specify the mask of _OSC control bits to negotiate and the mask
of _OSC control bits that are absolutely necessary to it. Then,
acpi_pci_osc_control_set() will run _OSC queries in a loop until
the mask of _OSC control bits returned by the BIOS is equal to the
mask passed to it. Also, before running the _OSC request
acpi_pci_osc_control_set() will check if the caller's required
control bits are present in the final mask.
Using this mechanism we will be able to avoid situations in which the
BIOS doesn't grant control of certain _OSC features, because they
depend on some other _OSC features that have not been requested.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/pcie')
-rw-r--r-- | drivers/pci/pcie/aer/aerdrv_acpi.c | 6 | ||||
-rw-r--r-- | drivers/pci/pcie/pme/pcie_pme_acpi.c | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/drivers/pci/pcie/aer/aerdrv_acpi.c b/drivers/pci/pcie/aer/aerdrv_acpi.c index f278d7b0d95d..3a276a0cea93 100644 --- a/drivers/pci/pcie/aer/aerdrv_acpi.c +++ b/drivers/pci/pcie/aer/aerdrv_acpi.c | |||
@@ -39,9 +39,9 @@ int aer_osc_setup(struct pcie_device *pciedev) | |||
39 | 39 | ||
40 | handle = acpi_find_root_bridge_handle(pdev); | 40 | handle = acpi_find_root_bridge_handle(pdev); |
41 | if (handle) { | 41 | if (handle) { |
42 | status = acpi_pci_osc_control_set(handle, | 42 | u32 flags = OSC_PCI_EXPRESS_AER_CONTROL | |
43 | OSC_PCI_EXPRESS_AER_CONTROL | | 43 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL; |
44 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); | 44 | status = acpi_pci_osc_control_set(handle, &flags, flags); |
45 | } | 45 | } |
46 | 46 | ||
47 | if (ACPI_FAILURE(status)) { | 47 | if (ACPI_FAILURE(status)) { |
diff --git a/drivers/pci/pcie/pme/pcie_pme_acpi.c b/drivers/pci/pcie/pme/pcie_pme_acpi.c index 83ab2287ae3f..be20222b12d3 100644 --- a/drivers/pci/pcie/pme/pcie_pme_acpi.c +++ b/drivers/pci/pcie/pme/pcie_pme_acpi.c | |||
@@ -28,6 +28,7 @@ int pcie_pme_acpi_setup(struct pcie_device *srv) | |||
28 | acpi_status status = AE_NOT_FOUND; | 28 | acpi_status status = AE_NOT_FOUND; |
29 | struct pci_dev *port = srv->port; | 29 | struct pci_dev *port = srv->port; |
30 | acpi_handle handle; | 30 | acpi_handle handle; |
31 | u32 flags; | ||
31 | int error = 0; | 32 | int error = 0; |
32 | 33 | ||
33 | if (acpi_pci_disabled) | 34 | if (acpi_pci_disabled) |
@@ -39,9 +40,10 @@ int pcie_pme_acpi_setup(struct pcie_device *srv) | |||
39 | if (!handle) | 40 | if (!handle) |
40 | return -EINVAL; | 41 | return -EINVAL; |
41 | 42 | ||
42 | status = acpi_pci_osc_control_set(handle, | 43 | flags = OSC_PCI_EXPRESS_PME_CONTROL | |
43 | OSC_PCI_EXPRESS_PME_CONTROL | | 44 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL; |
44 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); | 45 | |
46 | status = acpi_pci_osc_control_set(handle, &flags, flags); | ||
45 | if (ACPI_FAILURE(status)) { | 47 | if (ACPI_FAILURE(status)) { |
46 | dev_info(&port->dev, | 48 | dev_info(&port->dev, |
47 | "Failed to receive control of PCIe PME service: %s\n", | 49 | "Failed to receive control of PCIe PME service: %s\n", |