Linux Find Out If PCI Hardware Supported or Not In The Current Running Kernel

by on June 3, 2009 · 10 comments· LAST UPDATED June 18, 2009

in , ,

A typical question from my mailbag:

How do I find out if a given PCI hardware is supported of by the current CentOS / Debian / RHEL / Fedora Linux kernel?

You can easily find out find out if a given piece of PCI hardware such as RAID, network, sound, graphics card is supported or not by the current Linux kernel using the following utilities under any Linux distributions.

Required Tools

  1. /lib/modules/$(uname -r)/modules.pcimap : This file is automatically generated by depmod, and used by pcimodules command to determine which modules correspond to which PCI ID's. You need to use this file to find out if driver is supported or not.
  2. lspci command - list and query all PCI devices connected to the system.

Use lspci Command To List All PCI Devices

Will an Intel Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller Card be taken care of by a Linux kernel 2.6.27-11-server?
$ lspci
$ lspci | grep -i audio

Sample Output:

00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 01)

Note down the identifier in first field i.e. 00:1b.0. Now use lspci -n as follows to get result for device 00:1b.0.
$ lspci -n | grep 00:1b.0
Sample Output:

00:1b.0 0403: 8086:27d8 (rev 01)

Where,

  • 00:1b.0 - Device
  • 8086 - constructor code for Intel Corporation
  • 27d8 - The model id.

Use the model id to search driver, as follows:
$ grep 27d8 /lib/modules/$(uname -r)/modules.pcimap
Sample Output:

snd-hda-intel        0x00008086 0x000027d8 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0

snd-hda-intel is kernel driver handling PCI audio device. You can get more information about this driver by typing the following:
$ modinfo snd-hda-intel
$ modinfo snd-hda-intel| egrep 'description|filename|depends'

Sample Output:

filename:       /lib/modules/2.6.27-11-server/kernel/sound/pci/hda/snd-hda-intel.ko
description:    Intel HDA driver
depends:        snd-pcm,snd-page-alloc,snd

Another example - Will an Adaptec AAC-RAID SCSI SA Card work with Linux kernel v2.6.18-128.1.10.el5 (CentOS / RHEL 5 kernel)?

Type the following commands:
$ lspci | grep -i RAID
Output:

07:0e.0 RAID bus controller: Adaptec AAC-RAID

Get device id:
$ lspci -n | grep '07:0e.0'
Output:

07:0e.0 0104: 9005:0285

Search for device id to driver mapping:
$ grep 0285 /lib/modules/$(uname -r)/modules.pcimap
Output:

aacraid              0x00009005 0x00000285 0x00009005 0x00000286 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00009005 0x00000285 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00009005 0x00000287 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x000017aa 0x00000286 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x000017aa 0x00000287 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00009005 0x00000288 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00009005 0x00000289 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00009005 0x0000028a 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00009005 0x0000028b 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00009005 0x000002a4 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00009005 0x000002a5 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00009005 0x0000028e 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00009005 0x0000028f 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00009005 0x00000290 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00001028 0x00000291 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00009005 0x00000292 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00009005 0x00000293 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00009005 0x00000294 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x0000103c 0x00003227 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00009005 0x00000296 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00009005 0x00000297 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00001014 0x000002f2 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00001014 0x00000312 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00009005 0x00000298 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00009005 0x00000299 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00009005 0x0000029a 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00001028 0x00000287 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x00001028 0xffffffff 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0x000017aa 0xffffffff 0x00000000 0x00000000 0x0
aacraid              0x00009005 0x00000285 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
ata_piix             0x00008086 0x00002850 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0

Get detailed information about aacraid driver:
$ modinfo aacraid | egrep 'description|filename|depends'
Output:

filename: filename:       /lib/modules/2.6.18-128.1.10.el5/kernel/drivers/scsi/aacraid/aacraid.ko
description:    Dell PERC2, 2/Si, 3/Si, 3/Di, Adaptec Advanced Raid Products, HP NetRAID-4M, IBM ServeRAID & ICP SCSI driver
depends:        scsi_mod

Task: Show kernel drivers handling each device and also kernel modules capable of handling it

Pass the -k option (works with latest lspci version only):
$ lspci -k
Sample Output:

00:00.0 Host bridge: Intel Corporation 82975X Memory Controller Hub
	Kernel modules: i82975x_edac
