Listing pci devices linux

7 Linux lspci Command Examples to Get PCI Bus Hardware Device Info

lspci stands for list pci. Think of this command as “ls” + “pci”. This will display information about all the PCI bus in your server. Apart from displaying information about the bus, it will also display information about all the hardware devices that are connected to your PCI and PCIe bus. For example, it will display information about Ethernet cards, RAID controllers, Video cards, etc.

lspci utility is part of the pciutils package. If you don’t have pciutilis, install it on your system as shown below.

1. Default Usage

By default it will display all the device information as shown below. The first field is the slot information in this format: [domain:]bus:device.function In this example, since all the domain are 0, lspci will not display the domain.

# 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)

Note: In all the examples below, we’ll be showing only partial output by picking couple of devices from the above list.

Читайте также:  Sql plus in linux

2. 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) as shown below. 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"

3. 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 as shown below. 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

4. 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. In the following example, I’ve given output of only the RAID controller device.

# 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

5. 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)
# 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) ..

6. Lookup a Specific Device

When you know the slot number in the domain:bus:slot.func format, you can query for a particular device as shown below. In the following example, we didn’t specify the domain number, as it is 0, which can be left out.

# 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 as shown below.

# 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:

7. 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. Please note that this option will work only on Kernel 2.6 version and above.

# 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

Источник

Оцените статью
Adblock
detector