Lines Matching +full:os +full:- +full:initiated

1 /* SPDX-License-Identifier: GPL-2.0 */
7 * Copyright 1997--1999 Martin Mares <mj@ucw.cz>
53 * The PCI interface treats multi-function devices as independent
61 * In the interest of not exposing interfaces to user-space unnecessarily,
62 * the following kernel-only defines are being added here.
73 unsigned char number; /* PCI_SLOT(pci_dev->devfn) */
79 return kobject_name(&slot->kobj); in pci_slot_name()
90 /* #0-5: standard PCI resources */
92 PCI_STD_RESOURCE_END = PCI_STD_RESOURCES + PCI_STD_NUM_BARS - 1,
97 /* Device-specific resources */
100 PCI_IOV_RESOURCE_END = PCI_IOV_RESOURCES + PCI_SRIOV_NUM_BARS - 1,
103 /* PCI-to-PCI (P2P) bridge windows */
120 PCI_BRIDGE_RESOURCE_NUM - 1,
130 * enum pci_interrupt_pin - PCI INTx interrupt values
163 #define PCI_POWER_ERROR ((pci_power_t __force) -1)
214 /* Flag for quirk use to store if quirk-specific ACS is enabled */
216 /* Use a PCIe-to-PCI bridge alias even if !pci_is_pcie */
220 /* Do not use PM reset even if device advertises NoSoftRst- */
224 /* A non-root bridge where translation occurs, stop alias search here */
310 struct list_head bus_list; /* Node in per-bus list */
314 void *sysdata; /* Hook for sys-specific extension */
323 unsigned int class; /* 3 bytes: (base,sub,prog-if) */
332 u8 msix_cap; /* MSI-X capability offset */
344 or supports 64-bit transfers. */
349 this is D0-D3, D0 being fully
369 unsigned int skip_bus_pm:1; /* Internal: Skip bus-level PM */
376 unsigned int d3hot_delay; /* D3hot->D0 transition time in ms */
377 unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */
385 unsigned int eetlp_prefix_path:1; /* End-to-End TLP Prefix */
404 unsigned int pref_64_window:1; /* Pref mem window is 64-bit */
405 unsigned int multifunction:1; /* Multi-function device */
409 unsigned int no_64bit_msi:1; /* May only use 32-bit MSIs */
438 * device as "external-facing". An external-facing device is
479 struct pci_sriov *sriov; /* PF: SR-IOV info */
508 if (dev->is_virtfn) in pci_physfn()
509 dev = dev->physfn; in pci_physfn()
521 return (pdev->error_state != pci_channel_io_normal); in pci_channel_offline()
540 unsigned int native_aer:1; /* OS may use PCIe AER */
541 unsigned int native_pcie_hotplug:1; /* OS may use PCIe hotplug */
542 unsigned int native_shpc_hotplug:1; /* OS may use SHPC hotplug */
543 unsigned int native_pme:1; /* OS may use PCIe PME */
544 unsigned int native_ltr:1; /* OS may use PCIe LTR */
545 unsigned int native_dpc:1; /* OS may use PCIe DPC */
562 return (void *)bridge->private; in pci_host_bridge_priv()
592 * This does not apply to ACPI _CRS windows, even with the _DEC subtractive-
619 void *sysdata; /* Hook for sys-specific extension */
645 return PCI_DEVID(dev->bus->number, dev->devfn); in pci_dev_id()
649 * Returns true if the PCI bus is root (behind host-PCI bridge),
652 * Some code assumes that "bus->self == NULL" means that bus is a root bus.
653 * This is incorrect because "virtual" buses added for SR-IOV (via
654 * virtfn_add_bus()) have "bus->self == NULL" but are not root buses.
658 return !(pbus->parent); in pci_is_root_bus()
662 * pci_is_bridge - check if the PCI device is a bridge
670 return dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || in pci_is_bridge()
671 dev->hdr_type == PCI_HEADER_TYPE_CARDBUS; in pci_is_bridge()
675 list_for_each_entry(dev, &bus->devices, bus_list) \
681 if (pci_is_root_bus(dev->bus)) in pci_upstream_bridge()
684 return dev->bus->self; in pci_upstream_bridge()
690 return pci_dev->msi_enabled || pci_dev->msix_enabled; in pci_dev_msi_enabled()
705 /* Translate above to generic errno for passing back through non-PCI code */
713 return -ENOENT; in pcibios_err_to_errno()
715 return -ENOTTY; in pcibios_err_to_errno()
717 return -ENODEV; in pcibios_err_to_errno()
719 return -EFAULT; in pcibios_err_to_errno()
721 return -EIO; in pcibios_err_to_errno()
723 return -ENOSPC; in pcibios_err_to_errno()
726 return -ERANGE; in pcibios_err_to_errno()
729 /* Low-level architecture-dependent routines */
766 * PCI Error Recovery System (PCI-ERS). If a PCI device driver provides
800 /* MMIO has been re-enabled, but not DMA */
818 * struct pci_driver - PCI driver structure
839 * pulled out of a hot-pluggable slot).
848 * Useful for enabling wake-on-lan (NIC) or changing
853 * @err_handler: See Documentation/PCI/pci-error-recovery.rst
861 const struct pci_device_id *id_table; /* Must be non-NULL for probe to be called */
863 void (*remove)(struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
877 * PCI_DEVICE - macro used to describe a specific PCI device
890 * PCI_DEVICE_SUB - macro used to describe a specific PCI device with subsystem
904 * PCI_DEVICE_CLASS - macro used to describe a specific PCI device class
905 * @dev_class: the class, subclass, prog-if triple for this device
918 * PCI_VDEVICE - macro used to describe a specific PCI device in short form
932 * PCI_DEVICE_DATA - macro used to describe a specific PCI device in very short form
958 #define PCI_IRQ_MSIX (1 << 2) /* Allow MSI-X interrupts */
959 #define PCI_IRQ_AFFINITY (1 << 3) /* Auto-assign affinity */
976 PCIE_BUS_SAFE, /* Use largest MPS boot-time devices support */
985 /* Do NOT directly access these two variables, unless you are arch-specific PCI
988 /* Some device drivers need know if PCI is initiated */
997 /* Architecture-specific versions may override this (weak) */
1061 #define dev_is_pci(d) ((d)->bus == &pci_bus_type)
1062 #define dev_is_pf(d) ((dev_is_pci(d) ? to_pci_dev(d)->is_physfn : false))
1151 /* User-space driven config access */
1172 return !pdev->broken_intx_masking; in pci_intx_mask_supported()
1177 return (atomic_read(&pdev->enable_cnt) > 0); in pci_is_enabled()
1182 return pdev->is_managed; in pci_is_managed()
1293 /* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
1368 pcibios_resource_to_bus(pdev->bus, &region, &pdev->resource[bar]); in pci_bus_address()
1372 /* Proper probing supporting hot-pluggable devices */
1383 * module_pci_driver() - Helper macro for registering a PCI driver
1394 * builtin_pci_driver() - Helper macro for registering a PCI driver
1432 * into the device's MSI-X table and must be handled by some
1446 dma_pool_create(name, &pdev->dev, size, align, allocation)
1455 u16 entry; /* Driver uses to specify entry, OS writes */
1485 static inline int pci_msi_vec_count(struct pci_dev *dev) { return -ENOSYS; } in pci_msi_vec_count()
1487 static inline int pci_msix_vec_count(struct pci_dev *dev) { return -ENOSYS; } in pci_msix_vec_count()
1492 { return -ENOSYS; } in pci_enable_msi()
1495 { return -ENOSYS; } in pci_enable_msix_range()
1498 { return -ENOSYS; } in pci_enable_msix_exact()
1505 if ((flags & PCI_IRQ_LEGACY) && min_vecs == 1 && dev->irq) in pci_alloc_irq_vectors_affinity()
1507 return -ENOSPC; in pci_alloc_irq_vectors_affinity()
1517 return -EINVAL; in pci_irq_vector()
1518 return dev->irq; in pci_irq_vector()
1528 * pci_irqd_intx_xlate() - Translate PCI INTx value to an IRQ domain hwirq
1536 * Translate a PCI INTx interrupt number from device tree in the range 1-4, as
1538 * 0-3 suitable for use in a 4 entry IRQ domain. That is, subtract one from the
1541 * Returns 0 on success, or -EINVAL if the interrupt specifier is out of range.
1553 return -EINVAL; in pci_irqd_intx_xlate()
1555 *out_hwirq = intx - PCI_INTERRUPT_INTA; in pci_irqd_intx_xlate()
1624 return bus->domain_nr; in pci_domain_nr()
1711 static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } in pci_enable_device()
1713 static inline int pcim_enable_device(struct pci_dev *pdev) { return -EIO; } in pcim_enable_device()
1715 { return -EBUSY; } in pci_assign_resource()
1751 { return -EIO; } in pci_request_regions()
1754 static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; } in pci_address_to_pio()
1778 { return -EINVAL; } in pci_irqd_intx_xlate()
1787 return -EINVAL; in pci_irq_vector()
1795 return -ENOSPC; in pci_alloc_irq_vectors_affinity()
1807 /* Include architecture-dependent settings and functions */
1815 * pci_mmap_resource_range() maps a specific BAR, and vm->vm_pgoff
1818 * pci_mmap_page_range() is the legacy architecture-specific interface,
1836 #define pci_iobar_pfn(pdev, bar, vma) (-EINVAL)
1849 #define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start)
1850 #define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end)
1851 #define pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags)
1857 (pci_resource_end((dev), (bar)) - \
1861 * Similar to the helpers above, these manipulate per-pci_dev
1862 * driver-specific data. They are really just a wrapper around
1867 return dev_get_drvdata(&pdev->dev); in pci_get_drvdata()
1872 dev_set_drvdata(&pdev->dev, data); in pci_set_drvdata()
1877 return dev_name(&pdev->dev); in pci_name()
1886 * For at least a part of these bugs we need a work-around, so both
1887 * generic (drivers/pci/quirks.c) and per-architecture code can define
1922 ".long " #hook " - . \n" \
2024 /* Architecture-specific versions may override these (weak) */
2078 return -ENOSYS; in pci_iov_virtfn_bus()
2082 return -ENOSYS; in pci_iov_virtfn_devfn()
2085 { return -ENODEV; } in pci_enable_sriov()
2090 return -ENODEV; in pci_iov_sysfs_link()
2094 return -ENOSYS; in pci_iov_add_virtfn()
2118 * pci_pcie_cap - get the saved PCIe capability offset
2130 return dev->pcie_cap; in pci_pcie_cap()
2134 * pci_is_pcie - check if the PCI device is PCI Express capable
2145 * pcie_caps_reg - get the PCIe Capabilities Register
2150 return dev->pcie_flags_reg; in pcie_caps_reg()
2154 * pci_pcie_type - get the PCIe device/port type
2163 * pcie_find_root_port - Get the PCIe root port device
2192 #define PCI_VPD_LTIN_RO_DATA 0x10 /* Read-Only Data */
2193 #define PCI_VPD_LTIN_RW_DATA 0x11 /* Read-Write Data */
2220 * pci_vpd_lrdt_size - Extracts the Large Resource Data Type length
2231 * pci_vpd_lrdt_tag - Extracts the Large Resource Data Type Tag Item
2242 * pci_vpd_srdt_size - Extracts the Small Resource Data Type length
2253 * pci_vpd_srdt_tag - Extracts the Small Resource Data Type Tag Item
2264 * pci_vpd_info_field_size - Extracts the information field length
2275 * pci_vpd_find_tag - Locates the Resource Data Type tag provided
2282 * -ENOENT otherwise.
2287 * pci_vpd_find_info_keyword - Locates an information field keyword in the VPD
2294 * -ENOENT otherwise.
2299 /* PCI <-> OF binding helpers */
2316 return pdev ? pdev->dev.of_node : NULL; in pci_device_to_OF_node()
2321 return bus ? bus->dev.of_node : NULL; in pci_bus_to_OF_node()
2339 return pdev->dev.archdata.edev; in pci_dev_to_eeh_dev()
2352 pdev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED; in pci_set_dev_assigned()
2356 pdev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED; in pci_clear_dev_assigned()
2360 return (pdev->dev_flags & PCI_DEV_FLAGS_ASSIGNED) == PCI_DEV_FLAGS_ASSIGNED; in pci_is_dev_assigned()
2364 * pci_ari_enabled - query ARI forwarding status
2371 return bus->self && bus->self->ari_enabled; in pci_ari_enabled()
2375 * pci_is_thunderbolt_attached - whether device is on a Thunderbolt daisy chain
2380 * Thunderbolt-attached. (But rather soldered to the mainboard usually.)
2386 if (pdev->is_thunderbolt) in pci_is_thunderbolt_attached()
2390 if (parent->is_thunderbolt) in pci_is_thunderbolt_attached()
2401 #include <linux/pci-dma-compat.h>
2404 dev_printk(level, &(pdev)->dev, fmt, ##arg)
2406 #define pci_emerg(pdev, fmt, arg...) dev_emerg(&(pdev)->dev, fmt, ##arg)
2407 #define pci_alert(pdev, fmt, arg...) dev_alert(&(pdev)->dev, fmt, ##arg)
2408 #define pci_crit(pdev, fmt, arg...) dev_crit(&(pdev)->dev, fmt, ##arg)
2409 #define pci_err(pdev, fmt, arg...) dev_err(&(pdev)->dev, fmt, ##arg)
2410 #define pci_warn(pdev, fmt, arg...) dev_warn(&(pdev)->dev, fmt, ##arg)
2411 #define pci_notice(pdev, fmt, arg...) dev_notice(&(pdev)->dev, fmt, ##arg)
2412 #define pci_info(pdev, fmt, arg...) dev_info(&(pdev)->dev, fmt, ##arg)
2413 #define pci_dbg(pdev, fmt, arg...) dev_dbg(&(pdev)->dev, fmt, ##arg)
2416 dev_notice_ratelimited(&(pdev)->dev, fmt, ##arg)
2419 dev_info_ratelimited(&(pdev)->dev, fmt, ##arg)
2423 dev_driver_string(&(pdev)->dev), pci_name(pdev), ##arg)
2427 dev_driver_string(&(pdev)->dev), pci_name(pdev), ##arg)