aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pcie/aspm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/pcie/aspm.c')
-rw-r--r--drivers/pci/pcie/aspm.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index f82495583e63..9a7c9e1408a4 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -55,7 +55,7 @@ struct pcie_link_state {
55 struct endpoint_state endpoints[8]; 55 struct endpoint_state endpoints[8];
56}; 56};
57 57
58static int aspm_disabled; 58static int aspm_disabled, aspm_force;
59static DEFINE_MUTEX(aspm_lock); 59static DEFINE_MUTEX(aspm_lock);
60static LIST_HEAD(link_list); 60static LIST_HEAD(link_list);
61 61
@@ -510,6 +510,7 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev)
510{ 510{
511 struct pci_dev *child_dev; 511 struct pci_dev *child_dev;
512 int child_pos; 512 int child_pos;
513 u32 reg32;
513 514
514 /* 515 /*
515 * Some functions in a slot might not all be PCIE functions, very 516 * Some functions in a slot might not all be PCIE functions, very
@@ -519,6 +520,19 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev)
519 child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); 520 child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP);
520 if (!child_pos) 521 if (!child_pos)
521 return -EINVAL; 522 return -EINVAL;
523
524 /*
525 * Disable ASPM for pre-1.1 PCIe device, we follow MS to use
526 * RBER bit to determine if a function is 1.1 version device
527 */
528 pci_read_config_dword(child_dev, child_pos + PCI_EXP_DEVCAP,
529 &reg32);
530 if (!(reg32 & PCI_EXP_DEVCAP_RBER && !aspm_force)) {
531 printk("Pre-1.1 PCIe device detected, "
532 "disable ASPM for %s. It can be enabled forcedly"
533 " with 'pcie_aspm=force'\n", pci_name(pdev));
534 return -EINVAL;
535 }
522 } 536 }
523 return 0; 537 return 0;
524} 538}
@@ -802,11 +816,23 @@ void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev)
802 816
803static int __init pcie_aspm_disable(char *str) 817static int __init pcie_aspm_disable(char *str)
804{ 818{
805 aspm_disabled = 1; 819 if (!strcmp(str, "off")) {
820 aspm_disabled = 1;
821 printk(KERN_INFO "PCIe ASPM is disabled\n");
822 } else if (!strcmp(str, "force")) {
823 aspm_force = 1;
824 printk(KERN_INFO "PCIe ASPM is forcedly enabled\n");
825 }
806 return 1; 826 return 1;
807} 827}
808 828
809__setup("pcie_noaspm", pcie_aspm_disable); 829__setup("pcie_aspm=", pcie_aspm_disable);
830
831void pcie_no_aspm(void)
832{
833 if (!aspm_force)
834 aspm_disabled = 1;
835}
810 836
811#ifdef CONFIG_ACPI 837#ifdef CONFIG_ACPI
812#include <acpi/acpi_bus.h> 838#include <acpi/acpi_bus.h>