@@ -130,8 +130,10 @@ static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { }
#ifdef CONFIG_PCIEAER
void pci_no_aer(void);
+bool pci_aer_available(void);
#else
static inline void pci_no_aer(void) { }
+static inline bool pci_aer_available(void) { return false; }
#endif
static inline int pci_no_d1d2(struct pci_dev *dev)
@@ -67,6 +67,11 @@ static struct pcie_port_service_driver aerdriver = {
static int pcie_aer_disable;
+bool pci_aer_available(void)
+{
+ return !pcie_aer_disable && pci_msi_enabled();
+}
+
void pci_no_aer(void)
{
pcie_aer_disable = 1; /* has priority over 'forceload' */
@@ -411,9 +416,7 @@ static void aer_error_resume(struct pci_dev *dev)
*/
static int __init aer_service_init(void)
{
- if (pcie_aer_disable)
- return -ENXIO;
- if (!pci_msi_enabled())
+ if (!pci_aer_available())
return -ENXIO;
return pcie_port_service_register(&aerdriver);
}
@@ -16,6 +16,7 @@
#include <linux/pcieport_if.h>
#include "aer/aerdrv.h"
+#include "../pci.h"
/**
* pcie_port_acpi_setup - Request the BIOS to release control of PCIe services.
@@ -48,7 +49,9 @@ int pcie_port_acpi_setup(struct pci_dev *port, int *srv_mask)
OSC_PCI_EXPRESS_PME_CONTROL |
OSC_PCI_EXPRESS_AER_CONTROL);
- if (pcie_aer_get_firmware_first(port)) {
+ if (!pci_aer_available()) {
+ request &= ~OSC_PCI_EXPRESS_AER_CONTROL;
+ } else if (pcie_aer_get_firmware_first(port)) {
dev_dbg(&port->dev, "PCIe errors handled by BIOS.\n");
request &= ~OSC_PCI_EXPRESS_AER_CONTROL;
}
@@ -246,6 +246,8 @@ static int get_port_device_capability(struct pci_dev *dev)
return 0;
} else {
cap_mask = PCIE_PORT_SERVICE_MASK;
+ if (!pci_aer_available())
+ cap_mask &= ~PCIE_PORT_SERVICE_AER;
}
pos = pci_pcie_cap(dev);