Linux list all pci devices

PCI Devices in Linux

A PCI device is any piece of computer hardware that plugs directly into a PCI slot on a computer’s motherboard. PCI, which stands for Peripheral Component Interconnect, was introduced to personal computers by the Intel Corporation in 1993. The technology to operate PCI is integrated into the motherboard of nearly every personal computer manufactured since 1995. A PCI connection on a motherboard can be identified as a long strip of raised copper connectors encased in plastic. This long strip of connectors is usually called a bus. The PCI bus is not as fast as the system bus. Its primary purpose is to facilitate communication of hardware devices of all types such as audio, video, network or graphics with the microprocessor.

Command to list down all PCI devices in linux system.

The lspci command is used to display detailed information about all PCI buses and devices in the server or desktop or laptop powered by Linux operating system.
lspci
lspci –tv command will list down all the PCI as tree structure because of –t and due to -v shows the device vendors and names.
tree pci
lspci -k shows the kernel driver that is being used to handle the respective PCI device
kernel pci
lspci -m is used 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.
-m
lspci -n 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.
-n

lspci

Here In the system I have 10 PCI powered by the Linux operating system.

  1. Host Bridge — The «Host Bridge» is what connects the tree of PCI busses (which are internally connected with PCI-to-PCI Bridges) to the rest of the system.
  2. ISA Bridge – ISA Stands for Industry Standard Architecture. PCI to ISA bridge is the most common method of interfacing ISA devices to modern chipsets. In most respects, these devices perform like a standard PCI device.
  3. IDE interface — Integrated Drive Electronics is for connection of storages devices such as Hard Disk Drives (HDD), Solid State Drives (SSD) and CD/DVD drives to the computer.
  4. VGA compatible controller — VGA stands for Video Graphics Array. VGA Controller is the digital circuit designed to drive VGA displays.
  5. Ethernet controller — Ethernet controller allows you to make a wired connection to a computer network. This provides access to the network programs and resources, including a high-speed Internet connection.
  6. System peripheral — It is any external device that provides input and output for the computer. For example, a keyboard and mouse
  7. Multimedia audio controller — Multimedia audio controller drivers allow your operating system to communicate with the sound hardware such as your speakers, headphones, etc. Thus, if there is a problem with these drivers, your connected audio devices won’t work properly.
  8. USB controller — USB controller is an interface that allows an enabled piece of hardware to interact and communicate with a particular piece of software.
  9. Bridge — Bridge is a device that connects a PCI bus to either another PCI bus or a bus of a different standard
  10. SATA controller — SATA controller is a hardware interface that connects a hard drive to a computer’s motherboard and manages or directs the flow of data
Читайте также:  Нет звука linux kali 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.

Читайте также:  1с бухгалтерия под линукс

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