PCI: disable ASPM per ACPI FADT setting

The ACPI FADT table includes an ASPM control bit. If the bit is set, do
not enable ASPM since it may indicate that the platform doesn't actually
support the feature.

Tested-by: Jack Howarth <howarth@bromo.msbb.uc.edu>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>

authored by Shaohua Li and committed by Jesse Barnes 5fde244d ce6fce42

+18
+7
drivers/pci/pci-acpi.c
··· 11 #include <linux/init.h> 12 #include <linux/pci.h> 13 #include <linux/module.h> 14 #include <acpi/acpi.h> 15 #include <acpi/acnamesp.h> 16 #include <acpi/acresrc.h> ··· 373 printk(KERN_INFO"ACPI FADT declares the system doesn't support MSI, so disable it\n"); 374 pci_no_msi(); 375 } 376 ret = register_acpi_bus_type(&acpi_pci_bus); 377 if (ret) 378 return 0;
··· 11 #include <linux/init.h> 12 #include <linux/pci.h> 13 #include <linux/module.h> 14 + #include <linux/pci-aspm.h> 15 #include <acpi/acpi.h> 16 #include <acpi/acnamesp.h> 17 #include <acpi/acresrc.h> ··· 372 printk(KERN_INFO"ACPI FADT declares the system doesn't support MSI, so disable it\n"); 373 pci_no_msi(); 374 } 375 + 376 + if (acpi_gbl_FADT.boot_flags & BAF_PCIE_ASPM_CONTROL) { 377 + printk(KERN_INFO"ACPI FADT declares the system doesn't support PCIe ASPM, so disable it\n"); 378 + pcie_no_aspm(); 379 + } 380 + 381 ret = register_acpi_bus_type(&acpi_pci_bus); 382 if (ret) 383 return 0;
+5
drivers/pci/pcie/aspm.c
··· 808 809 __setup("pcie_noaspm", pcie_aspm_disable); 810 811 #ifdef CONFIG_ACPI 812 #include <acpi/acpi_bus.h> 813 #include <linux/pci-acpi.h>
··· 808 809 __setup("pcie_noaspm", pcie_aspm_disable); 810 811 + void pcie_no_aspm(void) 812 + { 813 + aspm_disabled = 1; 814 + } 815 + 816 #ifdef CONFIG_ACPI 817 #include <acpi/acpi_bus.h> 818 #include <linux/pci-acpi.h>
+1
include/acpi/actbl.h
··· 277 #define BAF_LEGACY_DEVICES 0x0001 278 #define BAF_8042_KEYBOARD_CONTROLLER 0x0002 279 #define BAF_MSI_NOT_SUPPORTED 0x0008 280 281 #define FADT2_REVISION_ID 3 282 #define FADT2_MINUS_REVISION_ID 2
··· 277 #define BAF_LEGACY_DEVICES 0x0001 278 #define BAF_8042_KEYBOARD_CONTROLLER 0x0002 279 #define BAF_MSI_NOT_SUPPORTED 0x0008 280 + #define BAF_PCIE_ASPM_CONTROL 0x0010 281 282 #define FADT2_REVISION_ID 3 283 #define FADT2_MINUS_REVISION_ID 2
+5
include/linux/pci-aspm.h
··· 27 extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); 28 extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); 29 extern void pci_disable_link_state(struct pci_dev *pdev, int state); 30 #else 31 static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) 32 { ··· 39 { 40 } 41 static inline void pci_disable_link_state(struct pci_dev *pdev, int state) 42 { 43 } 44 #endif
··· 27 extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); 28 extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); 29 extern void pci_disable_link_state(struct pci_dev *pdev, int state); 30 + extern void pcie_no_aspm(void); 31 #else 32 static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) 33 { ··· 38 { 39 } 40 static inline void pci_disable_link_state(struct pci_dev *pdev, int state) 41 + { 42 + } 43 + 44 + static inline void pcie_no_aspm(void) 45 { 46 } 47 #endif