Skip to content

Lspci command on Linux (shows PCI devices)

During the system load process, the Kernel detects the PCI devices connected to the micro. The list of expansion cards found can be read using the lspci command.

The lspci Command in Linux is useful for showing all the information about the system’s PCI buses and the devices connected to them.

Your most common options are:

  • -v Shows detailed information about all devices.
  • -vv shows even more information about the devices.
  • -n Shows the codes of the manufacturers and devices.
  • -x. Shows the first 64 bytes of the PCI configuration in hexadecimal.
  • -xxx Shows the entire PCI configuration in hexadecimal.

Example of use:

$ lspci
00:00 .0 Host bridge: ALi Corporation M1541 (rev 04)
00:01 .0 PCI bridge: ALi Corporation M1541 PCI to AGP Controller (rev 04)
00:02 .0 USB Controller: ALi Corporation USB 1.1 Controller (rev 03)
00:03 .0 Bridge: ALi Corporation M7101 PMU
00:07 .0 ISA bridge: ALi Corporation M1533 PCI to ISA Bridge [Aladdin IV]
00:09 .0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)
00:0 b.0 SCSI storage controller: Adaptec AHA-2940/2940W/AIC-7871
00:0 f.0 IDE interface: ALi Corporation M5229 IDE (rev c1)
01:00 .0 VGA compatible controller: nVidia/SGS Thomson (Joint Venture) Riva128 (rev 10)

Models that use the PCI bus most of the time dispense with the manual configuration of the resources expended.

You can check the addressing and interruption of the devices by consulting the contents of the /proc/interrupts and /proc/ioports files.

$ cat /proc/interrupts
CPU0
0:288898893 XT-PIC timer
1:230 XT-PIC keyboard
2:0 XT-PIC cascade
5:7085061 XT-PIC eth0
8:2 XT-PIC etc
90: XT-PIC usb-ohci
10:152038 XT-PIC aic7xxx
12:411599 XT-PIC eth1
14:2 XT-PIC ide0

To check the entry and exit ports:

$ cat /proc/ioports
0000-001f: dma1
0020-003f: pic1
0040-005f: timer
0060-006f: keyboard
0070-007f: rtc
0080-008f: dma page reg
5c20-5c3f: Ali Corporation. [ALi] M7101 PMU
b800-b80f: Ali Corporation. [ALi] M5229 IDE
d000-d0ff: Adaptec AHA-2940/2940W/AIC-7871
d000-d0ff: aic7xxx
d400-d4ff: 8139too
d800-d8ff: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+

Thus, to enable the hardware, the kernel module corresponding to the device must be loaded. To load the module, you must use the modprobe command followed by the module name:

# modprobe 8139too

Some non-PCI cards require I/O addressing and IRQ to be entered as arguments for the modprobe command to allocate resources correctly:

# modprobe ne io=0x300 irq=10

Learn much more about Linux in our online course. You can register here. If you already have an account, or want to create one, just log in or create your user here.

Did you like it?

Share