Display PCI information
Interactive mode:
pci-tool -i [-M]
Non-interactive mode:
pci-tool [-C class[,subclass][,reg_if]] [-D device_id] [-d Bx:Dy:Fz | Bx:Fz] [-r reset_type] [-t] [-V vendor_id] [-v[v[v[v[...]]]]] [--full] [--read=CFG|BARn:offset_from[-offset_to][,size]] [--reset=reset_type] [--write=CFG|BARn:offset_from[-offset_to][,size][&|]=[~]value] [--strip]
QNX Neutrino
If you're using interactive mode, you can use h or ? at any time to get help. The help menu also provides any context-specific functionality that's available (e.g., reset or virtual hot plug).
If you specify -i, you can also use the following suboption:
The reset_type can be one of the following:
The fifth v causes the device-specific configuration space to be dumped. You can control the format of the dumped value by specifying a ,1, ,2, or ,4 after the fifth v in order to dump the registers as 8, 16 or 32 bits. The default is 32 bits. For example:
pci-tool -vvvvv,2 (works) pci-tool -vv -vvv,2 (works) pci-tool -vvv,2 -vv (doesn't work)
The -d option is required in order to specify the device to access. For read/write accesses, you can specify only one device per invocation of pci-tool.
You can specify these options multiple times; they're performed in the order specified, but all accesses are performed on the same device (specified with the -d option).
To specify the size of the access, include a comma (,) followed by a size value of 1, 2 or 4 to access as 8-, 16- or 32-bit, respectively. If you don't specify a size, 32-bit accesses are performed.
You can specify a range of accesses by providing a hyphen (-) and an offset_to parameter. All offsets must be size bytes-aligned, or the entire argument is ignored. The offset_from may be less than offset_to, but all offsets must be positive values and lie within the range of the corresponding address space when size is taken into account.
For example, to display the entire configuration space for a PCI and PCIe device respectively (the later in reverse order), the following command line arguments are valid:
For write accesses, identify the value to be written with the = operator. You can optionally use a & or | qualifier to implement AND and OR read-modify-write operations for which value is treated as a mask. You can additionally use an optional ~ character to specify the 1's complement of value. This can be useful for bit field modifications.
--write="CFG:0x4,2|=4" --write='CFG:0x4,2&=~4'
For CFG space accesses, offset_from and offset_to specify a register between 0 and 255 for PCI devices, or 0 and 4095 for PCIe devices.
For device address space accesses, BARn specifies the Base Address Register to use for the access. BARs are numbered 0 through 6, with values 0 through 5 specifying the standard 6 device BARs (only 0 and 1 apply to bridge devices), and value 6 specifying the ROM.
Specify the offset_from and offset_to parameters as an offset within the space, not as an absolute address. A range check is performed to ensure that the provided offset is within the range covered by the BAR. The appropriate access (MMIO or IO) is performed, depending on the address space type for the specified BAR.
Other things to note:
Bxxx:Dyy:Fzz @ idx n
The --strip option removes the B, D, and F from the output, so that you can use the result as input to another invocation of pci-tool with the -d option in order to act on a specific instance of a device.
For example, let's say that we have a system with 4 PCI-to-PCI bridges (specifically PCIe Root Ports), all with different device IDs, and we wish to clear the Bridge Control Register (at offset 0x3e) but only for the third instance of the device. Without needing to know the vendor or device IDs, we could use the class code as the search criteria to identify the devices, as follows:
pci-tool -C6,4,0 B000:D01:F00 @ idx 0 B000:D21:F00 @ idx 1 B000:D21:F01 @ idx 2 B000:D21:F02 @ idx 3
If we use the above command with the --strip option, we get:
pci-tool -C6,4,0 --strip 000:01:00 @ idx 0 000:21:00 @ idx 1 000:21:01 @ idx 2 000:21:02 @ idx 3
To select the third instance of this device, we can filter with a utility such as grep:
pci-tool -C6,4,0 --strip | grep "idx 2" 000:21:01 @ idx 2
and we can now send this output to another invocation of pci-tool in order to perform the desired operation:
pci-tool -d `pci-tool -C6,4,0 --strip | grep "idx 2"` --write=cfg:0x3e,2=0
The pci-tool utility displays PCI information. This utility operates in these modes:
Unless otherwise stated, all numeric arguments can be provided in any base.
Interactive mode takes precedence. If you select it, only the listed interactive mode suboptions are applicable, and all others are ignored.
A note regarding the displayed idx value
The pci-tool utility displays an idx value for each device that it finds, based on the current search criteria. If the search criteria changes, the same device (BDF) may be found at a different idx value. For more information about the reporting of the idx value, see the entry for pci_device_find() in the PCI Server User's Guide. This is worth noting because:
Here's some sample output from pci-tool:
B00:D00:F00 @ idx 0 B00:D01:F00 @ idx 1 B00:D07:F00 @ idx 2 B00:D07:F01 @ idx 3 B00:D07:F03 @ idx 4 B00:D07:F07 @ idx 5 B00:D15:F00 @ idx 6 B00:D16:F00 @ idx 7 B00:D17:F00 @ idx 8 B00:D21:F00 @ idx 9 B00:D21:F01 @ idx 10 B00:D21:F02 @ idx 11
If you specify the -v option, the output for the first device could look like this:
B00:D00:F00 @ idx 0 vid/did: 8086/7190 Intel Corporation, 82443BX/ZX 440BX/ZX AGPset Host Bridge class/subclass/reg: 06/00/00 Host-to-PCI Bridge Device
If you specify -vv, the output for the first device could look like this:
B00:D00:F00 @ idx 0 vid/did: 8086/7190 Intel Corporation, 82443BX/ZX 440BX/ZX AGPset Host Bridge class/subclass/reg: 06/00/00 Host-to-PCI Bridge Device revid: 1 cmd/status registers: 6/200 Capabilities: * Address Space list - 0 assigned Interrupt list - 0 assigned hdrType: 0 ssid/ssvid: 1976/15ad
If you specify -vvvvv, the output for the first device could look like this:
B00:D00:F00 @ idx 0 vid/did: 8086/7190 Intel Corporation, 82443BX/ZX 440BX/ZX AGPset Host Bridge class/subclass/reg: 06/00/00 Host-to-PCI Bridge Device revid: 1 cmd/status registers: 6/200 Capabilities: * Address Space list - 0 assigned Interrupt list - 0 assigned hdrType: 0 ssid/ssvid: 1976/15ad Device Dependent Registers [40] 00001061 c8200008 00000000 00000000 [50] ff008008 00000000 01111003 11333000 [60] 20202010 20202020 00000000 00000000 [70] 00080000 00000000 00000000 00000000 [80] 00000000 00000000 00000000 00000000 : [c0] 00000013 e0000001 00000000 00000000 [d0] 00000000 00000000 00000000 00000000 : [f0] 00000000 00000000 00000000 00010000
In non-interactive mode, the exit code is 0 if at least one device was found using the current search criteria. A nonzero value is returned otherwise. You can use the return code to determine whether or not specific BDFs exist.