411 REFERENCE · Wikibooks
The Linux Kernel/PCI
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
⚲ Most used API
🗝️ 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:
8 lspci -vv
column -t /proc/bus/pci/devices
2 pciconfig_read, 2 pciconfig_write, 2 pciconfig_iobase - pci device information handling
uapi/linux/pci.h
uapi/linux/pci_regs.h
⚲ Kernel space API:
linux/pci.h
pci_device_id - has vendor, device and class IDs. It is used for probing.
pci_driver - the central struct
module_pci_driver - helper macro to register pci_driver. It uses pci_register_driver and pci_unregister_driver.
pci_dev - device descriptor
pci_enable_device, pci_disable_device - must be called in probe and remove callbacks of pci_driver.
pci_set_drvdata, pci_get_drvdata
pci_name
pci_set_master
pcim_iomap_region / pcim_iounmap_region or pci_request_region, pci_request_regions/ pci_release_regions,
pci_iomap, pci_iounmap
pci_alloc_irq_vectors/ pci_free_irq_vectors, pci_request_irq or pci_irq_vector
to_pci_dev
pci_resource_flags, pci_resource_start, pci_resource_len
pci_dev_put
pci_read_config_dword, pci_write_config_dword
pci_set_power_state
rust/kernel/pci.rs – Rust bindings
👁 Examples:
PCI Linux Driver Template
samples/v4l/v4l2-pci-skeleton.c
kernel/device-drivers pci
⚙️ Internals
linux/pci_ids.h
drivers/pci
pci_ops
📚 Mainline documents
PCI driver API driver-api/pci/
PCI Support Library driver-api/pci/pci.html
PCI Hotplug Support Library driver-api/pci/pci.html#pci-hotplug-support-library
PCI Peer-to-Peer DMA Support driver-api/pci/p2pdma.html
📚 PCI subsystem docs
PCI subsystem PCI, newer on the top:
Boot Interrupts reroute PCI/boot-interrupts.html
X86_REROUTE_FOR_BROKEN_BOOT_IRQS
Kernel parameters admin-guide/kernel-parameters.htmlpci=ioapicreroute
EP - Endpoint Framework PCI/endpoint/index.html
Querying information from shell:
find /sys/kernel/config/pci_ep/
EPC - EP Controller:
linux/pci-epc.h
pci_epc_create, devm_pci_epc_create
EPF - EP Function:
linux/pci-epf.h
pci_epf_create
Internals: drivers/pci/endpoint/
Driver to test endpoint functionality: drivers/pci/endpoint/functions/pci-epf-test.c
PCIe virtualization, SR-IOV PCI/pci-iov-howto.html, 2009
API: pci_enable_sriov, pci_disable_sriov, sriov_configure
MSI - Message Signaled Interrupts PCI/msi-howto.html, 2008
MSI Example:
vectors = pci_alloc_irq_vectors(pci_dev, 1, 1, PCI_IRQ_MSI | PCI_IRQ_MSIX);
irq = pci_irq_vector(pci_dev, 0);
AER - Advanced Error Reporting PCI/pcieaer-howto.html, 2006
API: linux/aer.h, pci_aer_clear_nonfatal_status
ERS - Error Recovery System PCI/pci-error-recovery.html:
API: pci_error_handlers, pci_ers_result, pci_channel_state_t
PCIe - PCI Express Port Bus Driver PCI/pciebus-howto.html, 2004
API: pcie_port_service_driver,pcie_port_service_register, pcie_port_service_unregister
Old manual PCI API PCI/pci.html
pci_get_device, pci_get_class, pci_get_subsys, pci_dev_put
📚 Further reading
LKMPG: PCI Drivers
💾 Historical:
LDD3:PCI Drivers
http://www.tldp.org/LDP/tlk/dd/pci.html
📚 References
PCI Express
Category:Peripheral Component Interconnect
https://wiki.osdev.org/PCI
https://lwn.net/Kernel/Index/#PCI