.. | .. |
---|
20 | 20 | #include <linux/delay.h> |
---|
21 | 21 | #include <linux/acpi.h> |
---|
22 | 22 | #include <linux/dmi.h> |
---|
23 | | -#include <linux/pci-aspm.h> |
---|
24 | 23 | #include <linux/ioport.h> |
---|
25 | 24 | #include <linux/sched.h> |
---|
26 | 25 | #include <linux/ktime.h> |
---|
.. | .. |
---|
37 | 36 | void (*fn)(struct pci_dev *dev)) |
---|
38 | 37 | { |
---|
39 | 38 | if (initcall_debug) |
---|
40 | | - pci_info(dev, "calling %pF @ %i\n", fn, task_pid_nr(current)); |
---|
| 39 | + pci_info(dev, "calling %pS @ %i\n", fn, task_pid_nr(current)); |
---|
41 | 40 | |
---|
42 | 41 | return ktime_get(); |
---|
43 | 42 | } |
---|
.. | .. |
---|
52 | 51 | delta = ktime_sub(rettime, calltime); |
---|
53 | 52 | duration = (unsigned long long) ktime_to_ns(delta) >> 10; |
---|
54 | 53 | if (initcall_debug || duration > 10000) |
---|
55 | | - pci_info(dev, "%pF took %lld usecs\n", fn, duration); |
---|
| 54 | + pci_info(dev, "%pS took %lld usecs\n", fn, duration); |
---|
56 | 55 | } |
---|
57 | 56 | |
---|
58 | 57 | static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, |
---|
.. | .. |
---|
160 | 159 | u8 tmp; |
---|
161 | 160 | |
---|
162 | 161 | if (pci_cache_line_size) |
---|
163 | | - printk(KERN_DEBUG "PCI: CLS %u bytes\n", |
---|
164 | | - pci_cache_line_size << 2); |
---|
| 162 | + pr_info("PCI: CLS %u bytes\n", pci_cache_line_size << 2); |
---|
165 | 163 | |
---|
166 | 164 | pci_apply_fixup_final_quirks = true; |
---|
167 | 165 | for_each_pci_dev(dev) { |
---|
.. | .. |
---|
178 | 176 | if (!tmp || cls == tmp) |
---|
179 | 177 | continue; |
---|
180 | 178 | |
---|
181 | | - printk(KERN_DEBUG "PCI: CLS mismatch (%u != %u), using %u bytes\n", |
---|
182 | | - cls << 2, tmp << 2, |
---|
183 | | - pci_dfl_cache_line_size << 2); |
---|
| 179 | + pci_info(dev, "CLS mismatch (%u != %u), using %u bytes\n", |
---|
| 180 | + cls << 2, tmp << 2, |
---|
| 181 | + pci_dfl_cache_line_size << 2); |
---|
184 | 182 | pci_cache_line_size = pci_dfl_cache_line_size; |
---|
185 | 183 | } |
---|
186 | 184 | } |
---|
187 | 185 | |
---|
188 | 186 | if (!pci_cache_line_size) { |
---|
189 | | - printk(KERN_DEBUG "PCI: CLS %u bytes, default %u\n", |
---|
190 | | - cls << 2, pci_dfl_cache_line_size << 2); |
---|
| 187 | + pr_info("PCI: CLS %u bytes, default %u\n", cls << 2, |
---|
| 188 | + pci_dfl_cache_line_size << 2); |
---|
191 | 189 | pci_cache_line_size = cls ? cls : pci_dfl_cache_line_size; |
---|
192 | 190 | } |
---|
193 | 191 | |
---|
.. | .. |
---|
477 | 475 | { |
---|
478 | 476 | int i; |
---|
479 | 477 | |
---|
480 | | - for (i = 0; i <= PCI_STD_RESOURCE_END; i++) { |
---|
| 478 | + for (i = 0; i < PCI_STD_NUM_BARS; i++) { |
---|
481 | 479 | struct resource *r = &dev->resource[i]; |
---|
482 | 480 | |
---|
483 | 481 | if (r->flags & IORESOURCE_MEM && resource_size(r) < PAGE_SIZE) { |
---|
.. | .. |
---|
618 | 616 | } |
---|
619 | 617 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB, |
---|
620 | 618 | quirk_amd_nl_class); |
---|
| 619 | + |
---|
| 620 | +/* |
---|
| 621 | + * Synopsys USB 3.x host HAPS platform has a class code of |
---|
| 622 | + * PCI_CLASS_SERIAL_USB_XHCI, and xhci driver can claim it. However, these |
---|
| 623 | + * devices should use dwc3-haps driver. Change these devices' class code to |
---|
| 624 | + * PCI_CLASS_SERIAL_USB_DEVICE to prevent the xhci-pci driver from claiming |
---|
| 625 | + * them. |
---|
| 626 | + */ |
---|
| 627 | +static void quirk_synopsys_haps(struct pci_dev *pdev) |
---|
| 628 | +{ |
---|
| 629 | + u32 class = pdev->class; |
---|
| 630 | + |
---|
| 631 | + switch (pdev->device) { |
---|
| 632 | + case PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3: |
---|
| 633 | + case PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3_AXI: |
---|
| 634 | + case PCI_DEVICE_ID_SYNOPSYS_HAPSUSB31: |
---|
| 635 | + pdev->class = PCI_CLASS_SERIAL_USB_DEVICE; |
---|
| 636 | + pci_info(pdev, "PCI class overridden (%#08x -> %#08x) so dwc3 driver can claim this instead of xhci\n", |
---|
| 637 | + class, pdev->class); |
---|
| 638 | + break; |
---|
| 639 | + } |
---|
| 640 | +} |
---|
| 641 | +DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_SYNOPSYS, PCI_ANY_ID, |
---|
| 642 | + PCI_CLASS_SERIAL_USB_XHCI, 0, |
---|
| 643 | + quirk_synopsys_haps); |
---|
621 | 644 | |
---|
622 | 645 | /* |
---|
623 | 646 | * Let's make the southbridge information explicit instead of having to |
---|
.. | .. |
---|
1549 | 1572 | |
---|
1550 | 1573 | pci_read_config_dword(dev, 0xF0, &rcba); |
---|
1551 | 1574 | /* use bits 31:14, 16 kB aligned */ |
---|
1552 | | - asus_rcba_base = ioremap_nocache(rcba & 0xFFFFC000, 0x4000); |
---|
| 1575 | + asus_rcba_base = ioremap(rcba & 0xFFFFC000, 0x4000); |
---|
1553 | 1576 | if (asus_rcba_base == NULL) |
---|
1554 | 1577 | return; |
---|
1555 | 1578 | } |
---|
.. | .. |
---|
1708 | 1731 | case PCI_DEVICE_ID_JMICRON_JMB366: |
---|
1709 | 1732 | /* Redirect IDE second PATA port to the right spot */ |
---|
1710 | 1733 | conf5 |= (1 << 24); |
---|
1711 | | - /* Fall through */ |
---|
| 1734 | + fallthrough; |
---|
1712 | 1735 | case PCI_DEVICE_ID_JMICRON_JMB361: |
---|
1713 | 1736 | case PCI_DEVICE_ID_JMICRON_JMB363: |
---|
1714 | 1737 | case PCI_DEVICE_ID_JMICRON_JMB369: |
---|
.. | .. |
---|
1787 | 1810 | * The next five BARs all seem to be rubbish, so just clean |
---|
1788 | 1811 | * them out. |
---|
1789 | 1812 | */ |
---|
1790 | | - for (i = 1; i < 6; i++) |
---|
| 1813 | + for (i = 1; i < PCI_STD_NUM_BARS; i++) |
---|
1791 | 1814 | memset(&pdev->resource[i], 0, sizeof(pdev->resource[i])); |
---|
1792 | 1815 | } |
---|
1793 | 1816 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic); |
---|
1794 | 1817 | #endif |
---|
| 1818 | + |
---|
| 1819 | +static void quirk_no_msi(struct pci_dev *dev) |
---|
| 1820 | +{ |
---|
| 1821 | + pci_info(dev, "avoiding MSI to work around a hardware defect\n"); |
---|
| 1822 | + dev->no_msi = 1; |
---|
| 1823 | +} |
---|
| 1824 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4386, quirk_no_msi); |
---|
| 1825 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4387, quirk_no_msi); |
---|
| 1826 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4388, quirk_no_msi); |
---|
| 1827 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4389, quirk_no_msi); |
---|
| 1828 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x438a, quirk_no_msi); |
---|
| 1829 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x438b, quirk_no_msi); |
---|
1795 | 1830 | |
---|
1796 | 1831 | static void quirk_pcie_mch(struct pci_dev *pdev) |
---|
1797 | 1832 | { |
---|
.. | .. |
---|
1824 | 1859 | */ |
---|
1825 | 1860 | static void quirk_intel_pcie_pm(struct pci_dev *dev) |
---|
1826 | 1861 | { |
---|
1827 | | - pci_pm_d3_delay = 120; |
---|
| 1862 | + pci_pm_d3hot_delay = 120; |
---|
1828 | 1863 | dev->no_d1d2 = 1; |
---|
1829 | 1864 | } |
---|
1830 | 1865 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x25e2, quirk_intel_pcie_pm); |
---|
.. | .. |
---|
1851 | 1886 | |
---|
1852 | 1887 | static void quirk_d3hot_delay(struct pci_dev *dev, unsigned int delay) |
---|
1853 | 1888 | { |
---|
1854 | | - if (dev->d3_delay >= delay) |
---|
| 1889 | + if (dev->d3hot_delay >= delay) |
---|
1855 | 1890 | return; |
---|
1856 | 1891 | |
---|
1857 | | - dev->d3_delay = delay; |
---|
| 1892 | + dev->d3hot_delay = delay; |
---|
1858 | 1893 | pci_info(dev, "extending delay after power-on from D3hot to %d msec\n", |
---|
1859 | | - dev->d3_delay); |
---|
| 1894 | + dev->d3hot_delay); |
---|
1860 | 1895 | } |
---|
1861 | 1896 | |
---|
1862 | 1897 | static void quirk_radeon_pm(struct pci_dev *dev) |
---|
.. | .. |
---|
2203 | 2238 | if (dev->subsystem_vendor == PCI_VENDOR_ID_IBM && |
---|
2204 | 2239 | dev->subsystem_device == 0x0299) |
---|
2205 | 2240 | return; |
---|
2206 | | - /* else: fall through */ |
---|
| 2241 | + fallthrough; |
---|
2207 | 2242 | case PCI_DEVICE_ID_NETMOS_9735: |
---|
2208 | 2243 | case PCI_DEVICE_ID_NETMOS_9745: |
---|
2209 | 2244 | case PCI_DEVICE_ID_NETMOS_9845: |
---|
.. | .. |
---|
2321 | 2356 | * disable both L0s and L1 for now to be safe. |
---|
2322 | 2357 | */ |
---|
2323 | 2358 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASMEDIA, 0x1080, quirk_disable_aspm_l0s_l1); |
---|
| 2359 | + |
---|
| 2360 | +/* |
---|
| 2361 | + * Micron 2100AI NVMe doesn't work reliably when ASPM is enabled. Disable |
---|
| 2362 | + * ASPM support for it now. |
---|
| 2363 | + */ |
---|
| 2364 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MICRON, PCI_DEVICE_ID_MICRON_2100AI, |
---|
| 2365 | + quirk_disable_aspm_l0s_l1); |
---|
2324 | 2366 | |
---|
2325 | 2367 | /* |
---|
2326 | 2368 | * Some Pericom PCIe-to-PCI bridges in reverse mode need the PCIe Retrain |
---|
.. | .. |
---|
2645 | 2687 | nvenet_msi_disable); |
---|
2646 | 2688 | |
---|
2647 | 2689 | /* |
---|
| 2690 | + * PCIe spec r4.0 sec 7.7.1.2 and sec 7.7.2.2 say that if MSI/MSI-X is enabled, |
---|
| 2691 | + * then the device can't use INTx interrupts. Tegra's PCIe root ports don't |
---|
| 2692 | + * generate MSI interrupts for PME and AER events instead only INTx interrupts |
---|
| 2693 | + * are generated. Though Tegra's PCIe root ports can generate MSI interrupts |
---|
| 2694 | + * for other events, since PCIe specificiation doesn't support using a mix of |
---|
| 2695 | + * INTx and MSI/MSI-X, it is required to disable MSI interrupts to avoid port |
---|
| 2696 | + * service drivers registering their respective ISRs for MSIs. |
---|
| 2697 | + */ |
---|
| 2698 | +static void pci_quirk_nvidia_tegra_disable_rp_msi(struct pci_dev *dev) |
---|
| 2699 | +{ |
---|
| 2700 | + dev->no_msi = 1; |
---|
| 2701 | +} |
---|
| 2702 | +DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_NVIDIA, 0x1ad0, |
---|
| 2703 | + PCI_CLASS_BRIDGE_PCI, 8, |
---|
| 2704 | + pci_quirk_nvidia_tegra_disable_rp_msi); |
---|
| 2705 | +DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_NVIDIA, 0x1ad1, |
---|
| 2706 | + PCI_CLASS_BRIDGE_PCI, 8, |
---|
| 2707 | + pci_quirk_nvidia_tegra_disable_rp_msi); |
---|
| 2708 | +DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_NVIDIA, 0x1ad2, |
---|
| 2709 | + PCI_CLASS_BRIDGE_PCI, 8, |
---|
| 2710 | + pci_quirk_nvidia_tegra_disable_rp_msi); |
---|
| 2711 | +DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0bf0, |
---|
| 2712 | + PCI_CLASS_BRIDGE_PCI, 8, |
---|
| 2713 | + pci_quirk_nvidia_tegra_disable_rp_msi); |
---|
| 2714 | +DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0bf1, |
---|
| 2715 | + PCI_CLASS_BRIDGE_PCI, 8, |
---|
| 2716 | + pci_quirk_nvidia_tegra_disable_rp_msi); |
---|
| 2717 | +DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0e1c, |
---|
| 2718 | + PCI_CLASS_BRIDGE_PCI, 8, |
---|
| 2719 | + pci_quirk_nvidia_tegra_disable_rp_msi); |
---|
| 2720 | +DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0e1d, |
---|
| 2721 | + PCI_CLASS_BRIDGE_PCI, 8, |
---|
| 2722 | + pci_quirk_nvidia_tegra_disable_rp_msi); |
---|
| 2723 | +DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0e12, |
---|
| 2724 | + PCI_CLASS_BRIDGE_PCI, 8, |
---|
| 2725 | + pci_quirk_nvidia_tegra_disable_rp_msi); |
---|
| 2726 | +DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0e13, |
---|
| 2727 | + PCI_CLASS_BRIDGE_PCI, 8, |
---|
| 2728 | + pci_quirk_nvidia_tegra_disable_rp_msi); |
---|
| 2729 | +DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0fae, |
---|
| 2730 | + PCI_CLASS_BRIDGE_PCI, 8, |
---|
| 2731 | + pci_quirk_nvidia_tegra_disable_rp_msi); |
---|
| 2732 | +DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_NVIDIA, 0x0faf, |
---|
| 2733 | + PCI_CLASS_BRIDGE_PCI, 8, |
---|
| 2734 | + pci_quirk_nvidia_tegra_disable_rp_msi); |
---|
| 2735 | +DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_NVIDIA, 0x10e5, |
---|
| 2736 | + PCI_CLASS_BRIDGE_PCI, 8, |
---|
| 2737 | + pci_quirk_nvidia_tegra_disable_rp_msi); |
---|
| 2738 | +DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_NVIDIA, 0x10e6, |
---|
| 2739 | + PCI_CLASS_BRIDGE_PCI, 8, |
---|
| 2740 | + pci_quirk_nvidia_tegra_disable_rp_msi); |
---|
| 2741 | + |
---|
| 2742 | +/* |
---|
2648 | 2743 | * Some versions of the MCP55 bridge from Nvidia have a legacy IRQ routing |
---|
2649 | 2744 | * config register. This register controls the routing of legacy |
---|
2650 | 2745 | * interrupts from devices that route through the MCP55. If this register |
---|
.. | .. |
---|
2664 | 2759 | pci_read_config_dword(dev, 0x74, &cfg); |
---|
2665 | 2760 | |
---|
2666 | 2761 | if (cfg & ((1 << 2) | (1 << 15))) { |
---|
2667 | | - printk(KERN_INFO "Rewriting IRQ routing register on MCP55\n"); |
---|
| 2762 | + pr_info("Rewriting IRQ routing register on MCP55\n"); |
---|
2668 | 2763 | cfg &= ~((1 << 2) | (1 << 15)); |
---|
2669 | 2764 | pci_write_config_dword(dev, 0x74, cfg); |
---|
2670 | 2765 | } |
---|
.. | .. |
---|
2977 | 3072 | quirk_msi_intx_disable_qca_bug); |
---|
2978 | 3073 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, 0xe091, |
---|
2979 | 3074 | quirk_msi_intx_disable_qca_bug); |
---|
| 3075 | + |
---|
| 3076 | +/* |
---|
| 3077 | + * Amazon's Annapurna Labs 1c36:0031 Root Ports don't support MSI-X, so it |
---|
| 3078 | + * should be disabled on platforms where the device (mistakenly) advertises it. |
---|
| 3079 | + * |
---|
| 3080 | + * Notice that this quirk also disables MSI (which may work, but hasn't been |
---|
| 3081 | + * tested), since currently there is no standard way to disable only MSI-X. |
---|
| 3082 | + * |
---|
| 3083 | + * The 0031 device id is reused for other non Root Port device types, |
---|
| 3084 | + * therefore the quirk is registered for the PCI_CLASS_BRIDGE_PCI class. |
---|
| 3085 | + */ |
---|
| 3086 | +static void quirk_al_msi_disable(struct pci_dev *dev) |
---|
| 3087 | +{ |
---|
| 3088 | + dev->no_msi = 1; |
---|
| 3089 | + pci_warn(dev, "Disabling MSI/MSI-X\n"); |
---|
| 3090 | +} |
---|
| 3091 | +DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031, |
---|
| 3092 | + PCI_CLASS_BRIDGE_PCI, 8, quirk_al_msi_disable); |
---|
2980 | 3093 | #endif /* CONFIG_PCI_MSI */ |
---|
2981 | 3094 | |
---|
2982 | 3095 | /* |
---|
.. | .. |
---|
3296 | 3409 | * PCI devices which are on Intel chips can skip the 10ms delay |
---|
3297 | 3410 | * before entering D3 mode. |
---|
3298 | 3411 | */ |
---|
3299 | | -static void quirk_remove_d3_delay(struct pci_dev *dev) |
---|
| 3412 | +static void quirk_remove_d3hot_delay(struct pci_dev *dev) |
---|
3300 | 3413 | { |
---|
3301 | | - dev->d3_delay = 0; |
---|
| 3414 | + dev->d3hot_delay = 0; |
---|
3302 | 3415 | } |
---|
3303 | | -/* C600 Series devices do not need 10ms d3_delay */ |
---|
3304 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0412, quirk_remove_d3_delay); |
---|
3305 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0c00, quirk_remove_d3_delay); |
---|
3306 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0c0c, quirk_remove_d3_delay); |
---|
3307 | | -/* Lynxpoint-H PCH devices do not need 10ms d3_delay */ |
---|
3308 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c02, quirk_remove_d3_delay); |
---|
3309 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c18, quirk_remove_d3_delay); |
---|
3310 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c1c, quirk_remove_d3_delay); |
---|
3311 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c20, quirk_remove_d3_delay); |
---|
3312 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c22, quirk_remove_d3_delay); |
---|
3313 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c26, quirk_remove_d3_delay); |
---|
3314 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c2d, quirk_remove_d3_delay); |
---|
3315 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c31, quirk_remove_d3_delay); |
---|
3316 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c3a, quirk_remove_d3_delay); |
---|
3317 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c3d, quirk_remove_d3_delay); |
---|
3318 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c4e, quirk_remove_d3_delay); |
---|
3319 | | -/* Intel Cherrytrail devices do not need 10ms d3_delay */ |
---|
3320 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2280, quirk_remove_d3_delay); |
---|
3321 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2298, quirk_remove_d3_delay); |
---|
3322 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x229c, quirk_remove_d3_delay); |
---|
3323 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22b0, quirk_remove_d3_delay); |
---|
3324 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22b5, quirk_remove_d3_delay); |
---|
3325 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22b7, quirk_remove_d3_delay); |
---|
3326 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22b8, quirk_remove_d3_delay); |
---|
3327 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22d8, quirk_remove_d3_delay); |
---|
3328 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22dc, quirk_remove_d3_delay); |
---|
| 3416 | +/* C600 Series devices do not need 10ms d3hot_delay */ |
---|
| 3417 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0412, quirk_remove_d3hot_delay); |
---|
| 3418 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0c00, quirk_remove_d3hot_delay); |
---|
| 3419 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0c0c, quirk_remove_d3hot_delay); |
---|
| 3420 | +/* Lynxpoint-H PCH devices do not need 10ms d3hot_delay */ |
---|
| 3421 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c02, quirk_remove_d3hot_delay); |
---|
| 3422 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c18, quirk_remove_d3hot_delay); |
---|
| 3423 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c1c, quirk_remove_d3hot_delay); |
---|
| 3424 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c20, quirk_remove_d3hot_delay); |
---|
| 3425 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c22, quirk_remove_d3hot_delay); |
---|
| 3426 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c26, quirk_remove_d3hot_delay); |
---|
| 3427 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c2d, quirk_remove_d3hot_delay); |
---|
| 3428 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c31, quirk_remove_d3hot_delay); |
---|
| 3429 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c3a, quirk_remove_d3hot_delay); |
---|
| 3430 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c3d, quirk_remove_d3hot_delay); |
---|
| 3431 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x8c4e, quirk_remove_d3hot_delay); |
---|
| 3432 | +/* Intel Cherrytrail devices do not need 10ms d3hot_delay */ |
---|
| 3433 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2280, quirk_remove_d3hot_delay); |
---|
| 3434 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x2298, quirk_remove_d3hot_delay); |
---|
| 3435 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x229c, quirk_remove_d3hot_delay); |
---|
| 3436 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22b0, quirk_remove_d3hot_delay); |
---|
| 3437 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22b5, quirk_remove_d3hot_delay); |
---|
| 3438 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22b7, quirk_remove_d3hot_delay); |
---|
| 3439 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22b8, quirk_remove_d3hot_delay); |
---|
| 3440 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22d8, quirk_remove_d3hot_delay); |
---|
| 3441 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x22dc, quirk_remove_d3hot_delay); |
---|
3329 | 3442 | |
---|
3330 | 3443 | /* |
---|
3331 | 3444 | * Some devices may pass our check in pci_intx_mask_supported() if |
---|
.. | .. |
---|
3483 | 3596 | * The device will throw a Link Down error on AER-capable systems and |
---|
3484 | 3597 | * regardless of AER, config space of the device is never accessible again |
---|
3485 | 3598 | * and typically causes the system to hang or reset when access is attempted. |
---|
3486 | | - * http://www.spinics.net/lists/linux-pci/msg34797.html |
---|
| 3599 | + * https://lore.kernel.org/r/20140923210318.498dacbd@dualc.maya.org/ |
---|
3487 | 3600 | */ |
---|
3488 | 3601 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0030, quirk_no_bus_reset); |
---|
3489 | 3602 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0032, quirk_no_bus_reset); |
---|
.. | .. |
---|
3615 | 3728 | DECLARE_PCI_FIXUP_SUSPEND_LATE(PCI_VENDOR_ID_INTEL, |
---|
3616 | 3729 | PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C, |
---|
3617 | 3730 | quirk_apple_poweroff_thunderbolt); |
---|
3618 | | - |
---|
3619 | | -/* |
---|
3620 | | - * Apple: Wait for the Thunderbolt controller to reestablish PCI tunnels |
---|
3621 | | - * |
---|
3622 | | - * During suspend the Thunderbolt controller is reset and all PCI |
---|
3623 | | - * tunnels are lost. The NHI driver will try to reestablish all tunnels |
---|
3624 | | - * during resume. We have to manually wait for the NHI since there is |
---|
3625 | | - * no parent child relationship between the NHI and the tunneled |
---|
3626 | | - * bridges. |
---|
3627 | | - */ |
---|
3628 | | -static void quirk_apple_wait_for_thunderbolt(struct pci_dev *dev) |
---|
3629 | | -{ |
---|
3630 | | - struct pci_dev *sibling = NULL; |
---|
3631 | | - struct pci_dev *nhi = NULL; |
---|
3632 | | - |
---|
3633 | | - if (!x86_apple_machine) |
---|
3634 | | - return; |
---|
3635 | | - if (pci_pcie_type(dev) != PCI_EXP_TYPE_DOWNSTREAM) |
---|
3636 | | - return; |
---|
3637 | | - |
---|
3638 | | - /* |
---|
3639 | | - * Find the NHI and confirm that we are a bridge on the Thunderbolt |
---|
3640 | | - * host controller and not on a Thunderbolt endpoint. |
---|
3641 | | - */ |
---|
3642 | | - sibling = pci_get_slot(dev->bus, 0x0); |
---|
3643 | | - if (sibling == dev) |
---|
3644 | | - goto out; /* we are the downstream bridge to the NHI */ |
---|
3645 | | - if (!sibling || !sibling->subordinate) |
---|
3646 | | - goto out; |
---|
3647 | | - nhi = pci_get_slot(sibling->subordinate, 0x0); |
---|
3648 | | - if (!nhi) |
---|
3649 | | - goto out; |
---|
3650 | | - if (nhi->vendor != PCI_VENDOR_ID_INTEL |
---|
3651 | | - || (nhi->device != PCI_DEVICE_ID_INTEL_LIGHT_RIDGE && |
---|
3652 | | - nhi->device != PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C && |
---|
3653 | | - nhi->device != PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_NHI && |
---|
3654 | | - nhi->device != PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI) |
---|
3655 | | - || nhi->class != PCI_CLASS_SYSTEM_OTHER << 8) |
---|
3656 | | - goto out; |
---|
3657 | | - pci_info(dev, "quirk: waiting for Thunderbolt to reestablish PCI tunnels...\n"); |
---|
3658 | | - device_pm_wait_for_dev(&dev->dev, &nhi->dev); |
---|
3659 | | -out: |
---|
3660 | | - pci_dev_put(nhi); |
---|
3661 | | - pci_dev_put(sibling); |
---|
3662 | | -} |
---|
3663 | | -DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL, |
---|
3664 | | - PCI_DEVICE_ID_INTEL_LIGHT_RIDGE, |
---|
3665 | | - quirk_apple_wait_for_thunderbolt); |
---|
3666 | | -DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL, |
---|
3667 | | - PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C, |
---|
3668 | | - quirk_apple_wait_for_thunderbolt); |
---|
3669 | | -DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL, |
---|
3670 | | - PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_BRIDGE, |
---|
3671 | | - quirk_apple_wait_for_thunderbolt); |
---|
3672 | | -DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL, |
---|
3673 | | - PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_BRIDGE, |
---|
3674 | | - quirk_apple_wait_for_thunderbolt); |
---|
3675 | 3731 | #endif |
---|
3676 | 3732 | |
---|
3677 | 3733 | /* |
---|
.. | .. |
---|
4013 | 4069 | static void quirk_dma_func0_alias(struct pci_dev *dev) |
---|
4014 | 4070 | { |
---|
4015 | 4071 | if (PCI_FUNC(dev->devfn) != 0) |
---|
4016 | | - pci_add_dma_alias(dev, PCI_DEVFN(PCI_SLOT(dev->devfn), 0)); |
---|
| 4072 | + pci_add_dma_alias(dev, PCI_DEVFN(PCI_SLOT(dev->devfn), 0), 1); |
---|
4017 | 4073 | } |
---|
4018 | 4074 | |
---|
4019 | 4075 | /* |
---|
.. | .. |
---|
4027 | 4083 | static void quirk_dma_func1_alias(struct pci_dev *dev) |
---|
4028 | 4084 | { |
---|
4029 | 4085 | if (PCI_FUNC(dev->devfn) != 1) |
---|
4030 | | - pci_add_dma_alias(dev, PCI_DEVFN(PCI_SLOT(dev->devfn), 1)); |
---|
| 4086 | + pci_add_dma_alias(dev, PCI_DEVFN(PCI_SLOT(dev->devfn), 1), 1); |
---|
4031 | 4087 | } |
---|
4032 | 4088 | |
---|
4033 | 4089 | /* |
---|
.. | .. |
---|
4074 | 4130 | /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c49 */ |
---|
4075 | 4131 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9230, |
---|
4076 | 4132 | quirk_dma_func1_alias); |
---|
| 4133 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9235, |
---|
| 4134 | + quirk_dma_func1_alias); |
---|
4077 | 4135 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TTI, 0x0642, |
---|
4078 | 4136 | quirk_dma_func1_alias); |
---|
4079 | 4137 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TTI, 0x0645, |
---|
.. | .. |
---|
4118 | 4176 | |
---|
4119 | 4177 | id = pci_match_id(fixed_dma_alias_tbl, dev); |
---|
4120 | 4178 | if (id) |
---|
4121 | | - pci_add_dma_alias(dev, id->driver_data); |
---|
| 4179 | + pci_add_dma_alias(dev, id->driver_data, 1); |
---|
4122 | 4180 | } |
---|
4123 | | - |
---|
4124 | 4181 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ADAPTEC2, 0x0285, quirk_fixed_dma_alias); |
---|
4125 | 4182 | |
---|
4126 | 4183 | /* |
---|
.. | .. |
---|
4160 | 4217 | */ |
---|
4161 | 4218 | static void quirk_mic_x200_dma_alias(struct pci_dev *pdev) |
---|
4162 | 4219 | { |
---|
4163 | | - pci_add_dma_alias(pdev, PCI_DEVFN(0x10, 0x0)); |
---|
4164 | | - pci_add_dma_alias(pdev, PCI_DEVFN(0x11, 0x0)); |
---|
4165 | | - pci_add_dma_alias(pdev, PCI_DEVFN(0x12, 0x3)); |
---|
| 4220 | + pci_add_dma_alias(pdev, PCI_DEVFN(0x10, 0x0), 1); |
---|
| 4221 | + pci_add_dma_alias(pdev, PCI_DEVFN(0x11, 0x0), 1); |
---|
| 4222 | + pci_add_dma_alias(pdev, PCI_DEVFN(0x12, 0x3), 1); |
---|
4166 | 4223 | } |
---|
4167 | 4224 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2260, quirk_mic_x200_dma_alias); |
---|
4168 | 4225 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2264, quirk_mic_x200_dma_alias); |
---|
.. | .. |
---|
4186 | 4243 | const unsigned int num_pci_slots = 0x20; |
---|
4187 | 4244 | unsigned int slot; |
---|
4188 | 4245 | |
---|
4189 | | - for (slot = 0; slot < num_pci_slots; slot++) { |
---|
4190 | | - pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x0)); |
---|
4191 | | - pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x1)); |
---|
4192 | | - pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x2)); |
---|
4193 | | - pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x3)); |
---|
4194 | | - pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x4)); |
---|
4195 | | - } |
---|
| 4246 | + for (slot = 0; slot < num_pci_slots; slot++) |
---|
| 4247 | + pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x0), 5); |
---|
4196 | 4248 | } |
---|
4197 | 4249 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2954, quirk_pex_vca_alias); |
---|
4198 | 4250 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2955, quirk_pex_vca_alias); |
---|
.. | .. |
---|
4351 | 4403 | */ |
---|
4352 | 4404 | static void quirk_disable_root_port_attributes(struct pci_dev *pdev) |
---|
4353 | 4405 | { |
---|
4354 | | - struct pci_dev *root_port = pci_find_pcie_root_port(pdev); |
---|
| 4406 | + struct pci_dev *root_port = pcie_find_root_port(pdev); |
---|
4355 | 4407 | |
---|
4356 | 4408 | if (!root_port) { |
---|
4357 | 4409 | pci_warn(pdev, "PCIe Completion erratum may cause device errors\n"); |
---|
.. | .. |
---|
4410 | 4462 | * redirect (CR) since all transactions are redirected to the upstream |
---|
4411 | 4463 | * root complex. |
---|
4412 | 4464 | * |
---|
4413 | | - * http://permalink.gmane.org/gmane.comp.emulators.kvm.devel/94086 |
---|
4414 | | - * http://permalink.gmane.org/gmane.comp.emulators.kvm.devel/94102 |
---|
4415 | | - * http://permalink.gmane.org/gmane.comp.emulators.kvm.devel/99402 |
---|
| 4465 | + * https://lore.kernel.org/r/201207111426.q6BEQTbh002928@mail.maya.org/ |
---|
| 4466 | + * https://lore.kernel.org/r/20120711165854.GM25282@amd.com/ |
---|
| 4467 | + * https://lore.kernel.org/r/20121005130857.GX4009@amd.com/ |
---|
4416 | 4468 | * |
---|
4417 | 4469 | * 1002:4385 SBx00 SMBus Controller |
---|
4418 | 4470 | * 1002:439c SB7x0/SB8x0/SB9x0 IDE Controller |
---|
.. | .. |
---|
4500 | 4552 | } |
---|
4501 | 4553 | |
---|
4502 | 4554 | /* |
---|
| 4555 | + * Many Zhaoxin Root Ports and Switch Downstream Ports have no ACS capability. |
---|
| 4556 | + * But the implementation could block peer-to-peer transactions between them |
---|
| 4557 | + * and provide ACS-like functionality. |
---|
| 4558 | + */ |
---|
| 4559 | +static int pci_quirk_zhaoxin_pcie_ports_acs(struct pci_dev *dev, u16 acs_flags) |
---|
| 4560 | +{ |
---|
| 4561 | + if (!pci_is_pcie(dev) || |
---|
| 4562 | + ((pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT) && |
---|
| 4563 | + (pci_pcie_type(dev) != PCI_EXP_TYPE_DOWNSTREAM))) |
---|
| 4564 | + return -ENOTTY; |
---|
| 4565 | + |
---|
| 4566 | + switch (dev->device) { |
---|
| 4567 | + case 0x0710 ... 0x071e: |
---|
| 4568 | + case 0x0721: |
---|
| 4569 | + case 0x0723 ... 0x0732: |
---|
| 4570 | + return pci_acs_ctrl_enabled(acs_flags, |
---|
| 4571 | + PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); |
---|
| 4572 | + } |
---|
| 4573 | + |
---|
| 4574 | + return false; |
---|
| 4575 | +} |
---|
| 4576 | + |
---|
| 4577 | +/* |
---|
4503 | 4578 | * Many Intel PCH Root Ports do provide ACS-like features to disable peer |
---|
4504 | 4579 | * transactions and validate bus numbers in requests, but do not provide an |
---|
4505 | 4580 | * actual PCIe ACS capability. This is the list of device IDs known to fall |
---|
.. | .. |
---|
4577 | 4652 | } |
---|
4578 | 4653 | |
---|
4579 | 4654 | /* |
---|
| 4655 | + * Each of these NXP Root Ports is in a Root Complex with a unique segment |
---|
| 4656 | + * number and does provide isolation features to disable peer transactions |
---|
| 4657 | + * and validate bus numbers in requests, but does not provide an ACS |
---|
| 4658 | + * capability. |
---|
| 4659 | + */ |
---|
| 4660 | +static int pci_quirk_nxp_rp_acs(struct pci_dev *dev, u16 acs_flags) |
---|
| 4661 | +{ |
---|
| 4662 | + return pci_acs_ctrl_enabled(acs_flags, |
---|
| 4663 | + PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); |
---|
| 4664 | +} |
---|
| 4665 | + |
---|
| 4666 | +static int pci_quirk_al_acs(struct pci_dev *dev, u16 acs_flags) |
---|
| 4667 | +{ |
---|
| 4668 | + if (pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT) |
---|
| 4669 | + return -ENOTTY; |
---|
| 4670 | + |
---|
| 4671 | + /* |
---|
| 4672 | + * Amazon's Annapurna Labs root ports don't include an ACS capability, |
---|
| 4673 | + * but do include ACS-like functionality. The hardware doesn't support |
---|
| 4674 | + * peer-to-peer transactions via the root port and each has a unique |
---|
| 4675 | + * segment number. |
---|
| 4676 | + * |
---|
| 4677 | + * Additionally, the root ports cannot send traffic to each other. |
---|
| 4678 | + */ |
---|
| 4679 | + acs_flags &= ~(PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); |
---|
| 4680 | + |
---|
| 4681 | + return acs_flags ? 0 : 1; |
---|
| 4682 | +} |
---|
| 4683 | + |
---|
| 4684 | +/* |
---|
4580 | 4685 | * Sunrise Point PCH root ports implement ACS, but unfortunately as shown in |
---|
4581 | 4686 | * the datasheet (Intel 100 Series Chipset Family PCH Datasheet, Vol. 2, |
---|
4582 | 4687 | * 12.1.46, 12.1.47)[1] this chipset uses dwords for the ACS capability and |
---|
.. | .. |
---|
4613 | 4718 | * |
---|
4614 | 4719 | * 0x9d10-0x9d1b PCI Express Root port #{1-12} |
---|
4615 | 4720 | * |
---|
4616 | | - * [1] http://www.intel.com/content/www/us/en/chipsets/100-series-chipset-datasheet-vol-2.html |
---|
4617 | | - * [2] http://www.intel.com/content/www/us/en/chipsets/100-series-chipset-datasheet-vol-1.html |
---|
4618 | | - * [3] http://www.intel.com/content/www/us/en/chipsets/100-series-chipset-spec-update.html |
---|
4619 | | - * [4] http://www.intel.com/content/www/us/en/chipsets/200-series-chipset-pch-spec-update.html |
---|
4620 | | - * [5] http://www.intel.com/content/www/us/en/chipsets/200-series-chipset-pch-datasheet-vol-1.html |
---|
| 4721 | + * [1] https://www.intel.com/content/www/us/en/chipsets/100-series-chipset-datasheet-vol-2.html |
---|
| 4722 | + * [2] https://www.intel.com/content/www/us/en/chipsets/100-series-chipset-datasheet-vol-1.html |
---|
| 4723 | + * [3] https://www.intel.com/content/www/us/en/chipsets/100-series-chipset-spec-update.html |
---|
| 4724 | + * [4] https://www.intel.com/content/www/us/en/chipsets/200-series-chipset-pch-spec-update.html |
---|
| 4725 | + * [5] https://www.intel.com/content/www/us/en/chipsets/200-series-chipset-pch-datasheet-vol-1.html |
---|
4621 | 4726 | * [6] https://www.intel.com/content/www/us/en/processors/core/7th-gen-core-family-mobile-u-y-processor-lines-i-o-spec-update.html |
---|
4622 | 4727 | * [7] https://www.intel.com/content/www/us/en/processors/core/7th-gen-core-family-mobile-u-y-processor-lines-i-o-datasheet-vol-1.html |
---|
4623 | 4728 | */ |
---|
.. | .. |
---|
4646 | 4751 | if (!pci_quirk_intel_spt_pch_acs_match(dev)) |
---|
4647 | 4752 | return -ENOTTY; |
---|
4648 | 4753 | |
---|
4649 | | - pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS); |
---|
| 4754 | + pos = dev->acs_cap; |
---|
4650 | 4755 | if (!pos) |
---|
4651 | 4756 | return -ENOTTY; |
---|
4652 | 4757 | |
---|
.. | .. |
---|
4699 | 4804 | */ |
---|
4700 | 4805 | return pci_acs_ctrl_enabled(acs_flags, |
---|
4701 | 4806 | PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); |
---|
| 4807 | +} |
---|
| 4808 | + |
---|
| 4809 | +/* |
---|
| 4810 | + * Wangxun 10G/1G NICs have no ACS capability, and on multi-function |
---|
| 4811 | + * devices, peer-to-peer transactions are not be used between the functions. |
---|
| 4812 | + * So add an ACS quirk for below devices to isolate functions. |
---|
| 4813 | + * SFxxx 1G NICs(em). |
---|
| 4814 | + * RP1000/RP2000 10G NICs(sp). |
---|
| 4815 | + */ |
---|
| 4816 | +static int pci_quirk_wangxun_nic_acs(struct pci_dev *dev, u16 acs_flags) |
---|
| 4817 | +{ |
---|
| 4818 | + switch (dev->device) { |
---|
| 4819 | + case 0x0100 ... 0x010F: |
---|
| 4820 | + case 0x1001: |
---|
| 4821 | + case 0x2001: |
---|
| 4822 | + return pci_acs_ctrl_enabled(acs_flags, |
---|
| 4823 | + PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF); |
---|
| 4824 | + } |
---|
| 4825 | + |
---|
| 4826 | + return false; |
---|
4702 | 4827 | } |
---|
4703 | 4828 | |
---|
4704 | 4829 | static const struct pci_dev_acs_enabled { |
---|
.. | .. |
---|
4775 | 4900 | /* QCOM QDF2xxx root ports */ |
---|
4776 | 4901 | { PCI_VENDOR_ID_QCOM, 0x0400, pci_quirk_qcom_rp_acs }, |
---|
4777 | 4902 | { PCI_VENDOR_ID_QCOM, 0x0401, pci_quirk_qcom_rp_acs }, |
---|
| 4903 | + /* HXT SD4800 root ports. The ACS design is same as QCOM QDF2xxx */ |
---|
| 4904 | + { PCI_VENDOR_ID_HXT, 0x0401, pci_quirk_qcom_rp_acs }, |
---|
4778 | 4905 | /* Intel PCH root ports */ |
---|
4779 | 4906 | { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_quirk_intel_pch_acs }, |
---|
4780 | 4907 | { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, pci_quirk_intel_spt_pch_acs }, |
---|
.. | .. |
---|
4799 | 4926 | { PCI_VENDOR_ID_AMPERE, 0xE00C, pci_quirk_xgene_acs }, |
---|
4800 | 4927 | /* Broadcom multi-function device */ |
---|
4801 | 4928 | { PCI_VENDOR_ID_BROADCOM, 0x16D7, pci_quirk_mf_endpoint_acs }, |
---|
| 4929 | + { PCI_VENDOR_ID_BROADCOM, 0x1750, pci_quirk_mf_endpoint_acs }, |
---|
| 4930 | + { PCI_VENDOR_ID_BROADCOM, 0x1751, pci_quirk_mf_endpoint_acs }, |
---|
| 4931 | + { PCI_VENDOR_ID_BROADCOM, 0x1752, pci_quirk_mf_endpoint_acs }, |
---|
4802 | 4932 | { PCI_VENDOR_ID_BROADCOM, 0xD714, pci_quirk_brcm_acs }, |
---|
| 4933 | + /* Amazon Annapurna Labs */ |
---|
| 4934 | + { PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031, pci_quirk_al_acs }, |
---|
| 4935 | + /* Zhaoxin multi-function devices */ |
---|
| 4936 | + { PCI_VENDOR_ID_ZHAOXIN, 0x3038, pci_quirk_mf_endpoint_acs }, |
---|
| 4937 | + { PCI_VENDOR_ID_ZHAOXIN, 0x3104, pci_quirk_mf_endpoint_acs }, |
---|
| 4938 | + { PCI_VENDOR_ID_ZHAOXIN, 0x9083, pci_quirk_mf_endpoint_acs }, |
---|
| 4939 | + /* NXP root ports, xx=16, 12, or 08 cores */ |
---|
| 4940 | + /* LX2xx0A : without security features + CAN-FD */ |
---|
| 4941 | + { PCI_VENDOR_ID_NXP, 0x8d81, pci_quirk_nxp_rp_acs }, |
---|
| 4942 | + { PCI_VENDOR_ID_NXP, 0x8da1, pci_quirk_nxp_rp_acs }, |
---|
| 4943 | + { PCI_VENDOR_ID_NXP, 0x8d83, pci_quirk_nxp_rp_acs }, |
---|
| 4944 | + /* LX2xx0C : security features + CAN-FD */ |
---|
| 4945 | + { PCI_VENDOR_ID_NXP, 0x8d80, pci_quirk_nxp_rp_acs }, |
---|
| 4946 | + { PCI_VENDOR_ID_NXP, 0x8da0, pci_quirk_nxp_rp_acs }, |
---|
| 4947 | + { PCI_VENDOR_ID_NXP, 0x8d82, pci_quirk_nxp_rp_acs }, |
---|
| 4948 | + /* LX2xx0E : security features + CAN */ |
---|
| 4949 | + { PCI_VENDOR_ID_NXP, 0x8d90, pci_quirk_nxp_rp_acs }, |
---|
| 4950 | + { PCI_VENDOR_ID_NXP, 0x8db0, pci_quirk_nxp_rp_acs }, |
---|
| 4951 | + { PCI_VENDOR_ID_NXP, 0x8d92, pci_quirk_nxp_rp_acs }, |
---|
| 4952 | + /* LX2xx0N : without security features + CAN */ |
---|
| 4953 | + { PCI_VENDOR_ID_NXP, 0x8d91, pci_quirk_nxp_rp_acs }, |
---|
| 4954 | + { PCI_VENDOR_ID_NXP, 0x8db1, pci_quirk_nxp_rp_acs }, |
---|
| 4955 | + { PCI_VENDOR_ID_NXP, 0x8d93, pci_quirk_nxp_rp_acs }, |
---|
| 4956 | + /* LX2xx2A : without security features + CAN-FD */ |
---|
| 4957 | + { PCI_VENDOR_ID_NXP, 0x8d89, pci_quirk_nxp_rp_acs }, |
---|
| 4958 | + { PCI_VENDOR_ID_NXP, 0x8da9, pci_quirk_nxp_rp_acs }, |
---|
| 4959 | + { PCI_VENDOR_ID_NXP, 0x8d8b, pci_quirk_nxp_rp_acs }, |
---|
| 4960 | + /* LX2xx2C : security features + CAN-FD */ |
---|
| 4961 | + { PCI_VENDOR_ID_NXP, 0x8d88, pci_quirk_nxp_rp_acs }, |
---|
| 4962 | + { PCI_VENDOR_ID_NXP, 0x8da8, pci_quirk_nxp_rp_acs }, |
---|
| 4963 | + { PCI_VENDOR_ID_NXP, 0x8d8a, pci_quirk_nxp_rp_acs }, |
---|
| 4964 | + /* LX2xx2E : security features + CAN */ |
---|
| 4965 | + { PCI_VENDOR_ID_NXP, 0x8d98, pci_quirk_nxp_rp_acs }, |
---|
| 4966 | + { PCI_VENDOR_ID_NXP, 0x8db8, pci_quirk_nxp_rp_acs }, |
---|
| 4967 | + { PCI_VENDOR_ID_NXP, 0x8d9a, pci_quirk_nxp_rp_acs }, |
---|
| 4968 | + /* LX2xx2N : without security features + CAN */ |
---|
| 4969 | + { PCI_VENDOR_ID_NXP, 0x8d99, pci_quirk_nxp_rp_acs }, |
---|
| 4970 | + { PCI_VENDOR_ID_NXP, 0x8db9, pci_quirk_nxp_rp_acs }, |
---|
| 4971 | + { PCI_VENDOR_ID_NXP, 0x8d9b, pci_quirk_nxp_rp_acs }, |
---|
| 4972 | + /* Zhaoxin Root/Downstream Ports */ |
---|
| 4973 | + { PCI_VENDOR_ID_ZHAOXIN, PCI_ANY_ID, pci_quirk_zhaoxin_pcie_ports_acs }, |
---|
| 4974 | + /* Wangxun nics */ |
---|
| 4975 | + { PCI_VENDOR_ID_WANGXUN, PCI_ANY_ID, pci_quirk_wangxun_nic_acs }, |
---|
4803 | 4976 | { 0 } |
---|
4804 | 4977 | }; |
---|
4805 | 4978 | |
---|
.. | .. |
---|
4873 | 5046 | if (!(rcba & INTEL_LPC_RCBA_ENABLE)) |
---|
4874 | 5047 | return -EINVAL; |
---|
4875 | 5048 | |
---|
4876 | | - rcba_mem = ioremap_nocache(rcba & INTEL_LPC_RCBA_MASK, |
---|
| 5049 | + rcba_mem = ioremap(rcba & INTEL_LPC_RCBA_MASK, |
---|
4877 | 5050 | PAGE_ALIGN(INTEL_UPDCR_REG)); |
---|
4878 | 5051 | if (!rcba_mem) |
---|
4879 | 5052 | return -ENOMEM; |
---|
.. | .. |
---|
4923 | 5096 | } |
---|
4924 | 5097 | } |
---|
4925 | 5098 | |
---|
| 5099 | +/* |
---|
| 5100 | + * Currently this quirk does the equivalent of |
---|
| 5101 | + * PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF |
---|
| 5102 | + * |
---|
| 5103 | + * TODO: This quirk also needs to do equivalent of PCI_ACS_TB, |
---|
| 5104 | + * if dev->external_facing || dev->untrusted |
---|
| 5105 | + */ |
---|
4926 | 5106 | static int pci_quirk_enable_intel_pch_acs(struct pci_dev *dev) |
---|
4927 | 5107 | { |
---|
4928 | 5108 | if (!pci_quirk_intel_pch_acs_match(dev)) |
---|
.. | .. |
---|
4950 | 5130 | if (!pci_quirk_intel_spt_pch_acs_match(dev)) |
---|
4951 | 5131 | return -ENOTTY; |
---|
4952 | 5132 | |
---|
4953 | | - pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS); |
---|
| 5133 | + pos = dev->acs_cap; |
---|
4954 | 5134 | if (!pos) |
---|
4955 | 5135 | return -ENOTTY; |
---|
4956 | 5136 | |
---|
.. | .. |
---|
4961 | 5141 | ctrl |= (cap & PCI_ACS_RR); |
---|
4962 | 5142 | ctrl |= (cap & PCI_ACS_CR); |
---|
4963 | 5143 | ctrl |= (cap & PCI_ACS_UF); |
---|
| 5144 | + |
---|
| 5145 | + if (dev->external_facing || dev->untrusted) |
---|
| 5146 | + ctrl |= (cap & PCI_ACS_TB); |
---|
4964 | 5147 | |
---|
4965 | 5148 | pci_write_config_dword(dev, pos + INTEL_SPT_ACS_CTRL, ctrl); |
---|
4966 | 5149 | |
---|
.. | .. |
---|
4977 | 5160 | if (!pci_quirk_intel_spt_pch_acs_match(dev)) |
---|
4978 | 5161 | return -ENOTTY; |
---|
4979 | 5162 | |
---|
4980 | | - pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS); |
---|
| 5163 | + pos = dev->acs_cap; |
---|
4981 | 5164 | if (!pos) |
---|
4982 | 5165 | return -ENOTTY; |
---|
4983 | 5166 | |
---|
.. | .. |
---|
5150 | 5333 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AMD, 0x1487, quirk_no_flr); |
---|
5151 | 5334 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AMD, 0x148c, quirk_no_flr); |
---|
5152 | 5335 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AMD, 0x149c, quirk_no_flr); |
---|
| 5336 | +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AMD, 0x7901, quirk_no_flr); |
---|
5153 | 5337 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1502, quirk_no_flr); |
---|
5154 | 5338 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1503, quirk_no_flr); |
---|
5155 | 5339 | |
---|
.. | .. |
---|
5354 | 5538 | bool found; |
---|
5355 | 5539 | struct pci_dev *bridge = bus->self; |
---|
5356 | 5540 | |
---|
5357 | | - pos = pci_find_ext_capability(bridge, PCI_EXT_CAP_ID_ACS); |
---|
| 5541 | + pos = bridge->acs_cap; |
---|
5358 | 5542 | |
---|
5359 | 5543 | /* Disable ACS SV before initial config reads */ |
---|
5360 | 5544 | if (pos) { |
---|
.. | .. |
---|
5389 | 5573 | void __iomem *mmio; |
---|
5390 | 5574 | struct ntb_info_regs __iomem *mmio_ntb; |
---|
5391 | 5575 | struct ntb_ctrl_regs __iomem *mmio_ctrl; |
---|
5392 | | - struct sys_info_regs __iomem *mmio_sys_info; |
---|
5393 | 5576 | u64 partition_map; |
---|
5394 | 5577 | u8 partition; |
---|
5395 | 5578 | int pp; |
---|
.. | .. |
---|
5410 | 5593 | |
---|
5411 | 5594 | mmio_ntb = mmio + SWITCHTEC_GAS_NTB_OFFSET; |
---|
5412 | 5595 | mmio_ctrl = (void __iomem *) mmio_ntb + SWITCHTEC_NTB_REG_CTRL_OFFSET; |
---|
5413 | | - mmio_sys_info = mmio + SWITCHTEC_GAS_SYS_INFO_OFFSET; |
---|
5414 | 5596 | |
---|
5415 | 5597 | partition = ioread8(&mmio_ntb->partition_id); |
---|
5416 | 5598 | |
---|
.. | .. |
---|
5452 | 5634 | pci_dbg(pdev, |
---|
5453 | 5635 | "Aliasing Partition %d Proxy ID %02x.%d\n", |
---|
5454 | 5636 | pp, PCI_SLOT(devfn), PCI_FUNC(devfn)); |
---|
5455 | | - pci_add_dma_alias(pdev, devfn); |
---|
| 5637 | + pci_add_dma_alias(pdev, devfn, 1); |
---|
5456 | 5638 | } |
---|
5457 | 5639 | } |
---|
5458 | 5640 | |
---|
.. | .. |
---|
5493 | 5675 | SWITCHTEC_QUIRK(0x8574); /* PFXI 64XG3 */ |
---|
5494 | 5676 | SWITCHTEC_QUIRK(0x8575); /* PFXI 80XG3 */ |
---|
5495 | 5677 | SWITCHTEC_QUIRK(0x8576); /* PFXI 96XG3 */ |
---|
| 5678 | +SWITCHTEC_QUIRK(0x4000); /* PFX 100XG4 */ |
---|
| 5679 | +SWITCHTEC_QUIRK(0x4084); /* PFX 84XG4 */ |
---|
| 5680 | +SWITCHTEC_QUIRK(0x4068); /* PFX 68XG4 */ |
---|
| 5681 | +SWITCHTEC_QUIRK(0x4052); /* PFX 52XG4 */ |
---|
| 5682 | +SWITCHTEC_QUIRK(0x4036); /* PFX 36XG4 */ |
---|
| 5683 | +SWITCHTEC_QUIRK(0x4028); /* PFX 28XG4 */ |
---|
| 5684 | +SWITCHTEC_QUIRK(0x4100); /* PSX 100XG4 */ |
---|
| 5685 | +SWITCHTEC_QUIRK(0x4184); /* PSX 84XG4 */ |
---|
| 5686 | +SWITCHTEC_QUIRK(0x4168); /* PSX 68XG4 */ |
---|
| 5687 | +SWITCHTEC_QUIRK(0x4152); /* PSX 52XG4 */ |
---|
| 5688 | +SWITCHTEC_QUIRK(0x4136); /* PSX 36XG4 */ |
---|
| 5689 | +SWITCHTEC_QUIRK(0x4128); /* PSX 28XG4 */ |
---|
| 5690 | +SWITCHTEC_QUIRK(0x4200); /* PAX 100XG4 */ |
---|
| 5691 | +SWITCHTEC_QUIRK(0x4284); /* PAX 84XG4 */ |
---|
| 5692 | +SWITCHTEC_QUIRK(0x4268); /* PAX 68XG4 */ |
---|
| 5693 | +SWITCHTEC_QUIRK(0x4252); /* PAX 52XG4 */ |
---|
| 5694 | +SWITCHTEC_QUIRK(0x4236); /* PAX 36XG4 */ |
---|
| 5695 | +SWITCHTEC_QUIRK(0x4228); /* PAX 28XG4 */ |
---|
| 5696 | + |
---|
| 5697 | +/* |
---|
| 5698 | + * The PLX NTB uses devfn proxy IDs to move TLPs between NT endpoints. |
---|
| 5699 | + * These IDs are used to forward responses to the originator on the other |
---|
| 5700 | + * side of the NTB. Alias all possible IDs to the NTB to permit access when |
---|
| 5701 | + * the IOMMU is turned on. |
---|
| 5702 | + */ |
---|
| 5703 | +static void quirk_plx_ntb_dma_alias(struct pci_dev *pdev) |
---|
| 5704 | +{ |
---|
| 5705 | + pci_info(pdev, "Setting PLX NTB proxy ID aliases\n"); |
---|
| 5706 | + /* PLX NTB may use all 256 devfns */ |
---|
| 5707 | + pci_add_dma_alias(pdev, 0, 256); |
---|
| 5708 | +} |
---|
| 5709 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_PLX, 0x87b0, quirk_plx_ntb_dma_alias); |
---|
| 5710 | +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_PLX, 0x87b1, quirk_plx_ntb_dma_alias); |
---|
5496 | 5711 | |
---|
5497 | 5712 | /* |
---|
5498 | 5713 | * On Lenovo Thinkpad P50 SKUs with a Nvidia Quadro M1000M, the BIOS does |
---|
.. | .. |
---|
5564 | 5779 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASMEDIA, 0x2142, pci_fixup_no_d0_pme); |
---|
5565 | 5780 | |
---|
5566 | 5781 | /* |
---|
5567 | | - * Device [12d8:0x400e] and [12d8:0x400f] |
---|
| 5782 | + * Device 12d8:0x400e [OHCI] and 12d8:0x400f [EHCI] |
---|
| 5783 | + * |
---|
5568 | 5784 | * These devices advertise PME# support in all power states but don't |
---|
5569 | 5785 | * reliably assert it. |
---|
| 5786 | + * |
---|
| 5787 | + * These devices also advertise MSI, but documentation (PI7C9X440SL.pdf) |
---|
| 5788 | + * says "The MSI Function is not implemented on this device" in chapters |
---|
| 5789 | + * 7.3.27, 7.3.29-7.3.31. |
---|
5570 | 5790 | */ |
---|
5571 | | -static void pci_fixup_no_pme(struct pci_dev *dev) |
---|
| 5791 | +static void pci_fixup_no_msi_no_pme(struct pci_dev *dev) |
---|
5572 | 5792 | { |
---|
| 5793 | +#ifdef CONFIG_PCI_MSI |
---|
| 5794 | + pci_info(dev, "MSI is not implemented on this device, disabling it\n"); |
---|
| 5795 | + dev->no_msi = 1; |
---|
| 5796 | +#endif |
---|
5573 | 5797 | pci_info(dev, "PME# is unreliable, disabling it\n"); |
---|
5574 | 5798 | dev->pme_support = 0; |
---|
5575 | 5799 | } |
---|
5576 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_PERICOM, 0x400e, pci_fixup_no_pme); |
---|
5577 | | -DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_PERICOM, 0x400f, pci_fixup_no_pme); |
---|
| 5800 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_PERICOM, 0x400e, pci_fixup_no_msi_no_pme); |
---|
| 5801 | +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_PERICOM, 0x400f, pci_fixup_no_msi_no_pme); |
---|
5578 | 5802 | |
---|
5579 | 5803 | static void apex_pci_fixup_class(struct pci_dev *pdev) |
---|
5580 | 5804 | { |
---|