Follow MS to disable pre-1.1 pcie device's aspm, as some devices don't implement aspm correctly. Signed-off-by: Shaohua Li <shaohua.li@xxxxxxxxx> --- drivers/pci/pcie/aspm.c | 13 +++++++++++++ drivers/pci/probe.c | 3 ++- include/linux/pci_regs.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) Index: linux/drivers/pci/pcie/aspm.c =================================================================== --- linux.orig/drivers/pci/pcie/aspm.c 2008-07-23 09:50:15.000000000 +0800 +++ linux/drivers/pci/pcie/aspm.c 2008-07-23 10:10:53.000000000 +0800 @@ -510,6 +510,7 @@ static int pcie_aspm_sanity_check(struct { 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 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, + ®32); + 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: linux/include/linux/pci_regs.h =================================================================== --- linux.orig/include/linux/pci_regs.h 2008-07-23 09:50:05.000000000 +0800 +++ linux/include/linux/pci_regs.h 2008-07-23 09:50:16.000000000 +0800 @@ -374,6 +374,7 @@ #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 */ Index: linux/drivers/pci/probe.c =================================================================== --- linux.orig/drivers/pci/probe.c 2008-07-23 10:10:59.000000000 +0800 +++ linux/drivers/pci/probe.c 2008-07-23 10:11:45.000000000 +0800 @@ -1053,7 +1053,8 @@ int pci_scan_slot(struct pci_bus *bus, i } } - if (bus->self) + /* only one slot has pcie device */ + if (bus->self && nr) pcie_aspm_init_link_state(bus->self); return nr; -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html