简介:
lspci
命令是 Linux 下一个查看 PCI 总线设备的程序,提供了详细的硬件信息,包括硬件 ID、制造商、设备型号等等。它能够显示在 Linux 系统上连接到系统总线的所有 PCI 设备。
语法:
lspci [option]
常用参数:
-n 显示完整ID信息
-v 显示更详细的信息
-t 以总线层次方式显示
使用方法:
- 查看 PCI 设备信息:
lspci
以上命令会列出系统中所有的设备,包括它们各自的 PCI 总线编号和产品代码等信息。
示例输出:
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 05)
...
输出信息中,每一行的开头是设备的总线号码和设备号码。
- 查看 PCI 设备完整ID信息:
lspci -nn
-n 选项显示硬件设备的完整 ID 信息。
示例输出:
00:00.0 Host bridge [0600]: Intel Corporation 2nd Generation Core Processor Family DRAM Controller [8086:0100] (rev 09)
00:01.0 PCI bridge [0604]: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port [8086:0101] (rev 09)
00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0116] (rev 09)
00:16.0 Communication controller [0780]: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 [8086:1c3a] (rev 04)
00:1a.0 USB controller [0c03]: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 [8086:1c2d] (rev 05)
...
以上输出信息中,方括号内的数字是设备的制造商 ID 和设备代码 ID。
- 查看 PCI 设备详细信息:
lspci -v
-v 选项会显示更详细的信息,包括设备的 IRQ、I/O 端口等信息。
示例输出:
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7670
Flags: bus master, fast devsel, latency 0
Capabilities: <access denied>
Kernel driver in use: snb_uncore
Kernel modules: i7core_edac
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09) (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0, IRQ 24
Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
Memory behind bridge: dfa00000-dfbfffff
Capabilities: <access denied>
Kernel driver in use: pcieport
Kernel modules: shpchp
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09) (prog-if 00 [VGA controller])
Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7670
Flags: bus master, fast devsel, latency 0, IRQ 26
Memory at d0000000 (64-bit, non-prefetchable) [size=4M]
Memory at c0000000 (64-bit, prefetchable) [size=256M]
I/O ports at f000 [size=64]
Expansion ROM at <unassigned> [disabled]
Capabilities: <access denied>
Kernel driver in use: i915
Kernel modules: i915
00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)
Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7670
Flags: bus master, fast devsel, latency 0, IRQ 19
Memory at dfb25000 (64-bit, non-prefetchable) [size=16]
Capabilities: <access denied>
Kernel driver in use: mei_me
Kernel modules: mei_me
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 05) (prog-if 20 [EHCI])
Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7670
Flags: bus master, medium devsel, latency 0, IRQ 16
Memory at dfb24000 (32-bit, non-prefetchable) [size=1K]
Capabilities: <access denied>
Kernel driver in use: ehci-pci
Kernel modules: ehci_pci
...
以上输出信息中,每个设备的详细信息之间用空行隔开。
总结:
lspci 是 Linux 查看 PCI 设备信息的重要工具,用法非常简便,可以通过添加不同的选项来查询硬件设备的完整 ID 信息以及更详细的信息,非常方便用户进行硬件故障检测和查看设备配置。