Never Ending Security

It starts all here

Lspci Commands Cheatsheet

lspci Command Examples

lspci is a command on Unix-like operating systems that prints detailed information about all PCI buses and devices in the system. It is based on a common portable library libpci which offers access to the PCI configuration space on a variety of operating systems.

By default, it shows a brief list of devices. If you are going to report bugs in PCI device drivers or in lspci itself, please include output of “lspci -vvx” or even better “lspci -vvxxx”

Some parts of the output, especially in the highly verbose modes, are probably intelligible only to experienced PCI hackers. For exact definitions of the fields, please consult either the PCI specifications or the header.h and /usr/include/linux/pci.h include files.

Access to some parts of the PCI configuration space is restricted to root on many operating systems, so the features of lspci available to normal users are limited. However,lspci tries its best to display as much as available and mark all other information with <access denied> text.

lspci utility is part of the pciutils package.

Default Usage

By default lspci it will display all the device information in this format: [domain:]bus:device.function

# lspci
00:00.0 Host bridge: Intel Corporation 5500 I/O Hub to ESI Port (rev 13)
00:01.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 1 (rev 13)
00:09.0 PCI bridge: Intel Corporation 7500/5520/5500/X58 I/O Hub PCI Express Root Port 9 (rev 13)
00:14.0 PIC: Intel Corporation 7500/5520/5500/X58 I/O Hub System Management Registers (rev 13)
00:14.1 PIC: Intel Corporation 7500/5520/5500/X58 I/O Hub GPIO and Scratch Pad Registers (rev 13)
00:14.2 PIC: Intel Corporation 7500/5520/5500/X58 I/O Hub Control Status and RAS Registers (rev 13)
00:1a.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 (rev 02)
00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 1 (rev 02)
00:1d.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 92)
00:1f.0 ISA bridge: Intel Corporation 82801IB (ICH9) LPC Interface Controller (rev 02)
00:1f.2 IDE interface: Intel Corporation 82801IB (ICH9) 2 port SATA Controller [IDE mode] (rev 02)
01:00.0 Ethernet controller: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)
01:00.1 Ethernet controller: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)
03:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 05)
06:03.0 VGA compatible controller: Matrox Electronics Systems Ltd. MGA G200eW WPCM450 (rev 0a)

Dump PCI Info in Different Format

If you want to pass the output of the lspci command to a shell script, you may want to use -m option (or -mm option).

This option is also helpful when you want to view the subsystem information. For example, for the RAID controller, the default output just says that is is using LSI Logic RAID controller. But, the following output displays the subsystem, which is DELL PERC H700 Integrated RAID controller system.

# lspci -m
00:00.0 "Host bridge" "Intel Corporation" "5500 I/O Hub to ESI Port" -r13 "Dell" "PowerEdge R610 I/O Hub to ESI Port"
00:09.0 "PCI bridge" "Intel Corporation" "7500/5520/5500/X58 I/O Hub PCI Express Root Port 9" -r13 "" ""
00:14.0 "PIC" "Intel Corporation" "7500/5520/5500/X58 I/O Hub System Management Registers" -r13 "" ""
00:1a.0 "USB controller" "Intel Corporation" "82801I (ICH9 Family) USB UHCI Controller #4" -r02 "Dell" "PowerEdge R610 USB UHCI Controller"
00:1f.0 "ISA bridge" "Intel Corporation" "82801IB (ICH9) LPC Interface Controller" -r02 "Dell" "PowerEdge R610 82801IB (ICH9) LPC Interface Controller"
00:1f.2 "IDE interface" "Intel Corporation" "82801IB (ICH9) 2 port SATA Controller [IDE mode]" -r02 -p8f "Dell" "PowerEdge R610 SATA IDE Controller"
01:00.0 "Ethernet controller" "Broadcom Corporation" "NetXtreme II BCM5709 Gigabit Ethernet" -r20 "Dell" "PowerEdge R610 BCM5709 Gigabit Ethernet"
03:00.0 "RAID bus controller" "LSI Logic / Symbios Logic" "MegaRAID SAS 2108 [Liberator]" -r05 "Dell" "PERC H700 Integrated"
06:03.0 "VGA compatible controller" "Matrox Electronics Systems Ltd." "MGA G200eW WPCM450" -r0a "Dell" "PowerEdge R610 MGA G200eW WPCM450"

