lspci,顾名思义,就是显示所有的pci设备信息。pci是一种总线,而通过pci总线连接的设备就是pci设备了。如今,我们常用的设备很多都是采用pci总线了,如:网卡、存储等。下面就简单介绍下该命令。
lspci:显示所有的pci设备信息。包括设备的BDF,设备类型,厂商信息等。
lspci -t [BDF]:显示指定BDF号的设备信息。
lspci -m/-mm:以一种机器可读的格式来显示pci设备信息。下面的实例可以看出其具体的区别。
# lspci -s ff:13.1
ff:13.1 System peripheral: Intel Corporation Broadwell Memory Controller 0 - Target Address/Thermal/RAS (rev 03)
# lspci -mm -s ff:13.1
ff:13.1 "System peripheral" "Intel Corporation" "Broadwell Memory Controller 0 - Target Address/Thermal/RAS" -r03 "Intel Corporation" "Broadwell Memory Controller 0 - Target Address/Thermal/RAS"
lspci -t:以树的形式显示pci设备信息。
lspci -v/-vv/-vvv:显示详细的pci设备信息,v越多,越详细,当然,上限3个。
# lspci -s ff:1f.2
ff:1f.2 System peripheral: Intel Corporation Broadwell Power Control Unit (rev 03)
# lspci -v -s ff:1f.2
ff:1f.2 System peripheral: Intel Corporation Broadwell Power Control Unit (rev 03)
Flags: fast devsel
# lspci -vv -s ff:1f.2
ff:1f.2 System peripheral: Intel Corporation Broadwell Power Control Unit (rev 03)
Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
# lspci -vvv -s ff:1f.2
ff:1f.2 System peripheral: Intel Corporation Broadwell Power Control Unit (rev 03)
Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
lspci -x/-xxx/-xxxx:-x以16进制信息显示pci配置空间;-xxx显示部分读配置空间会crash的设备;-xxxx显示PCI-x2.0或者PCI-e总线扩展的配置空间。
lspci -b:以总线的角度来显示所有的IRQ和地址。根据我的观察,大部分信息和不带参数时显示一致,除了SR-IOV设备分配出的Virtual Function设备。如下示例:物理网卡PF(physical function )显示一直 ,但VF(virtual function )显示却不同。
# lspci -b -s 0a:00.1; lspci -b -s 0a:10.0
0a:00.1 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 01)
0a:10.0 Ethernet controller: Illegal Vendor ID Device ffff (rev 01)
# lspci -s 0a:00.1; lspci -s 0a:10.0
0a:00.1 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 01)
0a:10.0 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01)
lspci -D:显示PCI domain号,默认的不加参数命令并不显示该值。如下示例:
# lspci -s 0a:00.0
0a:00.0 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 01)
# lspci -D -s 0a:00.0
0000:0a:00.0 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 01)
lspci -n/-nn:显示设备的vendor厂商号和device设备号;显示厂商等信息和名称。
# lspci -nn | grep ff:1f.2
ff:1f.2 System peripheral [0880]: Intel Corporation Broadwell Power Control Unit [8086:6f8a] (rev 03)
# lspci -n | grep ff:1f.2
ff:1f.2 0880: 8086:6f8a (rev 03)
lspci -D:显示设备的厂商号、设备号、Class号。
# lspci -Q -s 0c:00.1
0c:00.1 Class 0200: Device 8086:1528 (rev 01)