PCI bus support in Linux kernel
⚲ Most used API
[edit | edit source]🗝️ Acronyms:
- ACPI - Advanced Configuration and Power Interface
- ACS - Access Control Service
- AER - Advanced Error Reporting port service
- ASPM - Active State Power Management
- EDR - Error Disconnect Recover
- FLR - function level reset
- HT - Hypertransport
- BAR - Base Address Registers
- BW - Bandwidth
- DPC - Downstream Port Containment port service
- EP - Endpoint
- mmrbc - maximum memory read byte count
- mps - maximum payload size
- MWI - Memory-Write-Invalidate
- PM - Power Management
- PMC - ... ... Controller
- PME - ... ... Event, port service
- SR-IOV - Single-root input/output virtualization
- VF - virtual functions
⚲ User space API:
Querying information from a shell:
- man 8 lspci -vv
- column -t /proc/bus/pci/devices
- man 2 pciconfig_read, man 2 pciconfig_write, man 2 pciconfig_iobase - pci device information handling
- uapi/linux/pci.h inc
- uapi/linux/pci_regs.h inc
⚲ Kernel space API:
- linux/pci.h inc
- pci_device_id id - has vendor, device and class IDs. It is used for probing.
- pci_driver id - the central struct
- module_pci_driver id- helper macro to register pci_driver. It uses pci_register_driver id and pci_unregister_driver id.
- pci_dev id - device descriptor
- pci_enable_device id, pci_disable_device id - must be called in probe and remove callbacks of pci_driver.
- pci_set_drvdata id, pci_get_drvdata id
- pci_name id
- pci_set_master id
- pcim_iomap_regions id / pcim_iounmap_regions id or pci_request_region id, pci_request_regions id/ pci_release_regions id,
- pci_iomap id, pci_iounmap id
- pci_alloc_irq_vectors id/ pci_free_irq_vectors id, pci_request_irq idor pci_irq_vector id
- to_pci_dev id
- pci_resource_flags id, pci_resource_start id, pci_resource_len id
- pci_dev_put id
- pci_read_config_dword id, pci_write_config_dword id
- pci_set_power_state id
👁 Examples:
⚙️ Internals
[edit | edit source]linux/pci_ids.h inc
drivers/pci src
pci_ops id
📚 Mainline documents
[edit | edit source]- PCI driver API doc
- PCI Support Library doc
- PCI Hotplug Support Library doc
- PCI Peer-to-Peer DMA Support doc
📚 PCI subsystem docs
[edit | edit source]PCI subsystem doc, newer on the top:
X86_REROUTE_FOR_BROKEN_BOOT_IRQS
Kernel parameters docpci=ioapicreroute
Querying information from shell:
find /sys/kernel/config/pci_ep/
EPC - EP Controller:
linux/pci-epc.h inc pci_epc_create id, devm_pci_epc_create id
EPF - EP Function:
linux/pci-epf.h inc pci_epf_create id
Internals: drivers/pci/endpoint/ src
Driver to test endpoint functionality: drivers/pci/endpoint/functions/pci-epf-test.c src
PCIe virtualization, SR-IOV doc, 2009
API: pci_enable_sriov id, pci_disable_sriov id, sriov_configure id
MSI - Message Signaled Interrupts doc, 2008
MSI Example:
vectors = pci_alloc_irq_vectors id(pci_dev, 1, 1, PCI_IRQ_MSI | PCI_IRQ_MSIX);
irq = pci_irq_vector id(pci_dev, 0);
AER - Advanced Error Reporting doc, 2006
API: linux/aer.h inc, pci_enable_pcie_error_reporting id, pci_disable_pcie_error_reporting id, pci_aer_clear_nonfatal_status id
ERS - Error Recovery System doc:
API: pci_error_handlers id, pci_ers_result id, pci_channel_state_t id
PCIe - PCI Express Port Bus Driver doc, 2004
API: pcie_port_service_driver id,pcie_port_service_register id, pcie_port_service_unregister id
pci_get_device id, pci_get_class id, pci_get_subsys id, pci_dev_put id
💾 Historical:
📚 References