How to obtain the pci id of a device in Linux
Sometimes, you need to use the pci ID of the device during development. For example, to bind a network card with dpdk, you need to use the pci ID of the network card. The following methods can be used to obtain the pci ID.
1. Use the lspci command.
For example
. 0 USB controller: Intel Corporation 82371AB/EB/MB PIIX4 USB
. 0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
. 0 Multimedia audio controller: Ensoniq ES1371/Creative Labs CT2518 [AudioPCI-97] (rev 02)
. 0 USB controller: VMware USB2 EHCI Controller
The first column is the pci id, followed by the device name and supplier name. The pci id of the Ethernet card is. 0.
However, in some embedded systems, the lspci command is not provided by pciutils, but by other software packages or modified. The output result may be as follows:
The preceding result is the same as that of CentOS. It is started with an embedded kernel + ramfs. The command is lspci-vmm.
In this case, only the http://www.pcidatabase.com/find the corresponding Vendor and Device, and then one by one comparison.
For example,. 0 is 8086 and 100f.
0x100F Intel (R) PRO/1000 MT Network Connection 0x8086 Intel Corporation
2. Run the dmesg command.
For example
E1000 restart :0:01. 0: pci int a-> GSI 19 (level, low)-> IRQ 19
E1000 release :0:01. 0: setting latency timer to 64
E1000 :0:01. 0: eth0: (PCI: 66 MHz: 32-bit) 00: 0c: 29: 62: d0: 69
E1000. 0: eth0: Intel (R) PRO/1000 Network Connection
You can also see that the pci id of the Ethernet card is. 0.
This method is applicable to general releases or custom embedded systems.
This article permanently updates the link address: