Wednesday, June 3, 2009

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


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

<3>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

No comments:

Post a Comment

tag ur valuable ideas below