00:01.0 PCI bridge: Intel Corporation 82975X PCI Express Root Port
	Kernel driver in use: pcieport-driver
	Kernel modules: shpchp
00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 01)
	Kernel driver in use: HDA Intel
	Kernel modules: snd-hda-intel
00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 01)
	Kernel driver in use: pcieport-driver
	Kernel modules: shpchp
00:1c.4 PCI bridge: Intel Corporation 82801GR/GH/GHM (ICH7 Family) PCI Express Port 5 (rev 01)
	Kernel driver in use: pcieport-driver
	Kernel modules: shpchp
00:1c.5 PCI bridge: Intel Corporation 82801GR/GH/GHM (ICH7 Family) PCI Express Port 6 (rev 01)
	Kernel driver in use: pcieport-driver
	Kernel modules: shpchp
00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 (rev 01)
	Kernel driver in use: uhci_hcd
	Kernel modules: uhci-hcd
00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 (rev 01)
	Kernel driver in use: uhci_hcd
	Kernel modules: uhci-hcd
00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 (rev 01)
	Kernel driver in use: uhci_hcd
	Kernel modules: uhci-hcd
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 (rev 01)
	Kernel driver in use: uhci_hcd
	Kernel modules: uhci-hcd
00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 01)
	Kernel driver in use: ehci_hcd
	Kernel modules: ehci-hcd
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1)
00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)
	Kernel modules: intel-rng, iTCO_wdt
00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 01)
	Kernel driver in use: ata_piix
	Kernel modules: ata_piix
00:1f.2 IDE interface: Intel Corporation 82801GB/GR/GH (ICH7 Family) SATA IDE Controller (rev 01)
	Kernel driver in use: ata_piix
	Kernel modules: ata_piix
00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 01)
	Kernel driver in use: i801_smbus
	Kernel modules: i2c-i801
01:00.0 VGA compatible controller: nVidia Corporation Quadro FX 570 (rev a1)
	Kernel driver in use: nvidia
	Kernel modules: nvidia, nvidiafb
03:00.0 SATA controller: Marvell Technology Group Ltd. 88SE6145 SATA II PCI-E controller (rev a1)
	Kernel driver in use: pata_marvell
	Kernel modules: ahci, pata_marvell
04:00.0 Ethernet controller: Intel Corporation 82573E Gigabit Ethernet Controller (Copper) (rev 03)
	Kernel driver in use: e1000e
	Kernel modules: e1000e
04:00.3 Serial controller: Intel Corporation Active Management Technology - SOL (rev 03)
	Kernel driver in use: serial
04:00.4 IPMI SMIC interface: Intel Corporation 82573E KCS (Active Management) (rev 03)
05:02.0 Ethernet controller: Marvell Technology Group Ltd. 88w8335 [Libertas] 802.11b/g Wireless (rev 03)
	Kernel driver in use: ndiswrapper
05:04.0 FireWire (IEEE 1394): Texas Instruments TSB43AB23 IEEE-1394a-2000 Controller (PHY/Link)
	Kernel driver in use: ohci1394
	Kernel modules: ohci1394

Task: Lists all driver modules for all currently plugged in PCI devices

Type the pcimodules command (again you need updated pciutils package):
$ pcimodules
Sample Output:

ohci1394
ipmi_si
e1000e
ahci
pata_marvell
nvidia
nvidiafb
i2c-i801
ata_piix
ata_generic
pata_acpi
ata_piix
ata_generic
pata_acpi
intel-rng
iTCO_wdt
ehci-hcd
uhci-hcd
shpchp
snd-hda-intel
shpchp
i82975x_edac

Task: Update pci.ids Database

/usr/share/hwdata/pci.ids file is all known ID's used in PCI devices: ID's of vendors, devices, subsystems and device classes. You can update this database by typing the following command at a shell prompt:
$ update-pciids

Suggested Readings:

  1. Linux - lspci command to list and find out more information about all PCI devices.
  2. Linux find out or display IDs for adapters installed in a server
  3. Linux find out my VIDEO Card Memory RAM size using command line utility
  4. The PCI Utilities - The PCI Utilities are a collection of programs for inspecting and manipulating configuration of PCI devices, all based on a common portable library libpci which offers access to the PCI configuration space on a variety of operating systems.
  5. The PCI ID Repository - This is a public repository of all known ID's used in PCI devices: ID's of vendors, devices, subsystems and device classes. It is used in various programs (e.g., The PCI Utilities) to display full human-readable names instead of cryptic numeric codes.
  6. man pages lspci, update-pciids, and pcimodules
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 10 comments… read them below or add one }

