Lines Matching +full:vendor +full:- +full:specific
1 /* SPDX-License-Identifier: GPL-2.0 */
7 * Copyright 1997--1999 Martin Mares <mj@ucw.cz>
60 * The PCI interface treats multi-function devices as independent
68 * In the interest of not exposing interfaces to user-space unnecessarily,
69 * the following kernel-only defines are being added here.
80 unsigned char number; /* PCI_SLOT(pci_dev->devfn) */
86 return kobject_name(&slot->kobj); in pci_slot_name()
97 /* #0-5: standard PCI resources */
99 PCI_STD_RESOURCE_END = PCI_STD_RESOURCES + PCI_STD_NUM_BARS - 1,
104 /* Device-specific resources */
107 PCI_IOV_RESOURCE_END = PCI_IOV_RESOURCES + PCI_SRIOV_NUM_BARS - 1,
110 /* PCI-to-PCI (P2P) bridge windows */
127 PCI_BRIDGE_RESOURCE_NUM - 1,
137 * enum pci_interrupt_pin - PCI INTx interrupt values
179 #define PCI_POWER_ERROR ((pci_power_t __force) -1)
230 /* Flag for quirk use to store if quirk-specific ACS is enabled */
232 /* Use a PCIe-to-PCI bridge alias even if !pci_is_pcie */
236 /* Do not use PM reset even if device advertises NoSoftRst- */
240 /* A non-root bridge where translation occurs, stop alias search here */
324 /* struct pci_dev - describes a PCI device
333 struct list_head bus_list; /* Node in per-bus list */
337 void *sysdata; /* Hook for sys-specific extension */
342 unsigned short vendor; member
346 unsigned int class; /* 3 bytes: (base,sub,prog-if) */
361 u8 msix_cap; /* MSI-X capability offset */
373 or supports 64-bit transfers. */
378 this is D0-D3, D0 being fully
396 unsigned int skip_bus_pm:1; /* Internal: Skip bus-level PM */
403 unsigned int d3hot_delay; /* D3hot->D0 transition time in ms */
404 unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */
413 unsigned int eetlp_prefix_max:3; /* Max # of End-End TLP Prefixes, 0=not supported */
433 unsigned int pref_64_window:1; /* Pref mem window is 64-bit */
434 unsigned int multifunction:1; /* Multi-function device */
438 unsigned int no_64bit_msi:1; /* May only use 32-bit MSIs */
468 * device as "external-facing". An external-facing device is
482 unsigned int non_mappable_bars:1; /* BARs can't be mapped to user-space */
514 struct pci_sriov *sriov; /* PF: SR-IOV info */
563 if (dev->is_virtfn) in pci_physfn()
564 dev = dev->physfn; in pci_physfn()
576 return (pdev->error_state != pci_channel_io_normal); in pci_channel_offline()
581 * Group number is limited to a 16-bit value, therefore (int)-1 is
583 * value indicating ->domain_nr is not set by the driver (and
587 #define PCI_DOMAIN_NR_NOT_SET (-1)
632 return (void *)bridge->private; in pci_host_bridge_priv()
667 void *sysdata; /* Hook for sys-specific extension */
695 return PCI_DEVID(dev->bus->number, dev->devfn); in pci_dev_id()
699 * Returns true if the PCI bus is root (behind host-PCI bridge),
702 * Some code assumes that "bus->self == NULL" means that bus is a root bus.
703 * This is incorrect because "virtual" buses added for SR-IOV (via
704 * virtfn_add_bus()) have "bus->self == NULL" but are not root buses.
708 return !(pbus->parent); in pci_is_root_bus()
712 * pci_is_bridge - check if the PCI device is a bridge
720 return dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || in pci_is_bridge()
721 dev->hdr_type == PCI_HEADER_TYPE_CARDBUS; in pci_is_bridge()
725 * pci_is_vga - check if the PCI device is a VGA device
729 * VGA Base Class and Sub-Classes:
731 * 03 00 PCI_CLASS_DISPLAY_VGA VGA-compatible or 8514-compatible
732 * 00 01 PCI_CLASS_NOT_DEFINED_VGA VGA-compatible (before Class Code)
735 * resources ([mem 0xa0000-0xbffff], [io 0x3b0-0x3bb], [io 0x3c0-0x3df] and
740 if ((pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA) in pci_is_vga()
743 if ((pdev->class >> 8) == PCI_CLASS_NOT_DEFINED_VGA) in pci_is_vga()
750 list_for_each_entry(dev, &bus->devices, bus_list) \
756 if (pci_is_root_bus(dev->bus)) in pci_upstream_bridge()
759 return dev->bus->self; in pci_upstream_bridge()
765 return pci_dev->msi_enabled || pci_dev->msix_enabled; in pci_dev_msi_enabled()
780 /* Translate above to generic errno for passing back through non-PCI code */
788 return -ENOENT; in pcibios_err_to_errno()
790 return -ENOTTY; in pcibios_err_to_errno()
792 return -ENODEV; in pcibios_err_to_errno()
794 return -EFAULT; in pcibios_err_to_errno()
796 return -EIO; in pcibios_err_to_errno()
798 return -ENOSPC; in pcibios_err_to_errno()
801 return -ERANGE; in pcibios_err_to_errno()
804 /* Low-level architecture-dependent routines */
841 * PCI Error Recovery System (PCI-ERS). If a PCI device driver provides
875 /* MMIO has been re-enabled, but not DMA */
896 * struct pci_driver - PCI driver structure
916 * pulled out of a hot-pluggable slot).
925 * Useful for enabling wake-on-lan (NIC) or changing
930 * @sriov_set_msix_vec_count: PF Driver callback to change number of MSI-X
932 * This will change MSI-X Table Size in the VF Message Control
935 * MSI-X vectors available for distribution to the VFs.
936 * @err_handler: See Documentation/PCI/pci-error-recovery.rst
952 const struct pci_device_id *id_table; /* Must be non-NULL for probe to be called */
954 void (*remove)(struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
973 * PCI_DEVICE - macro used to describe a specific PCI device
974 * @vend: the 16 bit PCI Vendor ID
978 * specific device. The subvendor and subdevice fields will be set to
982 .vendor = (vend), .device = (dev), \
986 * PCI_DEVICE_DRIVER_OVERRIDE - macro used to describe a PCI device with
988 * @vend: the 16 bit PCI Vendor ID
997 .vendor = (vend), .device = (dev), .subvendor = PCI_ANY_ID, \
1001 * PCI_DRIVER_OVERRIDE_DEVICE_VFIO - macro used to describe a VFIO
1003 * @vend: the 16 bit PCI Vendor ID
1007 * specific device. The subvendor and subdevice fields will be set to
1015 * PCI_DEVICE_SUB - macro used to describe a specific PCI device with subsystem
1016 * @vend: the 16 bit PCI Vendor ID
1022 * specific device with subsystem information.
1025 .vendor = (vend), .device = (dev), \
1029 * PCI_DEVICE_CLASS - macro used to describe a specific PCI device class
1030 * @dev_class: the class, subclass, prog-if triple for this device
1034 * specific PCI class. The vendor, device, subvendor, and subdevice
1039 .vendor = PCI_ANY_ID, .device = PCI_ANY_ID, \
1043 * PCI_VDEVICE - macro used to describe a specific PCI device in short form
1044 * @vend: the vendor name
1048 * specific PCI device. The subvendor, and subdevice fields will be set
1053 .vendor = PCI_VENDOR_ID_##vend, .device = (dev), \
1057 * PCI_VDEVICE_SUB - describe a specific PCI device/subdevice in a short form
1058 * @vend: the vendor name
1063 * Generate the pci_device_id struct layout for the specific PCI
1067 .vendor = PCI_VENDOR_ID_##vend, .device = (dev), \
1071 * PCI_DEVICE_DATA - macro used to describe a specific PCI device in very short form
1072 * @vend: the vendor name (without PCI_VENDOR_ID_ prefix)
1077 * specific PCI device. The subvendor, and subdevice fields will be set
1081 .vendor = PCI_VENDOR_ID_##vend, .device = PCI_DEVICE_ID_##vend##_##dev, \
1097 #define PCI_IRQ_MSIX (1 << 2) /* Allow MSI-X interrupts */
1098 #define PCI_IRQ_AFFINITY (1 << 3) /* Auto-assign affinity */
1115 PCIE_BUS_SAFE, /* Use largest MPS boot-time devices support */
1124 /* Do NOT directly access these two variables, unless you are arch-specific PCI
1136 /* Architecture-specific versions may override this (weak) */
1201 #define dev_is_pci(d) ((d)->bus == &pci_bus_type)
1202 #define dev_is_pf(d) ((dev_is_pci(d) ? to_pci_dev(d)->is_physfn : false))
1214 u16 pci_find_vsec_capability(struct pci_dev *dev, u16 vendor, int cap);
1215 u16 pci_find_dvsec_capability(struct pci_dev *dev, u16 vendor, u16 dvsec);
1219 struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
1221 struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
1277 * pcie_capability_clear_and_set_word - RMW accessor for PCI Express Capability Registers
1283 * Perform a Read-Modify-Write (RMW) operation using @clear and @set
1328 /* User-space driven config access */
1348 return !pdev->broken_intx_masking; in pci_intx_mask_supported()
1353 return (atomic_read(&pdev->enable_cnt) > 0); in pci_is_enabled()
1358 return pdev->is_managed; in pci_is_managed()
1410 return max(ilog2(bytes), 20) - 20; in pci_rebar_bytes_to_size()
1472 /* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
1500 return __request_region(&pdev->driver_exclusive_resource, offset, len, in pci_request_config_region_exclusive()
1508 __release_region(&pdev->driver_exclusive_resource, offset, len); in pci_release_config_region()
1537 * pci_bus_for_each_resource - iterate over PCI bus resources
1591 pcibios_resource_to_bus(pdev->bus, ®ion, &pdev->resource[bar]); in pci_bus_address()
1595 /* Proper probing supporting hot-pluggable devices */
1606 * module_pci_driver() - Helper macro for registering a PCI driver
1617 * builtin_pci_driver() - Helper macro for registering a PCI driver
1629 unsigned int vendor, unsigned int device,
1654 * into the device's MSI-X table and must be handled by some
1702 static inline int pci_msi_vec_count(struct pci_dev *dev) { return -ENOSYS; } in pci_msi_vec_count()
1704 static inline int pci_msix_vec_count(struct pci_dev *dev) { return -ENOSYS; } in pci_msix_vec_count()
1709 { return -ENOSYS; } in pci_enable_msi()
1712 { return -ENOSYS; } in pci_enable_msix_range()
1715 { return -ENOSYS; } in pci_enable_msix_exact()
1722 if ((flags & PCI_IRQ_INTX) && min_vecs == 1 && dev->irq) in pci_alloc_irq_vectors_affinity()
1724 return -ENOSPC; in pci_alloc_irq_vectors_affinity()
1739 struct msi_map map = { .index = -ENOSYS, }; in pci_msix_alloc_irq_at()
1755 return -EINVAL; in pci_irq_vector()
1756 return dev->irq; in pci_irq_vector()
1766 * pci_irqd_intx_xlate() - Translate PCI INTx value to an IRQ domain hwirq
1774 * Translate a PCI INTx interrupt number from device tree in the range 1-4, as
1776 * 0-3 suitable for use in a 4 entry IRQ domain. That is, subtract one from the
1779 * Returns 0 on success, or -EINVAL if the interrupt specifier is out of range.
1791 return -EINVAL; in pci_irqd_intx_xlate()
1793 *out_hwirq = intx - PCI_INTERRUPT_INTA; in pci_irqd_intx_xlate()
1811 return -EOPNOTSUPP; in pcie_set_target_speed()
1819 #define PCIE_LINK_STATE_L1_1_PCIPM BIT(5) /* PCI-PM L1.1 state */
1820 #define PCIE_LINK_STATE_L1_2_PCIPM BIT(6) /* PCI-PM L1.2 state */
1867 { return -EINVAL; } in pci_enable_ptm()
1903 return bus->domain_nr; in pci_domain_nr()
1970 static inline struct pci_dev *pci_get_device(unsigned int vendor, in pci_get_device() argument
1975 static inline struct pci_dev *pci_get_subsys(unsigned int vendor, in pci_get_subsys() argument
1998 static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } in pci_enable_device()
2000 static inline int pcim_enable_device(struct pci_dev *pdev) { return -EIO; } in pcim_enable_device()
2002 { return -EBUSY; } in pci_assign_resource()
2040 { return -EIO; } in pci_request_regions()
2045 { return -EINVAL; } in pci_register_io_range()
2047 static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; } in pci_address_to_pio()
2071 { return -EINVAL; } in pci_irqd_intx_xlate()
2080 return -EINVAL; in pci_irq_vector()
2088 return -ENOSPC; in pci_alloc_irq_vectors_affinity()
2094 return -ENOSPC; in pci_alloc_irq_vectors()
2098 /* Include architecture-dependent settings and functions */
2103 * pci_mmap_resource_range() maps a specific BAR, and vm->vm_pgoff
2117 #define pci_iobar_pfn(pdev, bar, vma) (-EINVAL)
2130 #define pci_resource_n(dev, bar) (&(dev)->resource[(bar)])
2131 #define pci_resource_start(dev, bar) (pci_resource_n(dev, bar)->start)
2132 #define pci_resource_end(dev, bar) (pci_resource_n(dev, bar)->end)
2133 #define pci_resource_flags(dev, bar) (pci_resource_n(dev, bar)->flags)
2153 * Similar to the helpers above, these manipulate per-pci_dev
2154 * driver-specific data. They are really just a wrapper around
2159 return dev_get_drvdata(&pdev->dev); in pci_get_drvdata()
2164 dev_set_drvdata(&pdev->dev, data); in pci_set_drvdata()
2169 return dev_name(&pdev->dev); in pci_name()
2178 * For at least a part of these bugs we need a work-around, so both
2179 * generic (drivers/pci/quirks.c) and per-architecture code can define
2184 u16 vendor; /* Or PCI_ANY_ID */ member
2207 #define ___DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \ argument
2212 ".short " #vendor ", " #device " \n" \
2214 ".long " #hook " - . \n" \
2223 #define __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \ argument
2230 ___DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \
2233 #define __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \ argument
2235 ___DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \
2239 #define DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \ argument
2241 __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class, \
2245 #define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \ argument
2249 = { vendor, device, class, class_shift, hook };
2252 #define DECLARE_PCI_FIXUP_CLASS_EARLY(vendor, device, class, \ argument
2255 hook, vendor, device, class, class_shift, hook)
2256 #define DECLARE_PCI_FIXUP_CLASS_HEADER(vendor, device, class, \ argument
2259 hook, vendor, device, class, class_shift, hook)
2260 #define DECLARE_PCI_FIXUP_CLASS_FINAL(vendor, device, class, \ argument
2263 hook, vendor, device, class, class_shift, hook)
2264 #define DECLARE_PCI_FIXUP_CLASS_ENABLE(vendor, device, class, \ argument
2267 hook, vendor, device, class, class_shift, hook)
2268 #define DECLARE_PCI_FIXUP_CLASS_RESUME(vendor, device, class, \ argument
2271 resume##hook, vendor, device, class, class_shift, hook)
2272 #define DECLARE_PCI_FIXUP_CLASS_RESUME_EARLY(vendor, device, class, \ argument
2275 resume_early##hook, vendor, device, class, class_shift, hook)
2276 #define DECLARE_PCI_FIXUP_CLASS_SUSPEND(vendor, device, class, \ argument
2279 suspend##hook, vendor, device, class, class_shift, hook)
2280 #define DECLARE_PCI_FIXUP_CLASS_SUSPEND_LATE(vendor, device, class, \ argument
2283 suspend_late##hook, vendor, device, class, class_shift, hook)
2285 #define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ argument
2287 hook, vendor, device, PCI_ANY_ID, 0, hook)
2288 #define DECLARE_PCI_FIXUP_HEADER(vendor, device, hook) \ argument
2290 hook, vendor, device, PCI_ANY_ID, 0, hook)
2291 #define DECLARE_PCI_FIXUP_FINAL(vendor, device, hook) \ argument
2293 hook, vendor, device, PCI_ANY_ID, 0, hook)
2294 #define DECLARE_PCI_FIXUP_ENABLE(vendor, device, hook) \ argument
2296 hook, vendor, device, PCI_ANY_ID, 0, hook)
2297 #define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ argument
2299 resume##hook, vendor, device, PCI_ANY_ID, 0, hook)
2300 #define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \ argument
2302 resume_early##hook, vendor, device, PCI_ANY_ID, 0, hook)
2303 #define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \ argument
2305 suspend##hook, vendor, device, PCI_ANY_ID, 0, hook)
2306 #define DECLARE_PCI_FIXUP_SUSPEND_LATE(vendor, device, hook) \ argument
2308 suspend_late##hook, vendor, device, PCI_ANY_ID, 0, hook)
2343 /* Architecture-specific versions may override these (weak) */
2403 return -ENOSYS; in pci_iov_virtfn_bus()
2407 return -ENOSYS; in pci_iov_virtfn_devfn()
2412 return -ENOSYS; in pci_iov_vf_id()
2418 return ERR_PTR(-EINVAL); in pci_iov_get_pf_drvdata()
2422 { return -ENODEV; } in pci_enable_sriov()
2427 return -ENODEV; in pci_iov_sysfs_link()
2431 return -ENOSYS; in pci_iov_add_virtfn()
2450 * pci_pcie_cap - get the saved PCIe capability offset
2462 return dev->pcie_cap; in pci_pcie_cap()
2466 * pci_is_pcie - check if the PCI device is PCI Express capable
2477 * pcie_caps_reg - get the PCIe Capabilities Register
2482 return dev->pcie_flags_reg; in pcie_caps_reg()
2486 * pci_pcie_type - get the PCIe device/port type
2495 * pcie_find_root_port - Get the PCIe root port device
2520 return READ_ONCE(dev->error_state) == pci_channel_io_perm_failure; in pci_dev_is_disconnected()
2534 #define PCI_VPD_LTIN_RO_DATA 0x10 /* Read-Only Data */
2535 #define PCI_VPD_LTIN_RW_DATA 0x11 /* Read-Write Data */
2548 * pci_vpd_alloc - Allocate buffer and read VPD into it
2557 * pci_vpd_find_id_string - Locate id string in VPD
2562 * Returns the index of the id string or -ENOENT if not found.
2567 * pci_vpd_find_ro_info_keyword - Locate info field keyword in VPD RO section
2573 * Returns the index of the information field keyword data or -ENOENT if
2580 * pci_vpd_check_csum - Check VPD checksum
2588 /* PCI <-> OF binding helpers */
2607 return pdev ? pdev->dev.of_node : NULL; in pci_device_to_OF_node()
2612 return bus ? bus->dev.of_node : NULL; in pci_bus_to_OF_node()
2636 return pdev->dev.archdata.edev; in pci_dev_to_eeh_dev()
2649 pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED; in pci_set_dev_assigned()
2653 pdev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED; in pci_clear_dev_assigned()
2657 return (pdev->dev_flags & PCI_DEV_FLAGS_ASSIGNED) == PCI_DEV_FLAGS_ASSIGNED; in pci_is_dev_assigned()
2661 * pci_ari_enabled - query ARI forwarding status
2668 return bus->self && bus->self->ari_enabled; in pci_ari_enabled()
2672 * pci_is_thunderbolt_attached - whether device is on a Thunderbolt daisy chain
2677 * Thunderbolt-attached. (But rather soldered to the mainboard usually.)
2683 if (pdev->is_thunderbolt) in pci_is_thunderbolt_attached()
2687 if (parent->is_thunderbolt) in pci_is_thunderbolt_attached()
2697 #include <linux/dma-mapping.h>
2700 dev_printk(level, &(pdev)->dev, fmt, ##arg)
2702 #define pci_emerg(pdev, fmt, arg...) dev_emerg(&(pdev)->dev, fmt, ##arg)
2703 #define pci_alert(pdev, fmt, arg...) dev_alert(&(pdev)->dev, fmt, ##arg)
2704 #define pci_crit(pdev, fmt, arg...) dev_crit(&(pdev)->dev, fmt, ##arg)
2705 #define pci_err(pdev, fmt, arg...) dev_err(&(pdev)->dev, fmt, ##arg)
2706 #define pci_warn(pdev, fmt, arg...) dev_warn(&(pdev)->dev, fmt, ##arg)
2707 #define pci_warn_once(pdev, fmt, arg...) dev_warn_once(&(pdev)->dev, fmt, ##arg)
2708 #define pci_notice(pdev, fmt, arg...) dev_notice(&(pdev)->dev, fmt, ##arg)
2709 #define pci_info(pdev, fmt, arg...) dev_info(&(pdev)->dev, fmt, ##arg)
2710 #define pci_dbg(pdev, fmt, arg...) dev_dbg(&(pdev)->dev, fmt, ##arg)
2713 dev_notice_ratelimited(&(pdev)->dev, fmt, ##arg)
2716 dev_info_ratelimited(&(pdev)->dev, fmt, ##arg)
2720 dev_driver_string(&(pdev)->dev), pci_name(pdev), ##arg)
2724 dev_driver_string(&(pdev)->dev), pci_name(pdev), ##arg)