Expand description
PCI Configuration Space Access
Terminology
This crate deals with multiple types of interrupts:
-
Legacy (INTx) interrupts are the oldest PCI interrupt representation.
- Four interrupt pins are shared among all devices.
- This crate refers to these legacy interrupts as “intx”.
-
MSI (Message Signaled Interrupts) appeared with PCI express.
- They allow devices to allocate up to 32 interrupt numbers.
- This crate refers to these interrupts as “msi”.
-
MSI-X messages appeared with PCIe 3.0.
- They allow devices to allocate up to 2048 interrupt numbers.
- This crate refers to these interrupts as “msix”.
Note: while pci currently uses port-io on x86 and mmio on aarch64, x86 may also support memory-based PCI configuration in the future; port-io is the legacy way to access the config space.
For context on the various interrupt mechanisms (MSI/MSI-X/INTx):
- this StackExchange reply
- PCI Express Base Specification, Revision 2, Chapter 6.1 - Interrupt & PME Support
Structs
- Returned by
PciDevice::modern_interrupt_support
- A single Message Signaled Interrupt entry.
- A memory-mapped array of
MsixVectorEntry
- A PCI bus, which contains a list of PCI devices on that bus.
- Contains information common to every type of PCI Device, and offers functions for reading/writing to the PCI configuration space.
- The bus, slot, and function number of a given PCI device. This offers methods for reading and writing the PCI config space.
Enums
- Lists the 2 possible PCI configuration space access mechanisms that can be found from the LSB of the devices’s BAR0
Functions
- Returns a list of all PCI buses in this system. If the PCI bus hasn’t been initialized, this initializes the PCI bus & scans it to enumerates devices.
- Returns a reference to the
PciDevice
with the given bus, slot, func identifier. If the PCI bus hasn’t been initialized, this initializes the PCI bus & scans it to enumerates devices. - Returns an iterator that iterates over all
PciDevice
s, in no particular guaranteed order. If the PCI bus hasn’t been initialized, this initializes the PCI bus & scans it to enumerates devices.