]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
PCI: disable ASPM on pre-1.1 PCIe devices
authorShaohua Li <shaohua.li@intel.com>
Wed, 23 Jul 2008 02:32:31 +0000 (10:32 +0800)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Mon, 28 Jul 2008 21:56:57 +0000 (14:56 -0700)
Disable ASPM on pre-1.1 PCIe devices, as many of them don't implement it
correctly.

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>
drivers/pci/pcie/aspm.c
drivers/pci/probe.c
include/linux/pci_regs.h

index 759c51a4e399dc43929ba39d39a47c5a74042ec5..704605298c5edd04f35e28fd0119c9c4d505f775 100644 (file)
@@ -510,6 +510,7 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev)
 {
        struct pci_dev *child_dev;
        int child_pos;
+       u32 reg32;
 
        /*
         * Some functions in a slot might not all be PCIE functions, very
@@ -519,6 +520,18 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev)
                child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP);
                if (!child_pos)
                        return -EINVAL;
+
+               /*
+                * Disable ASPM for pre-1.1 PCIe device, we follow MS to use
+                * RBER bit to determine if a function is 1.1 version device
+                */
+               pci_read_config_dword(child_dev, child_pos + PCI_EXP_DEVCAP,
+                       &reg32);
+               if (!(reg32 & PCI_EXP_DEVCAP_RBER)) {
+                       printk("Pre-1.1 PCIe device detected, "
+                               "disable ASPM for %s\n", pci_name(pdev));
+                       return -EINVAL;
+               }
        }
        return 0;
 }
index 2036300658394458b2f77b46f975a661e36d1950..7098dfb07449ebfa665144f3fc3537c1b27ebad3 100644 (file)
@@ -1057,7 +1057,8 @@ int pci_scan_slot(struct pci_bus *bus, int devfn)
                }
        }
 
-       if (bus->self)
+       /* only one slot has pcie device */
+       if (bus->self && nr)
                pcie_aspm_init_link_state(bus->self);
 
        return nr;
index 19958b929905beb2af8a0a6ca6802510379c232a..450684f7eaacd41e08d57b08b0698dadffab1281 100644 (file)
 #define  PCI_EXP_DEVCAP_ATN_BUT        0x1000  /* Attention Button Present */
 #define  PCI_EXP_DEVCAP_ATN_IND        0x2000  /* Attention Indicator Present */
 #define  PCI_EXP_DEVCAP_PWR_IND        0x4000  /* Power Indicator Present */
+#define  PCI_EXP_DEVCAP_RBER   0x8000  /* Role-Based Error Reporting */
 #define  PCI_EXP_DEVCAP_PWR_VAL        0x3fc0000 /* Slot Power Limit Value */
 #define  PCI_EXP_DEVCAP_PWR_SCL        0xc000000 /* Slot Power Limit Scale */
 #define PCI_EXP_DEVCTL         8       /* Device Control */