From: Rafael J. Wysocki <rjw@sisk.pl>
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.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
drivers/acpi/pci_root.c | 31 +++++++++++++++++++++++++++++++
drivers/pci/pci.h | 8 --------
drivers/pci/pcie/aer/aerdrv.c | 1 +
drivers/pci/pcie/aer/aerdrv.h | 3 ---
drivers/pci/pcie/portdrv_acpi.c | 23 ++++-------------------
include/linux/pci-acpi.h | 6 ++++++
include/linux/pci.h | 8 ++++++++
7 files changed, 50 insertions(+), 30 deletions(-)
Index: linux-2.6/drivers/acpi/pci_root.c
===================================================================
--- linux-2.6.orig/drivers/acpi/pci_root.c
+++ linux-2.6/drivers/acpi/pci_root.c
@@ -47,6 +47,11 @@ static int acpi_pci_root_add(struct acpi
static int acpi_pci_root_remove(struct acpi_device *device, int type);
static int acpi_pci_root_start(struct acpi_device *device);
+#define ACPI_PCIE_REQ_SUPPORT (OSC_EXT_PCI_CONFIG_SUPPORT \
+ | OSC_ACTIVE_STATE_PWR_SUPPORT \
+ | OSC_CLOCK_PWR_CAPABILITY_SUPPORT \
+ | OSC_MSI_SUPPORT)
+
static const struct acpi_device_id root_device_ids[] = {
{"PNP0A03", 0},
{"", 0},
@@ -566,6 +571,32 @@ static int __devinit acpi_pci_root_add(s
if (flags != base_flags)
acpi_pci_osc_support(root, flags);
+ if ((flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) {
+ flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL
+ | OSC_PCI_EXPRESS_NATIVE_HP_CONTROL
+ | OSC_PCI_EXPRESS_PME_CONTROL;
+
+ if (pci_aer_available()) {
+ if (aer_acpi_firmware_first())
+ dev_dbg(root->bus->bridge,
+ "PCIe errors handled by BIOS.\n");
+ else
+ flags |= ...From: Rafael J. Wysocki <rjw@sisk.pl>
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.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
Hi,
The previous version wouldn't work correctly with pcie_ports=compat.
Thanks,
Rafael
---
drivers/acpi/pci_root.c | 32 ++++++++++++++++++++++++++++++++
drivers/pci/pci.h | 8 --------
drivers/pci/pcie/aer/aerdrv.c | 1 +
drivers/pci/pcie/aer/aerdrv.h | 3 ---
drivers/pci/pcie/portdrv.h | 3 ---
drivers/pci/pcie/portdrv_acpi.c | 23 ++++-------------------
include/linux/pci-acpi.h | 6 ++++++
include/linux/pci.h | 11 +++++++++++
8 files changed, 54 insertions(+), 33 deletions(-)
Index: linux-2.6/drivers/acpi/pci_root.c
===================================================================
--- linux-2.6.orig/drivers/acpi/pci_root.c
+++ linux-2.6/drivers/acpi/pci_root.c
@@ -47,6 +47,11 @@ static int acpi_pci_root_add(struct acpi
static int acpi_pci_root_remove(struct acpi_device *device, int type);
static int acpi_pci_root_start(struct acpi_device *device);
+#define ACPI_PCIE_REQ_SUPPORT (OSC_EXT_PCI_CONFIG_SUPPORT \
+ | OSC_ACTIVE_STATE_PWR_SUPPORT \
+ | OSC_CLOCK_PWR_CAPABILITY_SUPPORT \
+ | OSC_MSI_SUPPORT)
+
static const struct acpi_device_id root_device_ids[] = {
{"PNP0A03", 0},
{"", 0},
@@ -566,6 +571,33 @@ static int __devinit acpi_pci_root_add(s
if (flags != base_flags)
acpi_pci_osc_support(root, flags);
+ if (!pcie_ports_disabled
+ && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) {
+ flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL
+ | OSC_PCI_EXPRESS_NATIVE_HP_CONTROL
+ | ...From: Rafael J. Wysocki <rjw@sisk.pl> 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. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> --- Hi, The previous versions were buggy, because they assumed that hest_init() would be called before acpi_pci_root_init(), but that need not be the case. This version fixes the problem (hopefully, it's the last update of this patch). Thanks, Rafael --- drivers/acpi/apei/hest.c | 22 +++++++++------------- drivers/acpi/pci_root.c | 35 +++++++++++++++++++++++++++++++++++ drivers/pci/pci.h | 8 -------- drivers/pci/pcie/aer/aerdrv.c | 1 + drivers/pci/pcie/aer/aerdrv.h | 3 --- drivers/pci/pcie/portdrv.h | 3 --- drivers/pci/pcie/portdrv_acpi.c | 23 ++++------------------- include/acpi/apei.h | 6 ++++++ include/linux/pci-acpi.h | 6 ++++++ include/linux/pci.h | 11 +++++++++++ 10 files changed, 72 insertions(+), 46 deletions(-) Index: linux-2.6/drivers/acpi/pci_root.c =================================================================== --- linux-2.6.orig/drivers/acpi/pci_root.c +++ linux-2.6/drivers/acpi/pci_root.c @@ -36,6 +36,7 @@ #include <linux/slab.h> #include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> +#include <acpi/apei.h> #define PREFIX "ACPI: " @@ -47,6 +48,11 @@ static int acpi_pci_root_add(struct acpi static int acpi_pci_root_remove(struct acpi_device *device, int type); static int acpi_pci_root_start(struct acpi_device *device); +#define ACPI_PCIE_REQ_SUPPORT (OSC_EXT_PCI_CONFIG_SUPPORT \ + | OSC_ACTIVE_STATE_PWR_SUPPORT \ + | OSC_CLOCK_PWR_CAPABILITY_SUPPORT \ + | OSC_MSI_SUPPORT) + ...
