(Apologies to "mj" for duplicate send, the mailing list subscription was finally sorted out.) The attached perl script tries to use lspci -n and the information in /sys/devices and /lib/modules/$kernel/modules.alias to describe the PCI devices on the system. I'm trying to make it tease out what drivers are built in (from /sys/devices) and which are loaded as modules (from /lib/modules). While overall this resembles the output of "lspci -k" there are a few differences I cannot explain yet. On an old IBM server the outputs are: lspci -k 00:01.0 PCI bridge: Broadcom BCM5785 [HT1000] PCI/PCI-X Bridge Kernel modules: shpchp 00:02.0 Host bridge: Broadcom BCM5785 [HT1000] Legacy South Bridge Subsystem: IBM BCM5785 [HT1000] Legacy South Bridge Kernel driver in use: piix4_smbus Kernel modules: i2c_piix4 00:02.1 IDE interface: Broadcom BCM5785 [HT1000] IDE Subsystem: IBM BCM5785 [HT1000] IDE Kernel driver in use: pata_serverworks Kernel modules: pata_serverworks, pata_acpi 00:02.2 ISA bridge: Broadcom BCM5785 [HT1000] LPC Subsystem: IBM BCM5785 [HT1000] LPC 00:03.0 USB controller: Broadcom BCM5785 [HT1000] USB (rev 01) Subsystem: IBM BCM5785 [HT1000] USB Kernel driver in use: ohci-pci 00:03.1 USB controller: Broadcom BCM5785 [HT1000] USB (rev 01) Subsystem: IBM BCM5785 [HT1000] USB Kernel driver in use: ohci-pci 00:03.2 USB controller: Broadcom BCM5785 [HT1000] USB (rev 01) Subsystem: IBM BCM5785 [HT1000] USB Kernel driver in use: ehci-pci 00:05.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] ES1000 (rev 02) Subsystem: IBM ES1000 Kernel driver in use: radeon Kernel modules: radeonfb, radeon 00:06.0 PCI bridge: Broadcom HT2100 PCI-Express Bridge (rev a2) Kernel driver in use: pcieport Kernel modules: shpchp 00:07.0 PCI bridge: Broadcom HT2100 PCI-Express Bridge (rev a2) Kernel driver in use: pcieport Kernel modules: shpchp 00:08.0 PCI bridge: Broadcom HT2100 PCI-Express Bridge (rev a2) Kernel driver in use: pcieport Kernel modules: shpchp 00:09.0 PCI bridge: Broadcom HT2100 PCI-Express Bridge (rev a2) Kernel driver in use: pcieport Kernel modules: shpchp 00:0a.0 PCI bridge: Broadcom HT2100 PCI-Express Bridge (rev a2) Kernel driver in use: pcieport Kernel modules: shpchp 00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration 00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] K8 [Athlon64/Opteron] Address Map 00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] K8 [Athlon64/Opteron] DRAM Controller 00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] K8 [Athlon64/Opteron] Miscellaneous Control Kernel driver in use: k8temp Kernel modules: k8temp 00:19.0 Host bridge: Advanced Micro Devices, Inc. [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration 00:19.1 Host bridge: Advanced Micro Devices, Inc. [AMD] K8 [Athlon64/Opteron] Address Map 00:19.2 Host bridge: Advanced Micro Devices, Inc. [AMD] K8 [Athlon64/Opteron] DRAM Controller 00:19.3 Host bridge: Advanced Micro Devices, Inc. [AMD] K8 [Athlon64/Opteron] Miscellaneous Control Kernel driver in use: k8temp Kernel modules: k8temp 01:0d.0 PCI bridge: Broadcom BCM5785 [HT1000] PCI/PCI-X Bridge (rev c0) Kernel modules: shpchp 01:0e.0 RAID bus controller: Broadcom BCM5785 [HT1000] SATA (Native SATA Mode) Subsystem: IBM BCM5785 [HT1000] SATA (Native SATA Mode) Kernel driver in use: sata_svw Kernel modules: sata_svw 02:01.0 Ethernet controller: Broadcom Inc. and subsidiaries NetXtreme BCM5704 Gigabit Ethernet (rev 10) Subsystem: IBM NetXtreme BCM5704 Gigabit Ethernet Kernel driver in use: tg3 Kernel modules: tg3 02:01.1 Ethernet controller: Broadcom Inc. and subsidiaries NetXtreme BCM5704 Gigabit Ethernet (rev 10) Subsystem: IBM NetXtreme BCM5704 Gigabit Ethernet Kernel driver in use: tg3 Kernel modules: tg3 03:00.0 Mass storage controller: Silicon Image, Inc. SiI 3132 Serial ATA Raid II Controller (rev 01) Subsystem: Silicon Image, Inc. SiI 3132 Serial ATA Raid II Controller Kernel driver in use: sata_sil24 Kernel modules: sata_sil24 06:00.0 Ethernet controller: Intel Corporation 82572EI Gigabit Ethernet Controller (Copper) (rev 06) Subsystem: Intel Corporation PRO/1000 PT Desktop Adapter Kernel driver in use: e1000e Kernel modules: e1000e root@keyserver3:/tmp# lspci -k | head 00:01.0 PCI bridge: Broadcom BCM5785 [HT1000] PCI/PCI-X Bridge Kernel modules: shpchp 00:02.0 Host bridge: Broadcom BCM5785 [HT1000] Legacy South Bridge Subsystem: IBM BCM5785 [HT1000] Legacy South Bridge Kernel driver in use: piix4_smbus Kernel modules: i2c_piix4 00:02.1 IDE interface: Broadcom BCM5785 [HT1000] IDE Subsystem: IBM BCM5785 [HT1000] IDE Kernel driver in use: pata_serverworks Kernel modules: pata_serverworks, pata_acpi vs. ./map_hardware_to_drivers.pl /tmp/pci.ids Checking this machine for drivers Getting Device ID list from https://pci-ids.ucw.cz/v2.2/pci.ids Getting PCI ID to builtin mappings from /sys/bus/pci/drivers Getting PCI ID to kernel module name mappingsChecking pci and device IDs from lspci -n pci_id dev_id driver description 00:01.0 1166:0036 "BCM5785 [HT1000] PCI/PCI-X Bridge" 00:02.0 1166:0205 i2c_piix4(module)/piix4_smbus(builtin) "BCM5785 [HT1000] Legacy South Bridge" 00:02.1 1166:0214 pata_serverworks(module)/pata_serverworks(builtin) "BCM5785 [HT1000] IDE" 00:02.2 1166:0234 "BCM5785 [HT1000] LPC" 00:03.0 1166:0223 ohci-pci(builtin) "BCM5785 [HT1000] USB" 00:03.1 1166:0223 ohci-pci(builtin) "BCM5785 [HT1000] USB" 00:03.2 1166:0223 ehci-pci(builtin) "BCM5785 [HT1000] USB" 00:05.0 1002:515E radeonfb(module)/radeon(builtin) "ES1000" 00:06.0 1166:0140 pcieport(builtin) "HT2100 PCI-Express Bridge" 00:07.0 1166:0142 pcieport(builtin) "HT2100 PCI-Express Bridge" 00:08.0 1166:0144 pcieport(builtin) "HT2100 PCI-Express Bridge" 00:09.0 1166:0142 pcieport(builtin) "HT2100 PCI-Express Bridge" 00:0a.0 1166:0144 "HT2100 PCI-Express Bridge" 00:18.0 1022:1100 "K8 [Athlon64/Opteron] HyperTransport Technology Configuration" 00:18.1 1022:1101 "K8 [Athlon64/Opteron] Address Map" 00:18.2 1022:1102 "K8 [Athlon64/Opteron] DRAM Controller" 00:18.3 1022:1103 k8temp(module)/k8temp(builtin) "K8 [Athlon64/Opteron] Miscellaneous Control" 00:19.0 1022:1100 "K8 [Athlon64/Opteron] HyperTransport Technology Configuration" 00:19.1 1022:1101 "K8 [Athlon64/Opteron] Address Map" 00:19.2 1022:1102 "K8 [Athlon64/Opteron] DRAM Controller" 00:19.3 1022:1103 k8temp(module)/k8temp(builtin) "K8 [Athlon64/Opteron] Miscellaneous Control" 01:0d.0 1166:0104 "BCM5785 [HT1000] PCI/PCI-X Bridge" 01:0e.0 1166:024A sata_svw(module) "BCM5785 [HT1000] SATA (Native SATA Mode)" 02:01.0 14E4:1648 tg3(module)/tg3(builtin) "NetXtreme BCM5704 Gigabit Ethernet" 02:01.1 14E4:1648 tg3(module)/tg3(builtin) "NetXtreme BCM5704 Gigabit Ethernet" 03:00.0 1095:3132 sata_sil24(module)/sata_sil24(builtin) "SiI 3132 Serial ATA Raid II Controller" 06:00.0 8086:10B9 e1000e(module)/e1000e(builtin) "82572EI Gigabit Ethernet Controller (Copper)" Done Things I do not understand: 1. Devices 00:01.0 and 01:0d.0 show "Kernel modules: shpchp" in "lspci -k". Where is "lspci -k" getting that information? "ls /sys/module/shpch" does not indicate any links to those devices, nor do those devices have any links to that module/driver. The others devices do link to their drivers (and vice versa), for instance: ls -al /sys/devices/pci0000:00/0000:00:02.1 | grep drivers lrwxrwxrwx 1 root root 0 Mar 16 13:47 driver -> ../../../bus/pci/drivers/pata_serverworks ls -al /sys/bus/pci/drivers/pata_serverworks | grep devices lrwxrwxrwx 1 root root 0 Mar 16 13:48 0000:00:02.1 -> ../../../../devices/pci0000:00/0000:00:02.1 2. I describe the /sys/module heirarchy as "builtin", assuming that all the drivers in it are compiled into the running kernel. Is that actually true or will modules from /lib/modules/ show up in there too when they are loaded? If the latter is the case, how does one determine what is actually built into the kernel and what was added later? 3. lsmod shows which modules are loaded. Is there anything similar to show which builtin kernel drivers are being used? Or is deterimining which driver is in use an either/or sort of thing. For instance, for 06:00.0 the driver is e1000e for both builtin and module, and lsmod shows e1000e, so that is the module and not the builtin in use. If lsmod did not show it then it would be the builtin. That seems to be the case for these two: 00:03.1 1166:0223 ohci-pci(builtin) "BCM5785 [HT1000] USB" 00:03.2 1166:0223 ehci-pci(builtin) "BCM5785 [HT1000] USB" Thank you, David Mathog mathog@caltech.edu Manager, Sequence Analysis Facility, Biology Division, Caltech