Section: The PCI Utilities (8)
Updated: 31 May 2020Index
lspci - list all PCI devices
is a utility for displaying information about PCI buses in the system anddevices connected to them.
By default, it shows a brief list of devices. Use the options describedbelow to request either a more verbose output or output intended forparsing by other programs.
If you are going to report bugs in PCI device drivers or inlspciitself, please include output of "lspci -vvx" or even better "lspci -vvxxx"(however, see below for possible caveats).
Some parts of the output, especially in the highly verbose modes, are probablyintelligible only to experienced PCI hackers. For exact definitions ofthe fields, please consult either the PCI specifications or theheader.hand/usr/include/linux/pci.hinclude files.
Access to some parts of the PCI configuration space is restricted to rooton many operating systems, so the features oflspciavailable to normal users are limited. However,lspcitries its best to display as much as available and mark all otherinformation with<access denied>text.
Basic display modes
- Dump PCI device data in a backward-compatible machine readable form.See below for details.
- Dump PCI device data in a machine readable form for easy parsing by scripts.See below for details.
- Show a tree-like diagram containing all buses, bridges, devices and connectionsbetween them.
- Be verbose and display detailed information about all devices.
- Be very verbose and display more details. This level includes everything deemeduseful.
- Be even more verbose and display everything we are able to parse,even if it doesn't look interesting at all (e.g., undefined memory regions).
- Show kernel drivers handling each device and also kernel modules capable of handling it.Turned on by default when-vis given in the normal mode of output.(Currently works only on Linux with kernel 2.6 or newer.)
- Show hexadecimal dump of the standard part of the configuration space (the first64 bytes or 128 bytes for CardBus bridges).
- Show hexadecimal dump of the whole PCI configuration space. It is available only to rootas several PCI devicescrashwhen you try to read some parts of the config space (this behavior probablydoesn't violate the PCI standard, but it's at least very stupid). However, suchdevices are rare, so you needn't worry much.
- Show hexadecimal dump of the extended (4096-byte) PCI configuration space availableon PCI-X 2.0 and PCI Express buses.
- Bus-centric view. Show all IRQ numbers and addresses as seen by the cards on thePCI bus instead of as seen by the kernel.
- Always show PCI domain numbers. By default, lspci suppresses them on machines whichhave only domain 0.
- Identify PCI devices by path through each bridge, instead of by bus number.
- Identify PCI devices by path through each bridge, showing the bus number aswell as the device number.
Options to control resolving ID's to names
- Show PCI vendor and device codes as numbers instead of looking them up in thePCI ID list.
- Show PCI vendor and device codes as both numbers and names.
- Use DNS to query the central PCI ID database if a device is not found in the localpci.idsfile. If the DNS query succeeds, the result is cached in~/.pciids-cacheand it is recognized in subsequent runs even if-qis not given any more. Please use this switch inside automated scripts onlywith caution to avoid overloading the database servers.
- Same as-q,but the local cache is reset.
- Query the central database even for entries which are recognized locally.Use this if you suspect that the displayed entry is wrong.
Options for selection of devices
- -s [[[[<domain>]:]<bus>]:][<device>][.[<func>]]
- Show only devices in the specified domain (in case your machine has several host bridges,they can either share a common bus number space or each of them can address a PCI domainof its own; domains are numbered from 0 to ffff), bus (0 to ff), device (0 to 1f) and function (0 to 7).Each component of the device address can be omitted or set to "*", both meaning "any value". All numbers arehexadecimal. E.g., "0:" means all devices on bus 0, "0" means all functions of device 0on any bus, "0.3" selects third function of device 0 on all buses and ".4" shows onlythe fourth function of each device.
- -d [<vendor>]:[<device>][:<class>]
- Show only devices with specified vendor, device and class ID. The ID's aregiven in hexadecimal and may be omitted or given as "*", both meaning"any value".
- -i <file>
- Use<file>as the PCI ID list instead of /usr/share/hwdata/pci.ids.
- -p <file>
- Use<file>as the map of PCI ID's handled by kernel modules. By default, lspci uses/lib/modules/kernel_version/modules.pcimap.Applies only to Linux systems with recent enough module tools.
- Invoke bus mapping mode which performs a thorough scan of all PCI devices, includingthose behind misconfigured bridges, etc. This option gives meaningful results onlywith a direct hardware access mode, which usually requires root privileges.Please note that the bus mapper only scans PCI domain 0.
- Showslspciversion. This option should be used stand-alone.
PCI access options
The PCI utilities use the PCI library to talk to PCI devices (seepcilib(7) for details). You can use the following options toinfluence its behavior:
- -A <method>
- The library supports a variety of methods to access the PCI hardware.By default, it uses the first access method available, but you can usethis option to override this decision. See -A help for a list ofavailable methods and their descriptions.
- -O <param>=<value>
- The behavior of the library is controlled by several named parameters.This option allows to set the value of any of the parameters. Use -O helpfor a list of known parameters and their default values.
- Use direct hardware access via Intel configuration mechanism 1.(This is a shorthand for -A intel-conf1.)
- Use direct hardware access via Intel configuration mechanism 2.(This is a shorthand for -A intel-conf2.)
- -F <file>
- Instead of accessing real hardware, read the list of devices and values of theirconfiguration registers from the given file produced by an earlier run of lspci -x.This is very useful for analysis of user-supplied bug reports, because you can displaythe hardware configuration in any way you want without disturbing the user withrequests for more dumps.
- Increase debug level of the library.
MACHINE READABLE OUTPUT
If you intend to process the output of lspci automatically, please use one of themachine-readable output formats(-m
)described in this section. All other formats are likely to changebetween versions of lspci.
All numbers are always printed in hexadecimal. If you want to process numeric ID's instead ofnames, please add the-nswitch.
Simple format (-m)
In the simple format, each device is described on a single line, which isformatted as parameters suitable for passing to a shell script, i.e., valuesseparated by whitespaces, quoted and escaped if necessary.Some of the arguments are positional: slot, class, vendor name, device name,subsystem vendor name and subsystem name (the last two are empty ifthe device has no subsystem); the remaining arguments are option-like:
- Revision number.
- Programming interface.
The relative order of positional arguments and options is undefined.New options can be added in future versions, but they will alwayshave a single argument not separated from the option by any spaces,so they can be easily ignored if not recognized.
Verbose format (-vmm)
The verbose output is a sequence of records separated by blank lines.Each record describes a single device by a sequence of lines, each linecontaining a single`tag:value'pair. Thetagand thevalueare separated by a single tab character.Neither the records nor the lines within a record are in any particular order.Tags are case-sensitive.
The following tags are defined:
- The name of the slot where the device resides([domain:]bus:device.function).This tag is always the first in a record.
- Name of the class.
- Name of the vendor.
- Name of the device.
- Name of the subsystem vendor (optional).
- Name of the subsystem (optional).
- The physical slot where the device resides (optional, Linux only).
- Revision number (optional).
- Programming interface (optional).
- Kernel driver currently handling the device (optional, Linux only).
- Kernel module reporting that it is capable of handling the device(optional, Linux only). Multiple lines with this tag can occur.
- NUMA node this device is connected to (optional, Linux only).
- IOMMU group that this device is part of (optional, Linux only).
New tags can be added in future versions, so you should silently ignore any tags you don't recognize.
Backward-compatible verbose format (-vm)
In this mode, lspci tries to be perfectly compatible with its old versions.It's almost the same as the regular verbose format, but theDevicetag is used for both the slot and the device name, so it occurs twicein a single record. Please avoid using this format in any new code.
- A list of all known PCI ID's (vendors, devices, classes and subclasses). Maintainedat https://pci-ids.ucw.cz/, use theupdate-pciidsutility to download the most recent version.
- If lspci is compiled with support for compression, this file is tried before pci.ids.
- All ID's found in the DNS query mode are cached in this file.
Sometimes, lspci is not able to decode the configuration registers completely.This usually happens when not enough documentation was available to the authors.In such cases, it at least prints the<?>mark to signal that there is potentially something more to say. If you knowthe details, patches will be of course welcome.
Access to the extended configuration space is currently supported only by thelinux_sysfsback-end.
The PCI Utilities are maintained by Martin Mares <mjAATTucw.cz>.
- Basic display modes
- Display options
- Options to control resolving ID's to names
- Options for selection of devices
- Other options
- PCI access options
- MACHINE READABLE OUTPUT
- Simple format (-m)
- Verbose format (-vmm)
- Backward-compatible verbose format (-vm)
- SEE ALSO
This document was created byman2html,using the manual pages.