Lines Matching +full:vp3 +full:- +full:supply
1 // SPDX-License-Identifier: GPL-2.0
3 * This file contains work-arounds for many known PCI hardware bugs.
5 * should be handled in arch-specific code.
20 #include <linux/isa-dma.h> /* isa_dma_bridge_buggy */
91 int ret = -ENOTTY;
94 !pcie_cap_has_lnkctl2(dev) || !dev->link_active_reporting)
103 pci_info(dev, "broken device, retraining non-functional downstream link at 2.5GT/s\n");
170 if ((f->class == (u32) (dev->class >> f->class_shift) ||
171 f->class == (u32) PCI_ANY_ID) &&
172 (f->vendor == dev->vendor ||
173 f->vendor == (u16) PCI_ANY_ID) &&
174 (f->device == dev->device ||
175 f->device == (u16) PCI_ANY_ID)) {
178 hook = offset_to_ptr(&f->hook_offset);
180 hook = f->hook;
306 * key system devices. For devices that need to have mmio decoding always-on,
307 * we need to set the dev->mmio_always_on bit.
311 dev->mmio_always_on = 1;
350 * The VIA VP2/VP3/MVP3 seem to have some 'features'. There may be a
352 * contacts at VIA ask them for me please -- Alan
399 /* Chipsets where PCI->PCI transfers vanish or hang */
437 * Made according to a Windows driver-based patch by George E. Breese;
439 * Also see http://www.au-ja.org/review-kt133a-1-en.phtml for the info on
458 * 0x40 - 0x4f == 686B, 0x10 - 0x2f == 686A;
462 if (p->revision < 0x40 || p->revision > 0x42)
470 if (p->revision < 0x10 || p->revision > 0x12)
507 /* VIA Apollo VP3 needs ETBF on BT848/878 */
562 dev->cfg_size = 0xA0;
572 dev->cfg_size = 0x600;
585 struct resource *r = &dev->resource[i];
587 if (r->flags & IORESOURCE_MEM && resource_size(r) < PAGE_SIZE) {
588 r->end = PAGE_SIZE - 1;
589 r->start = 0;
590 r->flags |= IORESOURCE_UNSET;
600 * If it's needed, re-allocate the region.
604 struct resource *r = &dev->resource[0];
606 if ((r->start & 0x3ffffff) || r->end != r->start + 0x3ffffff) {
607 r->flags |= IORESOURCE_UNSET;
608 r->start = 0;
609 r->end = 0x3ffffff;
620 struct resource *res = dev->resource + pos;
627 res->name = pci_name(dev);
628 res->flags = region & ~PCI_BASE_ADDRESS_IO_MASK;
629 res->flags |=
631 region &= ~(size - 1);
635 bus_region.end = region + size - 1;
636 pcibios_bus_to_resource(dev->bus, res, &bus_region);
648 * CS553x's ISA PCI BARs may also be read-only (ref:
649 * https://bugzilla.kernel.org/show_bug.cgi?id=85991 - Comment #4 forward).
670 struct resource *res = dev->resource + nr;
673 region &= ~(size - 1);
678 res->name = pci_name(dev);
679 res->flags = IORESOURCE_IO;
683 bus_region.end = region + size - 1;
684 pcibios_bus_to_resource(dev->bus, res, &bus_region);
692 * between 0x3b0->0x3bb or read 0x3d3
716 u32 class = pdev->class;
720 pdev->class = PCI_CLASS_SERIAL_USB_DEVICE;
722 "PCI class overridden (%#08x -> %#08x) so dwc3 driver can claim this instead of xhci\n",
723 class, pdev->class);
734 * devices should use dwc3-haps driver. Change these devices' class code to
735 * PCI_CLASS_SERIAL_USB_DEVICE to prevent the xhci-pci driver from claiming
740 u32 class = pdev->class;
742 switch (pdev->device) {
746 pdev->class = PCI_CLASS_SERIAL_USB_DEVICE;
747 pci_info(pdev, "PCI class overridden (%#08x -> %#08x) so dwc3 driver can claim this instead of xhci\n",
748 class, pdev->class);
795 base &= -size;
796 pci_info(dev, "%s PIO at %04x-%04x\n", name, base, base + size - 1);
821 base &= -size;
822 pci_info(dev, "%s MMIO at %04x-%04x\n", name, base, base + size - 1);
874 * ICH4, ICH4-M, ICH5, ICH5-M ACPI: Three IO regions pointed to by longwords at
948 base &= ~(size-1);
954 pci_info(dev, "%s PIO at %04x-%04x\n", name, base, base+size-1);
962 /* ICH6-specific generic IO decode */
981 /* IO base in bits 15:2, mask in bits 23:18, both are dword-based */
993 /* ICH7-10 has the same common LPC generic IO decode registers */
1025 if (dev->revision & 0x10)
1042 "vt82c686 HW-mon");
1061 * TI XIO2000a PCIe-PCI Bridge erroneously reports it supports fast
1062 * back-to-back: Disable fast back-to-back on the secondary bus segment
1069 pci_warn(dev, "TI XIO2000a quirk detected; secondary bus fast back-to-back transfers disabled\n");
1070 list_for_each_entry(pdev, &dev->subordinate->devices, bus_list) {
1084 * VIA 686A/B: If an IO-APIC is active, we need to route all on-chip
1087 * TODO: When we have device-specific interrupt routers, this code will go
1097 tmp = 0x1f; /* all known bits (4-0) routed to external APIC */
1109 * VIA 8237: Some BIOSes don't set the 'Bypass APIC De-Assert Message' Bit.
1121 pci_info(dev, "Bypassing VIA 8237 APIC De-Assert Message\n");
1129 * The AMD IO-APIC can hang the box when an APIC IRQ is masked.
1139 if (dev->revision >= 0x02) {
1151 /* Fix for improper SR-IOV configuration on Cavium cn88xx RNM device */
1152 if (dev->subsystem_device == 0xa118)
1153 dev->sriov->link = dev->devfn;
1160 * See AMD 8131 HyperTransport PCI-X Tunnel Revision Guide
1164 if (dev->subordinate && dev->revision <= 0x12) {
1165 pci_info(dev, "AMD8131 rev %x detected; disabling PCI-X MMRBC\n",
1166 dev->revision);
1167 dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MMRBC;
1177 * -jgarzik
1187 d->irq = irq;
1193 static int via_vlink_dev_lo = -1, via_vlink_dev_hi = 18;
1198 switch (dev->device) {
1205 via_vlink_dev_lo = PCI_SLOT(dev->devfn);
1206 via_vlink_dev_hi = PCI_SLOT(dev->devfn);
1233 * quirk_via_vlink - VIA VLink IRQ number update
1248 if (via_vlink_dev_lo == -1)
1251 new_irq = dev->irq;
1258 if (dev->bus->number != 0 || PCI_SLOT(dev->devfn) > via_vlink_dev_hi ||
1259 PCI_SLOT(dev->devfn) < via_vlink_dev_lo)
1284 pci_read_config_word(dev, PCI_DEVICE_ID, &dev->device);
1327 * DreamWorks-provided workaround for Dunord I-3000 problem
1335 struct resource *r = &dev->resource[1];
1337 r->flags |= IORESOURCE_UNSET;
1338 r->start = 0;
1339 r->end = 0xffffff;
1344 * i82380FB mobile docking controller: its PCI-to-PCI bridge is subtractive
1346 * Unfortunately, the ProgIf value is wrong - 0x80 instead of 0x01.
1350 dev->transparent = 1;
1385 if (pdev->revision != 0x04) /* Only C0 requires this */
1399 /* set SBX00/Hudson-2 SATA in IDE mode to AHCI mode */
1410 pdev->class = PCI_CLASS_STORAGE_SATA_AHCI;
1430 pdev->class &= ~5;
1437 /* Intel 82801CAM ICH3-M datasheet says IDE modes must be the same */
1447 pdev->class &= ~5;
1456 pdev->dev_flags |= PCI_DEV_FLAGS_NO_D3;
1472 * This was originally an Alpha-specific thing, but it really fits here.
1473 * The i82375 PCI/EISA bridge appears as non-classified. Fix that.
1477 dev->class = PCI_CLASS_BRIDGE_EISA << 8;
1490 * becomes necessary to do this tweak in two steps -- the chosen trigger
1491 * is either the Host bridge (preferred) or on-board VGA controller.
1504 * the DSDT and double-check that there is no code accessing the SMBus.
1510 if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK)) {
1511 if (dev->device == PCI_DEVICE_ID_INTEL_82845_HB)
1512 switch (dev->subsystem_device) {
1513 case 0x8025: /* P4B-LX */
1519 else if (dev->device == PCI_DEVICE_ID_INTEL_82845G_HB)
1520 switch (dev->subsystem_device) {
1521 case 0x80b1: /* P4GE-V */
1523 case 0x8093: /* P4B533-V */
1526 else if (dev->device == PCI_DEVICE_ID_INTEL_82850_HB)
1527 switch (dev->subsystem_device) {
1531 else if (dev->device == PCI_DEVICE_ID_INTEL_7205_0)
1532 switch (dev->subsystem_device) {
1536 else if (dev->device == PCI_DEVICE_ID_INTEL_E7501_MCH)
1537 switch (dev->subsystem_device) {
1538 case 0x80c9: /* PU-DLS */
1541 else if (dev->device == PCI_DEVICE_ID_INTEL_82855GM_HB)
1542 switch (dev->subsystem_device) {
1548 else if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
1549 switch (dev->subsystem_device) {
1554 else if (dev->device == PCI_DEVICE_ID_INTEL_82865_HB)
1555 switch (dev->subsystem_device) {
1556 case 0x80f2: /* P4P800-X */
1559 else if (dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB)
1560 switch (dev->subsystem_device) {
1565 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_HP)) {
1566 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
1567 switch (dev->subsystem_device) {
1572 else if (dev->device == PCI_DEVICE_ID_INTEL_82865_HB)
1573 switch (dev->subsystem_device) {
1579 else if (dev->device == PCI_DEVICE_ID_INTEL_82875_HB)
1580 switch (dev->subsystem_device) {
1584 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) {
1585 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
1586 switch (dev->subsystem_device) {
1590 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ)) {
1591 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
1592 switch (dev->subsystem_device) {
1596 else if (dev->device == PCI_DEVICE_ID_INTEL_82810_IG3)
1597 switch (dev->subsystem_device) {
1598 case 0xB16C: /* Compaq Deskpro EP 401963-001 (PCA# 010174) */
1601 * its on-board VGA controller */
1604 else if (dev->device == PCI_DEVICE_ID_INTEL_82801DB_2)
1605 switch (dev->subsystem_device) {
1610 * subvendor/subdevice IDs and on-board VGA
1616 else if (dev->device == PCI_DEVICE_ID_INTEL_82815_CGC)
1617 switch (dev->subsystem_device) {
1621 * its on-board VGA controller */
1773 dev->device = devid;
1783 * -- bjd
1790 if (likely(dev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK)) {
1791 if (dev->device == PCI_DEVICE_ID_VIA_8237)
1824 if (PCI_FUNC(pdev->devfn))
1830 conf1 &= ~0x00CFF302; /* Clear bit 1, 8, 9, 12-19, 22, 23 */
1833 switch (pdev->device) {
1865 pdev->hdr_type = hdr & 0x7f;
1866 pdev->multifunction = !!(hdr & 0x80);
1869 pdev->class = class >> 8;
1894 if (dev->multifunction) {
1895 device_disable_async_suspend(&dev->dev);
1896 pci_info(dev, "async suspend disabled to avoid multi-function power-on ordering issue\n");
1909 if ((pdev->class >> 8) != 0xff00)
1913 * The first BAR is the location of the IO-APIC... we must
1918 insert_resource(&iomem_resource, &pdev->resource[0]);
1925 memset(&pdev->resource[i], 0, sizeof(pdev->resource[i]));
1933 dev->no_msi = 1;
1944 pdev->no_msi = 1;
1955 * SMMU stall feature, by setting dma-can-stall for ACPI platforms.
1958 * break the PCI requirement for free-flowing writes and may lead to
1960 * be fault-tolerant, so there's no ACPI binding to describe anything else,
1967 PROPERTY_ENTRY_BOOL("dma-can-stall"),
1971 if (pdev->revision != 0x21 && pdev->revision != 0x30)
1974 pdev->pasid_no_tlp = 1;
1977 * Set the dma-can-stall property on ACPI platforms. Device tree
1980 if (!pdev->dev.of_node &&
1981 device_create_managed_software_node(&pdev->dev, properties, NULL))
1993 * together on certain PXH-based systems.
1997 dev->no_msi = 1;
2013 dev->no_d1d2 = 1;
2039 if (dev->d3hot_delay >= delay)
2042 dev->d3hot_delay = delay;
2043 pci_info(dev, "extending delay after power-on from D3hot to %d msec\n",
2044 dev->d3hot_delay);
2049 if (dev->subsystem_vendor == PCI_VENDOR_ID_APPLE &&
2050 dev->subsystem_device == 0x00e2)
2056 * NVIDIA Ampere-based HDA controllers can wedge the whole device if a bus
2074 * remain on in D3hot state. The D3hot-to-D0 transition then requires an
2089 pr_info("%s detected: disable boot interrupt reroute\n", d->ident);
2100 .ident = "ASUSTek Computer INC. M2N-LR",
2103 DMI_MATCH(DMI_PRODUCT_NAME, "M2N-LR"),
2121 dev->irq_reroute_variant = INTEL_IRQ_REROUTE_VARIANT;
2123 dev->vendor, dev->device);
2148 * IO-APIC1 on 6300ESB generates boot interrupts, see Intel order no
2149 * 300641-004US, section 5.7.3.
2151 * Core IO on Xeon E5 1600/2600/4600, see Intel order no 326509-003.
2152 * Core IO on Xeon E5 v2, see Intel order no 329188-003.
2153 * Core IO on Xeon E7 v2, see Intel order no 329595-002.
2154 * Core IO on Xeon E5 v3, see Intel order no 330784-003.
2155 * Core IO on Xeon E7 v3, see Intel order no 332315-001US.
2156 * Core IO on Xeon E5 v4, see Intel order no 333810-002US.
2157 * Core IO on Xeon E7 v4, see Intel order no 332315-001US.
2158 * Core IO on Xeon D-1500, see Intel order no 332051-001.
2175 switch (dev->device) {
2186 case 0x6f28: /* Xeon D-1500 */
2198 dev->vendor, dev->device);
2201 * Device 29 Func 5 Device IDs of IO-APIC
2237 /* Disable boot interrupts on HT-1000 */
2263 dev->vendor, dev->device);
2272 * rev. A0 and B0, NOIOAMODE needs to be disabled anyway to fix IO-APIC mode
2286 if ((dev->revision == AMD_813X_REV_B1) ||
2287 (dev->revision == AMD_813X_REV_B2))
2295 dev->vendor, dev->device);
2314 dev->vendor, dev->device);
2319 dev->vendor, dev->device);
2326 * Toshiba TC86C001 IDE controller reports the standard 8-byte BAR0 size
2328 * Re-allocate the region if needed...
2332 struct resource *r = &dev->resource[0];
2334 if (r->start & 0x8) {
2335 r->flags |= IORESOURCE_UNSET;
2336 r->start = 0;
2337 r->end = 0xf;
2349 * Re-allocate the regions to a 256-byte boundary if necessary.
2356 if (dev->revision >= 2)
2361 struct resource *r = &dev->resource[bar];
2362 pci_info(dev, "Re-allocating PLX PCI 9050 BAR %u to length 256 to avoid bit 7 bug\n",
2364 r->flags |= IORESOURCE_UNSET;
2365 r->start = 0;
2366 r->end = 0xff;
2385 unsigned int num_parallel = (dev->subsystem_device & 0xf0) >> 4;
2386 unsigned int num_serial = dev->subsystem_device & 0xf;
2398 switch (dev->device) {
2401 if (dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
2402 dev->subsystem_device == 0x0299)
2411 dev->device, num_parallel, num_serial);
2412 dev->class = (PCI_CLASS_COMMUNICATION_OTHER << 8) |
2413 (dev->class & 0xff);
2426 switch (dev->device) {
2451 * re-enable them when it's ready.
2462 if (dev->pm_cap) {
2463 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
2517 * ASM1083/1085 PCIe-PCI bridge devices cause AER timeout errors on the
2524 * Some Pericom PCIe-to-PCI bridges in reverse mode need the PCIe Retrain
2533 dev->clear_retrain_link = 1;
2542 u32 class = dev->class;
2551 dev->class = PCI_CLASS_STORAGE_SCSI << 8;
2552 pci_info(dev, "NCR 53c810 rev 1 PCI class overridden (%#08x -> %#08x)\n",
2553 class, dev->class);
2566 dev->io_window_1k = 1;
2600 * VT6212L is found -- the CX700 core itself also contains a USB
2610 * p should contain the first (internal) VT6212L -- see if we have
2632 /* Set PCI Master Bus time-out to "1x16 PCLK" */
2664 * DRBs - this is where we expose device 6.
2665 * http://www.x86-secret.com/articles/tweak/pat/patsecrets-2.htm
2707 if (dev->subordinate) {
2709 dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
2726 apc_bridge = pci_get_slot(host_bridge->bus, PCI_DEVFN(1, 0));
2728 if (apc_bridge->device == 0x9602)
2745 while (pos && ttl--) {
2783 pdev = pci_get_slot(dev->bus, 0);
2799 while (pos && ttl--) {
2820 * The P5N32-SLI motherboards from Asus have a problem with MSI
2829 (strstr(board_name, "P5N32-SLI PREMIUM") ||
2830 strstr(board_name, "P5N32-E SLI"))) {
2831 pci_info(dev, "Disabling MSI for MCP55 NIC on P5N32-SLI\n");
2832 dev->no_msi = 1;
2840 * PCIe spec r6.0 sec 6.1.4.3 says that if MSI/MSI-X is enabled, the device
2845 * INTx and MSI/MSI-X, it is required to disable MSI interrupts to avoid port
2850 dev->no_msi = 1;
2940 while (pos && ttl--) {
2968 dev_no = host_bridge->devfn >> 3;
2970 dev = pci_get_slot(host_bridge->bus, PCI_DEVFN(i, 0));
3026 dev_no = dev->devfn >> 3;
3027 for (i = dev_no; i >= 0; i--) {
3028 host_bridge = pci_get_slot(dev->bus, PCI_DEVFN(i, 0));
3063 while (pos && ttl--) {
3096 * a non-HyperTransport host bridge. Locate the host bridge.
3098 host_bridge = pci_get_domain_bus_and_slot(pci_domain_nr(dev->bus), 0,
3145 dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG;
3162 if ((p->revision < 0x3B) && (p->revision >= 0x30))
3163 dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG;
3170 if (dev->revision < 0x18) {
3172 dev->dev_flags |= PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG;
3236 * Amazon's Annapurna Labs 1c36:0031 Root Ports don't support MSI-X, so it
3240 * tested), since currently there is no standard way to disable only MSI-X.
3247 dev->no_msi = 1;
3248 pci_warn(dev, "Disabling MSI/MSI-X\n");
3256 * pci=hpmemsize=nnM and pci=hpiosize=nnM parameters. For some PCI-PCI
3263 dev->is_hotplug_bridge = 1;
3280 * MMC controller - so the SDHCI driver never sees them.
3304 if (PCI_FUNC(dev->devfn))
3335 if (PCI_FUNC(dev->devfn))
3342 * 0x150 - SD2.0 mode enable for changing base clock
3344 * 0xe1 - Base clock frequency
3345 * 0x32 - 50Mhz new clock frequency
3346 * 0xf9 - Key register for 0x150
3347 * 0xfc - key register for 0xe1
3349 if (dev->device == PCI_DEVICE_ID_RICOH_R5CE822 ||
3350 dev->device == PCI_DEVICE_ID_RICOH_R5CE823) {
3387 * This is a quirk for masking VT-d spec-defined errors to platform error
3390 * on the RAS config settings of the platform) when a VT-d fault happens.
3393 * VT-d spec-related errors are already handled by the VT-d OS code, so no
3409 u32 class = dev->class;
3412 dev->class = PCI_CLASS_MULTIMEDIA_VIDEO << 8;
3413 pci_info(dev, "PCI class overridden (%#08x -> %#08x)\n",
3414 class, dev->class);
3425 dev->pcie_mpss = 1; /* 256 bytes */
3440 * coalescing must be disabled. Unfortunately, it cannot be re-enabled because
3476 /* Intel 5000 series memory controllers and ports 2-7 */
3491 /* Intel 5100 series memory controllers and ports 2-7 */
3518 dev->resource[2].end = dev->resource[2].start + ((u64) 1 << val) - 1;
3524 dev->resource[4].end = dev->resource[4].start + ((u64) 1 << val) - 1;
3533 * and the interrupt ends up -somewhere-.
3573 dev->d3hot_delay = 0;
3579 /* Lynxpoint-H PCH devices do not need 10ms d3hot_delay */
3609 dev->broken_intx_masking = 1;
3624 * RTL8110SC - Fails under PCI device assignment using DisINTx masking.
3631 * DisINTx can be set but the interrupt status bit is non-functional.
3671 * Check ConnectX-4/LX FW version to see if it supports legacy interrupts.
3687 if (pdev->device == mellanox_broken_intx_devs[i]) {
3688 pdev->broken_intx_masking = 1;
3694 * Getting here means Connect-IB cards and up. Connect-IB has no INTx
3697 if (pdev->device == PCI_DEVICE_ID_MELLANOX_CONNECTIB)
3700 if (pdev->device != PCI_DEVICE_ID_MELLANOX_CONNECTX4 &&
3701 pdev->device != PCI_DEVICE_ID_MELLANOX_CONNECTX4_LX)
3704 /* For ConnectX-4 and ConnectX-4LX, need to check FW support */
3712 pci_warn(pdev, "Can't map ConnectX-4 initialization segment\n");
3724 pci_warn(pdev, "ConnectX-4: FW %u.%u.%u doesn't support INTx masking, disabling. Please upgrade FW to %d.14.1100 and up for INTx support\n",
3725 fw_major, fw_minor, fw_subminor, pdev->device ==
3727 pdev->broken_intx_masking = 1;
3740 dev->dev_flags |= PCI_DEV_FLAGS_NO_BUS_RESET;
3749 if ((dev->device & 0xffc0) == 0x2340)
3757 * The device will throw a Link Down error on AER-capable systems and
3792 if (!pci_is_root_bus(dev->bus))
3793 dev->dev_flags |= PCI_DEV_FLAGS_NO_PM_RESET;
3797 * Some AMD/ATI GPUS (HD8570 - Oland) report that a D3hot->D0 transition
3798 * causes a reset (i.e., they advertise NoSoftRst-). This transition seems
3808 * Spectrum-{1,2,3,4} devices report that a D3hot->D0 transition causes a reset
3809 * (i.e., they advertise NoSoftRst-). However, this transition does not have
3827 if (pdev->is_hotplug_bridge &&
3828 (pdev->device != PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C ||
3829 pdev->revision <= 1))
3830 pdev->no_msi = 1;
3877 bridge = ACPI_HANDLE(&dev->dev);
3908 * Following are device-specific reset methods which can be used to
3909 * reset a single function if other methods (e.g. FLR, PM D0->D3) are
3915 * http://www.intel.com/content/dam/doc/datasheet/82599-10-gbe-controller-datasheet.pdf
3945 return -ENOMEM;
3976 /* Device-specific reset method for Chelsio T4-based adapters */
3983 * If this isn't a Chelsio T4-based device, return -ENOTTY indicating
3984 * that we have no device-specific reset method.
3986 if ((dev->device & 0xf000) != 0x4000)
3987 return -ENOTTY;
4013 * T4 also suffers a Head-Of-Line blocking problem if MSI-X interrupts
4014 * are disabled when an MSI-X interrupt message needs to be delivered.
4015 * So we briefly re-enable MSI-X interrupts for the duration of the
4017 * MSI-X state.
4019 pci_read_config_word(dev, dev->msix_cap+PCI_MSIX_FLAGS, &msix_flags);
4021 pci_write_config_word(dev, dev->msix_cap+PCI_MSIX_FLAGS,
4044 * FLR where config space reads from the device return -1. We seem to be
4061 if (dev->class != PCI_CLASS_STORAGE_EXPRESS ||
4063 return -ENOTTY;
4070 return -ENOTTY;
4149 /* Device-specific reset method for Huawei Intelligent NIC virtual functions */
4161 return -ENOTTY;
4167 return -ENOTTY;
4224 * These device-specific reset methods are here rather than in a driver
4232 for (i = pci_dev_reset_methods; i->reset; i++) {
4233 if ((i->vendor == dev->vendor ||
4234 i->vendor == (u16)PCI_ANY_ID) &&
4235 (i->device == dev->device ||
4236 i->device == (u16)PCI_ANY_ID))
4237 return i->reset(dev, probe);
4240 return -ENOTTY;
4245 if (PCI_FUNC(dev->devfn) != 0)
4246 pci_add_dma_alias(dev, PCI_DEVFN(PCI_SLOT(dev->devfn), 0), 1);
4263 if (PCI_FUNC(dev->devfn) != 1)
4264 pci_add_dma_alias(dev, PCI_DEVFN(PCI_SLOT(dev->devfn), 1), 1);
4322 DECLARE_PCI_FIXUP_HEADER(0x1c28, /* Lite-On */
4332 * processor. To software, this appears as a PCIe-to-PCI/X bridge with a
4357 pci_add_dma_alias(dev, id->driver_data, 1);
4362 * A few PCIe-to-PCI bridges fail to expose a PCIe capability, resulting in
4367 * is for a non-root, non-PCIe bridge where the upstream device is PCIe and
4368 * is not a PCIe-to-PCI bridge, then @pdev is actually a PCIe-to-PCI bridge.
4372 if (!pci_is_root_bus(pdev->bus) &&
4373 pdev->hdr_type == PCI_HEADER_TYPE_BRIDGE &&
4374 !pci_is_pcie(pdev) && pci_is_pcie(pdev->bus->self) &&
4375 pci_pcie_type(pdev->bus->self) != PCI_EXP_TYPE_PCI_BRIDGE)
4376 pdev->dev_flags |= PCI_DEV_FLAG_PCIE_BRIDGE_ALIAS;
4393 * when IOMMU is enabled. Following devfns have to match RIT-LUT table
4406 * Intel Visual Compute Accelerator (VCA) is a family of PCIe add-in devices
4441 pdev->dev_flags |= PCI_DEV_FLAGS_BRIDGE_XLATE_ROOT;
4449 * Intersil/Techwell TW686[4589]-based video capture cards have an empty (zero)
4454 u32 class = pdev->class;
4457 pdev->class = (PCI_CLASS_MULTIMEDIA_OTHER << 8) | 0x01;
4458 pci_info(pdev, "TW686x PCI class overridden (%#08x -> %#08x)\n",
4459 class, pdev->class);
4477 dev->dev_flags |= PCI_DEV_FLAGS_NO_RELAXED_ORDERING;
4560 * Per PCIe r3.0, sec 2.2.9, "Completion headers must supply the same
4564 * If a non-compliant device generates a completion with a different
4566 * seems non-compliant based on sec 2.3.2), or it may handle it as a
4570 * If the non-compliant device generates completions with zero attributes
4592 dev_name(&pdev->dev));
4610 if ((pdev->device & 0xff00) == 0x5400)
4617 * pci_acs_ctrl_enabled - compare desired ACS controls with those provided
4635 * AMD has indicated that the devices below do not support peer-to-peer
4638 * peer-to-peer between functions can claim to support a subset of ACS.
4666 if (!dev->multifunction || !pci_is_root_bus(dev->bus))
4667 return -ENODEV;
4672 return -ENODEV;
4681 return -ENODEV;
4690 switch (dev->device) {
4707 return -ENOTTY;
4724 * X-Gene Root Ports matching this quirk do not allow peer-to-peer
4734 * But the implementation could block peer-to-peer transactions between them
4735 * and provide ACS-like functionality.
4742 return -ENOTTY;
4748 switch (dev->device) {
4760 * Many Intel PCH Root Ports do provide ACS-like features to disable peer
4775 /* Lynxpoint-H PCH */
4778 /* Lynxpoint-LP PCH */
4797 /* Filter out a few obvious non-matches first */
4802 if (pci_quirk_intel_pch_acs_ids[i] == dev->device)
4811 return -ENOTTY;
4813 if (dev->dev_flags & PCI_DEV_FLAGS_ACS_ENABLED_QUIRK)
4821 * These QCOM Root Ports do provide ACS-like features to disable peer
4825 * Hardware doesn't support peer-to-peer and each Root Port is a Root
4851 return -ENOTTY;
4855 * but do include ACS-like functionality. The hardware doesn't support
4856 * peer-to-peer transactions via the root port and each has a unique
4876 * 0xa110-0xa11f Sunrise Point-H PCI Express Root Port #{0-16}
4877 * 0xa167-0xa16a Sunrise Point-H PCI Express Root Port #{17-20}
4885 * Hub, Specification Update, January 2017, Revision 001, Document# 335194-001,
4889 * 0xa290-0xa29f PCI Express Root port #{0-16}
4890 * 0xa2e7-0xa2ee PCI Express Root port #{17-24}
4896 * August 2017, Revision 002, Document#: 334660-002)[6]
4899 * Quad Core Platforms, Vol 1 of 2, August 2017, Document#: 334658-003)[7]
4901 * 0x9d10-0x9d1b PCI Express Root port #{1-12}
4903 * [1] https://www.intel.com/content/www/us/en/chipsets/100-series-chipset-datasheet-vol-2.html
4904 * [2] https://www.intel.com/content/www/us/en/chipsets/100-series-chipset-datasheet-vol-1.html
4905 * [3] https://www.intel.com/content/www/us/en/chipsets/100-series-chipset-spec-update.html
4906 * [4] https://www.intel.com/content/www/us/en/chipsets/200-series-chipset-pch-spec-update.html
4907 * [5] https://www.intel.com/content/www/us/en/chipsets/200-series-chipset-pch-datasheet-vol-1.html
4908 * [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
4909 * [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
4916 switch (dev->device) {
4934 return -ENOTTY;
4936 pos = dev->acs_cap;
4938 return -ENOTTY;
4955 * in their ACS capability if they support peer-to-peer transactions.
4957 * perform peer-to-peer with other functions, allowing us to mask out
4969 * addresses. Refer to Intel VT-d specification, r3.1, sec 3.16,
4970 * "Root-Complex Peer to Peer Considerations".
4973 return -ENOTTY;
4983 * they do not allow peer-to-peer transactions between Root Ports.
4993 * multi-function devices, the hardware isolates the functions by
4994 * directing all peer-to-peer traffic upstream as though PCI_ACS_RR and
5002 switch (dev->device) {
5076 /* 82571 (Quads omitted due to non-ACS switch) */
5095 { 0x19a2, 0x710, pci_quirk_mf_endpoint_acs }, /* Emulex BE3-R */
5096 { 0x10df, 0x720, pci_quirk_mf_endpoint_acs }, /* Emulex Skyhawk-R */
5099 /* Cavium multi-function devices */
5103 /* APM X-Gene */
5114 /* Broadcom multi-function device */
5126 /* Zhaoxin multi-function devices */
5131 /* LX2xx0A : without security features + CAN-FD */
5135 /* LX2xx0C : security features + CAN-FD */
5147 /* LX2xx2A : without security features + CAN-FD */
5151 /* LX2xx2C : security features + CAN-FD */
5171 * pci_dev_specific_acs_enabled - check whether device provides ACS controls
5176 * -ENOTTY: No quirk applies to this device; we can't tell whether the
5188 * or control to indicate their support here. Multi-function express
5189 * devices which do not allow internal peer-to-peer between functions,
5192 for (i = pci_dev_acs_enabled; i->acs_enabled; i++) {
5193 if ((i->vendor == dev->vendor ||
5194 i->vendor == (u16)PCI_ANY_ID) &&
5195 (i->device == dev->device ||
5196 i->device == (u16)PCI_ANY_ID)) {
5197 ret = i->acs_enabled(dev, acs_flags);
5203 return -ENOTTY;
5215 /* Backbone Peer Non-Posted Disable */
5235 pci_bus_read_config_dword(dev->bus, PCI_DEVFN(31, 0),
5238 return -EINVAL;
5243 return -ENOMEM;
5247 * therefore read-only. If both posted and non-posted peer cycles are
5295 * if dev->external_facing || dev->untrusted
5300 return -ENOTTY;
5309 dev->dev_flags |= PCI_DEV_FLAGS_ACS_ENABLED_QUIRK;
5322 return -ENOTTY;
5324 pos = dev->acs_cap;
5326 return -ENOTTY;
5336 if (pci_ats_disabled() || dev->external_facing || dev->untrusted)
5352 return -ENOTTY;
5354 pos = dev->acs_cap;
5356 return -ENOTTY;
5392 if ((p->vendor == dev->vendor ||
5393 p->vendor == (u16)PCI_ANY_ID) &&
5394 (p->device == dev->device ||
5395 p->device == (u16)PCI_ANY_ID) &&
5396 p->enable_acs) {
5397 ret = p->enable_acs(dev);
5403 return -ENOTTY;
5413 if ((p->vendor == dev->vendor ||
5414 p->vendor == (u16)PCI_ANY_ID) &&
5415 (p->device == dev->device ||
5416 p->device == (u16)PCI_ANY_ID) &&
5417 p->disable_acs_redir) {
5418 ret = p->disable_acs_redir(dev);
5424 return -ENOTTY;
5442 if (pdev->pcie_cap || pci_find_capability(pdev, PCI_CAP_ID_EXP))
5462 * Open-code some of set_pcie_port_type() and pci_cfg_space_size_ext()
5475 pdev->pcie_cap = pos;
5477 pdev->pcie_flags_reg = reg16;
5479 pdev->pcie_mpss = reg16 & PCI_EXP_DEVCAP_PAYLOAD;
5481 pdev->cfg_size = PCI_CFG_SPACE_EXP_SIZE;
5484 pdev->cfg_size = PCI_CFG_SPACE_SIZE;
5494 state->cap.cap_nr = PCI_CAP_ID_EXP;
5495 state->cap.cap_extended = 0;
5496 state->cap.size = size;
5497 cap = (u16 *)&state->cap.data[0];
5505 hlist_add_head(&state->next, &pdev->saved_cap_space);
5522 dev->dev_flags |= PCI_DEV_FLAGS_NO_FLR_RESET;
5534 if (dev->revision == 0x1)
5541 struct pci_host_bridge *bridge = pci_find_host_bridge(pdev->bus);
5546 bridge->no_ext_tags = 1;
5549 pci_walk_bus(bridge->bus, pci_configure_extended_tags, NULL);
5564 pdev->ats_cap = 0;
5574 if (pdev->device == 0x15d8) {
5575 if (pdev->revision == 0xcf &&
5576 pdev->subsystem_vendor == 0xea50 &&
5577 (pdev->subsystem_device == 0xce19 ||
5578 pdev->subsystem_device == 0xcc10 ||
5579 pdev->subsystem_device == 0xcc08))
5613 if (pdev->revision < 0x20)
5631 pdev->no_msi = 1;
5636 * Although not allowed by the spec, some multi-function devices have
5649 if (PCI_FUNC(pdev->devfn) != consumer)
5652 supplier_pdev = pci_get_domain_bus_and_slot(pci_domain_nr(pdev->bus),
5653 pdev->bus->number,
5654 PCI_DEVFN(PCI_SLOT(pdev->devfn), supplier));
5655 if (!supplier_pdev || (supplier_pdev->class >> class_shift) != class) {
5660 if (device_link_add(&pdev->dev, &supplier_pdev->dev,
5668 pm_runtime_allow(&pdev->dev);
5701 * Create device link for GPUs with integrated Type-C UCSI controller
5728 if (gpu->device < PCI_DEVICE_ID_NVIDIA_GEFORCE_320M)
5739 /* The GPU becomes a multi-function device when the HDA is enabled */
5741 gpu->multifunction = !!(hdr_type & 0x80);
5752 * Validation. Here's the text of IDT 89H32H8G3-YC, erratum #36:
5754 * Item #36 - Downstream port applies ACS Source Validation to Completions
5767 * write, so we do config reads until we receive a non-Config Request Retry
5778 struct pci_dev *bridge = bus->self;
5780 pos = bridge->acs_cap;
5792 /* Write Vendor ID (read-only) so the endpoint latches its bus/dev */
5796 /* Re-enable ACS_SV if it was previously enabled */
5836 partition = ioread8(&mmio_ntb->partition_id);
5838 partition_map = ioread32(&mmio_ntb->ep_map);
5839 partition_map |= ((u64) ioread32(&mmio_ntb->ep_map + 4)) << 32;
5854 table_sz = ioread16(&mmio_peer_ctrl->req_id_table_size);
5871 rid_entry = ioread32(&mmio_peer_ctrl->req_id_table[te]);
6017 if (pdev->subsystem_vendor != PCI_VENDOR_ID_LENOVO ||
6018 pdev->subsystem_device != 0x222e ||
6061 dev->pme_support &= ~(PCI_PM_CAP_PME_D0 >> PCI_PM_CAP_PME_SHIFT);
6073 * 7.3.27, 7.3.29-7.3.31.
6079 dev->no_msi = 1;
6082 dev->pme_support = 0;
6089 pdev->class = (PCI_CLASS_SYSTEM_OTHER << 8) | pdev->class;
6095 * Pericom PI7C9X2G404/PI7C9X2G304/PI7C9X2G303 switch erratum E5 -
6115 if (!pdev->acs_cap)
6117 pci_read_config_word(pdev, pdev->acs_cap + PCI_ACS_CTRL, &val);
6127 pci_info(upstream, "Setting PI7C9X2Gxxx store-forward mode to avoid ACS erratum\n");
6151 pdev->dev_flags |= PCI_DEV_FLAGS_HAS_MSI_MASKING;
6158 dev->rom_bar_overlap = 1;
6175 u32 l1_lat = FIELD_GET(PCI_EXP_DEVCAP_L1, dev->devcap);
6178 dev->devcap |= FIELD_PREP(PCI_EXP_DEVCAP_L1, 7);
6231 dev->dpc_rp_log_size = 4;
6274 pdev->d3cold_delay = 1000;