pci, pcirw – PCI space tools


pci [ –bscmv ] [ vid/did | bdf ]
pcirw –r bdf offset width
pcirw –w bdf offset width value


With no options, pci prints one line per device found on the local PCI bus described by #$/pci. The fields are bus.device.function, class, class code, vendor/device ids, IRQ (interrupt), followed by the BAR (base address) registers in pairs of index:address and size. The –v option adds a second line per device, containing an English description obtained from /lib/pci. A second –v includes a second line of description based on the sub–DID and sub–VID. The –s flag explictly requests this format.
The description for arbirary devices may be found by giving their PCI vendor and device ids on the command line. Specifying a bdfs on the command line, will print only the selected devices.
The –c option prints a one–line summary of PCI capabilities instead. Each capability has the format name/capcode. Combined with –v the capabilities' contents are decoded in human–readable format.
The –m option prints one line per device detailing the MSI (message–signaled interrupt) configuration. The fields are bus.device.function, flags, target address, target "data" and offset of the capability structure. Combined with –v the flags are decoded in human–readable format.
The –b option describes the programming interface class, base class and sub class codes.
Pcirw reads (–r) or writes (–w) an integer of the specified width and the specified offset to or from PCI configuration space of a single specified device.








Due to constrants in the PCI standard, the BAR sizes are not discoverable without corrupting them, so these must be provided by the kernel pci device.