Output in Tree Format

The -t option will display the output in tree format with information about bus, and how devices are connected to those buses. The output will be only using the numerical ids.

# lspci -t
-[0000:00]-+-00.0
           +-01.0-[01]--+-00.0
           |            \-00.1
           +-03.0-[02]--+-00.0
           |            \-00.1
           +-07.0-[04]--
           +-09.0-[05]--
           +-14.0
           +-14.1
           +-1c.0-[03]----00.0
           +-1d.0
           +-1e.0-[06]----03.0
           +-1f.0

Detailed Device Information

If you want to look into details of a particular device, use -v to get more information. This will display information about all the devices. The output of this command will be very long, and you need to scroll down and view the appropriate section.

For additional level for verbosity, you can use -vv or -vvv.

# lspci -v
 03:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 05)
        Subsystem: Dell PERC H700 Integrated
        Flags: bus master, fast devsel, latency 0, IRQ 16
        I/O ports at fc00 [size=256]
        Memory at df1bc000 (64-bit, non-prefetchable) [size=16K]
        Memory at df1c0000 (64-bit, non-prefetchable) [size=256K]
        Expansion ROM at df100000 [disabled] [size=256K]
        Capabilities: [50] Power Management version 3
        Capabilities: [68] Express Endpoint, MSI 00
        Capabilities: [d0] Vital Product Data
        Capabilities: [a8] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [c0] MSI-X: Enable+ Count=15 Masked-
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [138] Power Budgeting <?>
        Kernel driver in use: megaraid_sas
        Kernel modules: megaraid_sas

Display Device Codes in the Output

If you want to display the PCI vendor code, and the device code only as the numbers, use -n option. This will not lookup the PCI file to get the corresponding values for the numbers.

# lspci -n
01:00.1 0200: 14e4:1639 (rev 20)
02:00.0 0200: 14e4:1639 (rev 20)
02:00.1 0200: 14e4:1639 (rev 20)
03:00.0 0104: 1000:0079 (rev 05)
06:03.0 0300: 102b:0532 (rev 0a)

If you want to display both the description and the number, use the option -nn.

# lspci -nn
01:00.0 Ethernet controller [0200]: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet [14e4:1639] (rev 20)
03:00.0 RAID bus controller [0104]: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] [1000:0079] (rev 05)
06:03.0 VGA compatible controller [0300]: Matrox Electronics Systems Ltd. MGA G200eW WPCM450 [102b:0532] (rev 0a)
..

Lookup a Specific Device

When you know the slot number in the domain:bus:slot.func format, you can query for a particular device.

# lspci -s 03:00.0
03:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 05)

When you know the device number in the vendor:device format, you can query for a particular device.

# lspci -d 1000:0079
03:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 05)

If you know only either the vendor id, or the device id, you can omit the other id. For example, both the following command will return the same output as the above.

lspci -d :0079
lspci -d 1000:

Display Kernel Drivers

This is very helpful when you like to know the name of the kernel module that will be handling the operations of a particular device.

# lspci -k
00:1f.2 IDE interface: Intel Corporation 82801IB (ICH9) 2 port SATA Controller [IDE mode] (rev 02)
        Subsystem: Dell PowerEdge R610 SATA IDE Controller
        Kernel driver in use: ata_piix
        Kernel modules: ata_generic, pata_acpi, ata_piix
02:00.0 Ethernet controller: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)
        Subsystem: Dell PowerEdge R610 BCM5709 Gigabit Ethernet
        Kernel driver in use: bnx2
        Kernel modules: bnx2
03:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 05)
        Subsystem: Dell PERC H700 Integrated
        Kernel driver in use: megaraid_sas
        Kernel modules: megaraid_sas

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s