aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pcie
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-01-06 18:55:09 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2011-01-14 11:55:41 -0500
commit415e12b2379239973feab91850b0dce985c6058a (patch)
treeaa79c7a87fd30ac13ae3fd146aad5a44e854c4bc /drivers/pci/pcie
parent6e8af08dfa40b747002207d3ce8e8b43a050d99f (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/pci/pcie')
-rw-r--r--drivers/pci/pcie/aer/aerdrv.c1
-rw-r--r--drivers/pci/pcie/aer/aerdrv.h3
-rw-r--r--drivers/pci/pcie/portdrv.h3
-rw-r--r--drivers/pci/pcie/portdrv_acpi.c23
4 files changed, 5 insertions, 25 deletions
diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c
index 2b2b6508efde..58ad7917553c 100644
--- a/drivers/pci/pcie/aer/aerdrv.c
+++ b/drivers/pci/pcie/aer/aerdrv.c
@@ -17,6 +17,7 @@
17 17
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/pci.h> 19#include <linux/pci.h>
20#include <linux/pci-acpi.h>
20#include <linux/sched.h> 21#include <linux/sched.h>
21#include <linux/kernel.h> 22#include <linux/kernel.h>
22#include <linux/errno.h> 23#include <linux/errno.h>
diff --git a/drivers/pci/pcie/aer/aerdrv.h b/drivers/pci/pcie/aer/aerdrv.h
index 9656e3060412..80c11d131499 100644
--- a/drivers/pci/pcie/aer/aerdrv.h
+++ b/drivers/pci/pcie/aer/aerdrv.h
@@ -132,7 +132,6 @@ static inline int aer_osc_setup(struct pcie_device *pciedev)
132 132
133#ifdef CONFIG_ACPI_APEI 133#ifdef CONFIG_ACPI_APEI
134extern int pcie_aer_get_firmware_first(struct pci_dev *pci_dev); 134extern int pcie_aer_get_firmware_first(struct pci_dev *pci_dev);
135extern bool aer_acpi_firmware_first(void);
136#else 135#else
137static inline int pcie_aer_get_firmware_first(struct pci_dev *pci_dev) 136static inline int pcie_aer_get_firmware_first(struct pci_dev *pci_dev)
138{ 137{
@@ -140,8 +139,6 @@ static inline int pcie_aer_get_firmware_first(struct pci_dev *pci_dev)
140 return pci_dev->__aer_firmware_first; 139 return pci_dev->__aer_firmware_first;
141 return 0; 140 return 0;
142} 141}
143
144static inline bool aer_acpi_firmware_first(void) { return false; }
145#endif 142#endif
146 143
147static inline void pcie_aer_force_firmware_first(struct pci_dev *pci_dev, 144static inline void pcie_aer_force_firmware_first(struct pci_dev *pci_dev,
diff --git a/drivers/pci/pcie/portdrv.h b/drivers/pci/pcie/portdrv.h
index 8fcc03598b29..bd00a01aef14 100644
--- a/drivers/pci/pcie/portdrv.h
+++ b/drivers/pci/pcie/portdrv.h
@@ -20,9 +20,6 @@
20 20
21#define get_descriptor_id(type, service) (((type - 4) << 4) | service) 21#define get_descriptor_id(type, service) (((type - 4) << 4) | service)
22 22
23extern bool pcie_ports_disabled;
24extern bool pcie_ports_auto;
25
26extern struct bus_type pcie_port_bus_type; 23extern struct bus_type pcie_port_bus_type;
27extern int pcie_port_device_register(struct pci_dev *dev); 24extern int pcie_port_device_register(struct pci_dev *dev);
28#ifdef CONFIG_PM 25#ifdef CONFIG_PM
diff --git a/drivers/pci/pcie/portdrv_acpi.c b/drivers/pci/pcie/portdrv_acpi.c
index 5982b6a63b89..a86b56e5f2f2 100644
--- a/drivers/pci/pcie/portdrv_acpi.c
+++ b/drivers/pci/pcie/portdrv_acpi.c
@@ -33,7 +33,7 @@
33 */ 33 */
34int pcie_port_acpi_setup(struct pci_dev *port, int *srv_mask) 34int pcie_port_acpi_setup(struct pci_dev *port, int *srv_mask)
35{ 35{
36 acpi_status status; 36 struct acpi_pci_root *root;
37 acpi_handle handle; 37 acpi_handle handle;
38 u32 flags; 38 u32 flags;
39 39
@@ -44,26 +44,11 @@ int pcie_port_acpi_setup(struct pci_dev *port, int *srv_mask)
44 if (!handle) 44 if (!handle)
45 return -EINVAL; 45 return -EINVAL;
46 46
47 flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 47 root = acpi_pci_find_root(handle);
48 | OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 48 if (!root)
49 | OSC_PCI_EXPRESS_PME_CONTROL;
50
51 if (pci_aer_available()) {
52 if (aer_acpi_firmware_first())
53 dev_dbg(&port->dev, "PCIe errors handled by BIOS.\n");
54 else
55 flags |= OSC_PCI_EXPRESS_AER_CONTROL;
56 }
57
58 status = acpi_pci_osc_control_set(handle, &flags,
59 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
60 if (ACPI_FAILURE(status)) {
61 dev_dbg(&port->dev, "ACPI _OSC request failed (code %d)\n",
62 status);
63 return -ENODEV; 49 return -ENODEV;
64 }
65 50
66 dev_info(&port->dev, "ACPI _OSC control granted for 0x%02x\n", flags); 51 flags = root->osc_control_set;
67 52
68 *srv_mask = PCIE_PORT_SERVICE_VC; 53 *srv_mask = PCIE_PORT_SERVICE_VC;
69 if (flags & OSC_PCI_EXPRESS_NATIVE_HP_CONTROL) 54 if (flags & OSC_PCI_EXPRESS_NATIVE_HP_CONTROL)