diff options
Diffstat (limited to 'drivers/pci/quirks.c')
-rw-r--r-- | drivers/pci/quirks.c | 151 |
1 files changed, 135 insertions, 16 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index baad093aafe3..92b9efe9bcaf 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/acpi.h> | 23 | #include <linux/acpi.h> |
24 | #include <linux/kallsyms.h> | 24 | #include <linux/kallsyms.h> |
25 | #include <linux/dmi.h> | 25 | #include <linux/dmi.h> |
26 | #include <linux/pci-aspm.h> | ||
26 | #include "pci.h" | 27 | #include "pci.h" |
27 | 28 | ||
28 | int isa_dma_bridge_buggy; | 29 | int isa_dma_bridge_buggy; |
@@ -1584,6 +1585,7 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_ | |||
1584 | */ | 1585 | */ |
1585 | #define AMD_813X_MISC 0x40 | 1586 | #define AMD_813X_MISC 0x40 |
1586 | #define AMD_813X_NOIOAMODE (1<<0) | 1587 | #define AMD_813X_NOIOAMODE (1<<0) |
1588 | #define AMD_813X_REV_B2 0x13 | ||
1587 | 1589 | ||
1588 | static void quirk_disable_amd_813x_boot_interrupt(struct pci_dev *dev) | 1590 | static void quirk_disable_amd_813x_boot_interrupt(struct pci_dev *dev) |
1589 | { | 1591 | { |
@@ -1591,6 +1593,8 @@ static void quirk_disable_amd_813x_boot_interrupt(struct pci_dev *dev) | |||
1591 | 1593 | ||
1592 | if (noioapicquirk) | 1594 | if (noioapicquirk) |
1593 | return; | 1595 | return; |
1596 | if (dev->revision == AMD_813X_REV_B2) | ||
1597 | return; | ||
1594 | 1598 | ||
1595 | pci_read_config_dword(dev, AMD_813X_MISC, &pci_config_dword); | 1599 | pci_read_config_dword(dev, AMD_813X_MISC, &pci_config_dword); |
1596 | pci_config_dword &= ~AMD_813X_NOIOAMODE; | 1600 | pci_config_dword &= ~AMD_813X_NOIOAMODE; |
@@ -1746,6 +1750,30 @@ static void __devinit quirk_e100_interrupt(struct pci_dev *dev) | |||
1746 | } | 1750 | } |
1747 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_e100_interrupt); | 1751 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_e100_interrupt); |
1748 | 1752 | ||
1753 | /* | ||
1754 | * The 82575 and 82598 may experience data corruption issues when transitioning | ||
1755 | * out of L0S. To prevent this we need to disable L0S on the pci-e link | ||
1756 | */ | ||
1757 | static void __devinit quirk_disable_aspm_l0s(struct pci_dev *dev) | ||
1758 | { | ||
1759 | dev_info(&dev->dev, "Disabling L0s\n"); | ||
1760 | pci_disable_link_state(dev, PCIE_LINK_STATE_L0S); | ||
1761 | } | ||
1762 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10a7, quirk_disable_aspm_l0s); | ||
1763 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10a9, quirk_disable_aspm_l0s); | ||
1764 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10b6, quirk_disable_aspm_l0s); | ||
1765 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10c6, quirk_disable_aspm_l0s); | ||
1766 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10c7, quirk_disable_aspm_l0s); | ||
1767 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10c8, quirk_disable_aspm_l0s); | ||
1768 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10d6, quirk_disable_aspm_l0s); | ||
1769 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10db, quirk_disable_aspm_l0s); | ||
1770 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10dd, quirk_disable_aspm_l0s); | ||
1771 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10e1, quirk_disable_aspm_l0s); | ||
1772 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10ec, quirk_disable_aspm_l0s); | ||
1773 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f1, quirk_disable_aspm_l0s); | ||
1774 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f4, quirk_disable_aspm_l0s); | ||
1775 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1508, quirk_disable_aspm_l0s); | ||
1776 | |||
1749 | static void __devinit fixup_rev1_53c810(struct pci_dev* dev) | 1777 | static void __devinit fixup_rev1_53c810(struct pci_dev* dev) |
1750 | { | 1778 | { |
1751 | /* rev 1 ncr53c810 chips don't set the class at all which means | 1779 | /* rev 1 ncr53c810 chips don't set the class at all which means |
@@ -1981,7 +2009,6 @@ static void __devinit quirk_msi_ht_cap(struct pci_dev *dev) | |||
1981 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE, | 2009 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE, |
1982 | quirk_msi_ht_cap); | 2010 | quirk_msi_ht_cap); |
1983 | 2011 | ||
1984 | |||
1985 | /* The nVidia CK804 chipset may have 2 HT MSI mappings. | 2012 | /* The nVidia CK804 chipset may have 2 HT MSI mappings. |
1986 | * MSI are supported if the MSI capability set in any of these mappings. | 2013 | * MSI are supported if the MSI capability set in any of these mappings. |
1987 | */ | 2014 | */ |
@@ -2032,6 +2059,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS, | |||
2032 | PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB, | 2059 | PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB, |
2033 | ht_enable_msi_mapping); | 2060 | ht_enable_msi_mapping); |
2034 | 2061 | ||
2062 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8132_BRIDGE, | ||
2063 | ht_enable_msi_mapping); | ||
2064 | |||
2035 | /* The P5N32-SLI Premium motherboard from Asus has a problem with msi | 2065 | /* The P5N32-SLI Premium motherboard from Asus has a problem with msi |
2036 | * for the MCP55 NIC. It is not yet determined whether the msi problem | 2066 | * for the MCP55 NIC. It is not yet determined whether the msi problem |
2037 | * also affects other devices. As for now, turn off msi for this device. | 2067 | * also affects other devices. As for now, turn off msi for this device. |
@@ -2048,11 +2078,105 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NVIDIA, | |||
2048 | PCI_DEVICE_ID_NVIDIA_NVENET_15, | 2078 | PCI_DEVICE_ID_NVIDIA_NVENET_15, |
2049 | nvenet_msi_disable); | 2079 | nvenet_msi_disable); |
2050 | 2080 | ||
2051 | static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev) | 2081 | static void __devinit nv_ht_enable_msi_mapping(struct pci_dev *dev) |
2052 | { | 2082 | { |
2053 | struct pci_dev *host_bridge; | 2083 | struct pci_dev *host_bridge; |
2084 | int pos; | ||
2085 | int i, dev_no; | ||
2086 | int found = 0; | ||
2087 | |||
2088 | dev_no = dev->devfn >> 3; | ||
2089 | for (i = dev_no; i >= 0; i--) { | ||
2090 | host_bridge = pci_get_slot(dev->bus, PCI_DEVFN(i, 0)); | ||
2091 | if (!host_bridge) | ||
2092 | continue; | ||
2093 | |||
2094 | pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE); | ||
2095 | if (pos != 0) { | ||
2096 | found = 1; | ||
2097 | break; | ||
2098 | } | ||
2099 | pci_dev_put(host_bridge); | ||
2100 | } | ||
2101 | |||
2102 | if (!found) | ||
2103 | return; | ||
2104 | |||
2105 | /* root did that ! */ | ||
2106 | if (msi_ht_cap_enabled(host_bridge)) | ||
2107 | goto out; | ||
2108 | |||
2109 | ht_enable_msi_mapping(dev); | ||
2110 | |||
2111 | out: | ||
2112 | pci_dev_put(host_bridge); | ||
2113 | } | ||
2114 | |||
2115 | static void __devinit ht_disable_msi_mapping(struct pci_dev *dev) | ||
2116 | { | ||
2054 | int pos, ttl = 48; | 2117 | int pos, ttl = 48; |
2055 | 2118 | ||
2119 | pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING); | ||
2120 | while (pos && ttl--) { | ||
2121 | u8 flags; | ||
2122 | |||
2123 | if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, | ||
2124 | &flags) == 0) { | ||
2125 | dev_info(&dev->dev, "Disabling HT MSI Mapping\n"); | ||
2126 | |||
2127 | pci_write_config_byte(dev, pos + HT_MSI_FLAGS, | ||
2128 | flags & ~HT_MSI_FLAGS_ENABLE); | ||
2129 | } | ||
2130 | pos = pci_find_next_ht_capability(dev, pos, | ||
2131 | HT_CAPTYPE_MSI_MAPPING); | ||
2132 | } | ||
2133 | } | ||
2134 | |||
2135 | static int __devinit ht_check_msi_mapping(struct pci_dev *dev) | ||
2136 | { | ||
2137 | int pos, ttl = 48; | ||
2138 | int found = 0; | ||
2139 | |||
2140 | /* check if there is HT MSI cap or enabled on this device */ | ||
2141 | pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING); | ||
2142 | while (pos && ttl--) { | ||
2143 | u8 flags; | ||
2144 | |||
2145 | if (found < 1) | ||
2146 | found = 1; | ||
2147 | if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, | ||
2148 | &flags) == 0) { | ||
2149 | if (flags & HT_MSI_FLAGS_ENABLE) { | ||
2150 | if (found < 2) { | ||
2151 | found = 2; | ||
2152 | break; | ||
2153 | } | ||
2154 | } | ||
2155 | } | ||
2156 | pos = pci_find_next_ht_capability(dev, pos, | ||
2157 | HT_CAPTYPE_MSI_MAPPING); | ||
2158 | } | ||
2159 | |||
2160 | return found; | ||
2161 | } | ||
2162 | |||
2163 | static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev) | ||
2164 | { | ||
2165 | struct pci_dev *host_bridge; | ||
2166 | int pos; | ||
2167 | int found; | ||
2168 | |||
2169 | /* Enabling HT MSI mapping on this device breaks MCP51 */ | ||
2170 | if (dev->device == 0x270) | ||
2171 | return; | ||
2172 | |||
2173 | /* check if there is HT MSI cap or enabled on this device */ | ||
2174 | found = ht_check_msi_mapping(dev); | ||
2175 | |||
2176 | /* no HT MSI CAP */ | ||
2177 | if (found == 0) | ||
2178 | return; | ||
2179 | |||
2056 | /* | 2180 | /* |
2057 | * HT MSI mapping should be disabled on devices that are below | 2181 | * HT MSI mapping should be disabled on devices that are below |
2058 | * a non-Hypertransport host bridge. Locate the host bridge... | 2182 | * a non-Hypertransport host bridge. Locate the host bridge... |
@@ -2067,24 +2191,19 @@ static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev) | |||
2067 | pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE); | 2191 | pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE); |
2068 | if (pos != 0) { | 2192 | if (pos != 0) { |
2069 | /* Host bridge is to HT */ | 2193 | /* Host bridge is to HT */ |
2070 | ht_enable_msi_mapping(dev); | 2194 | if (found == 1) { |
2195 | /* it is not enabled, try to enable it */ | ||
2196 | nv_ht_enable_msi_mapping(dev); | ||
2197 | } | ||
2071 | return; | 2198 | return; |
2072 | } | 2199 | } |
2073 | 2200 | ||
2074 | /* Host bridge is not to HT, disable HT MSI mapping on this device */ | 2201 | /* HT MSI is not enabled */ |
2075 | pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING); | 2202 | if (found == 1) |
2076 | while (pos && ttl--) { | 2203 | return; |
2077 | u8 flags; | ||
2078 | 2204 | ||
2079 | if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, | 2205 | /* Host bridge is not to HT, disable HT MSI mapping on this device */ |
2080 | &flags) == 0) { | 2206 | ht_disable_msi_mapping(dev); |
2081 | dev_info(&dev->dev, "Disabling HT MSI mapping"); | ||
2082 | pci_write_config_byte(dev, pos + HT_MSI_FLAGS, | ||
2083 | flags & ~HT_MSI_FLAGS_ENABLE); | ||
2084 | } | ||
2085 | pos = pci_find_next_ht_capability(dev, pos, | ||
2086 | HT_CAPTYPE_MSI_MAPPING); | ||
2087 | } | ||
2088 | } | 2207 | } |
2089 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, nv_msi_ht_cap_quirk); | 2208 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, nv_msi_ht_cap_quirk); |
2090 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_ANY_ID, nv_msi_ht_cap_quirk); | 2209 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_ANY_ID, nv_msi_ht_cap_quirk); |