1 Debian64 June 4, 2009 at 8:17 am

Question: how can I find out the state of the RAID from lspci ?

For example if I have a RAID 1 with 4 HDD’s or a RAID 5 or 6 how can I find out
the health of the RAID matrix ?

Reply

2 nixCraft June 5, 2009 at 3:48 am

@ Debian64,

You can’t use lspci. You need to use RAID utility supplied by vendor. For e.g. Adaptec RAID (standard on IBM/HP/Dell servers) can be controlled via arcconf getconfig 1 command.

See Linux Check The Health of Adaptec RAID array and Linux Check Health of 3ware RAID Array

Reply

3 ashwani June 5, 2009 at 12:24 pm

Thanks for nice info

but man lspci -k doesnt work and i have just donwloaded rhel5 5.3 today its fully updated
and pls tell which package provides pcimodules becoz its seems to be not available here.

Reply

4 ashwani June 5, 2009 at 12:27 pm

i just checked i have pciutils package installed its pciutils.2.2.3.-4.i386 do i need newer than this?

Reply

5 nixCraft June 5, 2009 at 1:07 pm

Yes, you need latest version. RHEL usually runs stable and older version for all packages. My current version is 3.0.x

Reply

6 George June 11, 2009 at 2:52 am

Correct me if I’m wrong, but if you want to see if a given PCI hardware is supported by your kernel, shouldn’t you be able to do this without first inserting the PCI card in the server and seeing that is detected properly?

Reply

7 nixCraft June 11, 2009 at 9:22 am

You can do that if you know PCI ID in advance. You can skip lspci step.

Reply

8 shasikanta September 7, 2009 at 12:57 pm

Hai, Please help me install NIC card in my PC, I am new to LINUX and dont have much idea. Card model is Realtek RTL8169/8110 Family Gigabit NIC. I have downloaded driver from Realtek site. and name of the folder is r8169-6.011.00.tar.bz2. so please help me to install.

Reply

9 Michel April 21, 2010 at 1:25 pm

Hi, great I really can use this.

You can do the same with USB

michel@server:~/scripts => lsusb | grep Realtek
Bus 001 Device 127: ID 0bda:8187 Realtek Semiconductor Corp. RTL8187 Wireless Adapter
michel@server:~/scripts => sudo grep 0bda /lib/modules/$(uname -r)/modules.usbmap | cut -d" " -f1 | sort -u
rtl8187
michel@server:~/scripts => sudo modinfo rtl8187 | egrep 'description|filename|depends'
filename:       /lib/modules/2.6.31.9-grsec-nsas/kernel/drivers/net/wireless/rtl818x/rtl8187.ko
description:    RTL8187/RTL8187B USB wireless driver
depends:        mac80211,eeprom_93cx6

Reply

10 deutsch July 27, 2012 at 10:23 am

Is it possible to find out, to which PCI my USB 2.0 is attached?

lsusb

Bus 001 Device 003: ID 046d:0b06 Logitech, Inc.
Bus 002 Device 003: ID 046d:c03e Logitech, Inc. Premium Optical Wheel Mouse (M-BT58)
Bus 001 Device 006: ID 046d:c709 Logitech, Inc. BT Mini-Receiver (HCI mode)
Bus 001 Device 004: ID 046d:c71b Logitech, Inc.
Bus 001 Device 005: ID 046d:c71c Logitech, Inc.

lspci | grep USB
00:1a.0 USB controller: Intel Corporation X79 series chipset USB2 Enhanced Host Controller #2 (rev 06)
00:1d.0 USB controller: Intel Corporation X79 series chipset USB2 Enhanced Host Controller #1 (rev 06)
07:00.0 USB controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 04)
08:00.0 USB controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 04)

p.s. I need it for USB passthrough of the whole controller for Xen (instead of USB passthrough I will use PCI passthrough).

Reply

Leave a Comment

Tagged as: , , , , , , , , , ,

Previous post:

Next post: