在 Linux 使用 lspci 只要可以看到目前系統所有的裝置.
[root@benjr ~]# lspci 00:00.0 Host bridge: Intel Corporation 3200/3210 Chipset DRAM Controller (rev 01) 00:01.0 PCI bridge: Intel Corporation 3200/3210 Chipset Host-Primary PCI Express Bridge (rev 01) 00:1a.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 (rev 02) 00:1a.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5 (rev 02) 00:1a.2 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 (rev 02) 00:1a.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2 (rev 02) 00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 5 (rev 02) 00:1c.1 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 6 (rev 02) 00:1c.2 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 1 (rev 02) 00:1d.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 02) 00:1d.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 (rev 02) 00:1d.2 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 (rev 02) 00:1d.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 (rev 02) 00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 92) 00:1f.0 ISA bridge: Intel Corporation 82801IR (ICH9R) LPC Interface Controller (rev 02) 00:1f.2 IDE interface: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 4 port SATA IDE Controller (rev 02) 00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller (rev 02) 00:1f.5 IDE interface: Intel Corporation 82801I (ICH9 Family) 2 port SATA IDE Controller (rev 02) 03:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5722 Gigabit Ethernet PCI Express 04:03.0 VGA compatible controller: ATI Technologies Inc ES1000 (rev 02) 0c:00.0 SCSI storage controller: LSI Logic / Symbios Logic SAS1064ET PCI-Express Fusion-MPT SAS (rev 02)
後面可以很清楚知道是裝置名稱,如果有裝置是 unknown 的,需要更新 /usr/share/hwdata/pci.ids 請參考更新方式 https://benjr.tw/265
不過這一次我要說明的是前面的 3 個數字是各代表什麼意思.如我系統上的 Network 裝置 03:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5722 Gigabit Ethernet PCI Express
在 PCI 的裝置使用三個編號用來當作識別值,個別為 1.匯流排(bus number), 2. 裝置(device number) 以及 3. 功能(function number).
所以剛剛的 03:00.0 就是 bus number = 03 ,device number = 00 function = 0 .
這3個編號會組合成一個 16-bits 的識別碼,
- 匯流排(bus number) 8bits 2^8 至多可連接 256 個匯流排(0 to ff),
- 裝置(device number) 5bits 2^5 至多可接 32 種裝置(0 to 1f) 以及
- 功能(function number) 3bits 2^3 至多每種裝置可有 8 項功能(0 to 7).
-s
-s (specified) 可以只看特定裝置,透過 1.匯流排(bus number), 2. 裝置(device number) 以及 3. 功能(function number) 來指定.
[root@benjr ~]# lspci -s 02:03.0 02:03.0 USB controller: VMware USB2 EHCI Controller
-t, -v
使用 lspci -vt 則可以看到這些 PCI 裝置的樹狀圖以及所使用的資源
-v (Verbose) 可以顯示更多訊息,還有 -vv , -vvv 可以使用.
-t (Tree) 顯示 PCI-E 的樹狀圖,所有的 PCI-E Bus 都是從 CPU 而來的,中間可能會透過 PCI-E Switch (如 PLX) 做分配.
[root@benjr ~]# lspci -vt -[0000:00]-+-00.0 Intel Corporation 3200/3210 Chipset DRAM Controller +-01.0-[0000:06]– +-1a.0 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 +-1a.1 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5 +-1a.2 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 +-1a.7 Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2 +-1c.0-[0000:09]– +-1c.1-[0000:03]—-00.0 Broadcom Corporation NetXtreme BCM5722 Gigabit Ethernet PCI Express +-1c.2-[0000:0c]—-00.0 LSI Logic / Symbios Logic SAS1064ET PCI-Express Fusion-MPT SAS +-1d.0 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 +-1d.1 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 +-1d.2 Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 +-1d.7 Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 +-1e.0-[0000:04]—-03.0 ATI Technologies Inc ES1000 +-1f.0 Intel Corporation 82801IR (ICH9R) LPC Interface Controller +-1f.2 Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 4 port SATA IDE Controller +-1f.3 Intel Corporation 82801I (ICH9 Family) SMBus Controller \-1f.5 Intel Corporation 82801I (ICH9 Family) 2 port SATA IDE Controller
-n
-n (numbers) 透過 lspci 可以查到 PCI 的裝置識別值,1. 匯流排(bus number), 2. 裝置(device number) 以及 3. 功能(function number).不過在 Linux 使用 Class ID + Vendor ID + Device ID 來代表裝置,如剛剛的 03:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5722 Gigabit Ethernet PCI Express 所代表裝置名稱為 (Class ID = 0200 ,Vendor ID = 14e4 ,Device ID =165a) .我們可以透過 #lspci -n 就可以看到這三個名稱.
- 0200 : class 0200 表示是 Network controller
- 14e4 : vendor ID 14e4 製造廠商 Broadcom Corporation
- 165a : device ID 1659 產品名稱 NetXtreme BCM5721 Gigabit Ethernet PCI Express
[root@benjr ~]# lspci -n 00:00.0 0600: 8086:29f0 (rev 01) 00:01.0 0604: 8086:29f1 (rev 01) 00:1a.0 0c03: 8086:2937 (rev 02) 00:1a.1 0c03: 8086:2938 (rev 02) 00:1a.2 0c03: 8086:2939 (rev 02) 00:1a.7 0c03: 8086:293c (rev 02) 00:1c.0 0604: 8086:2948 (rev 02) 00:1c.1 0604: 8086:294a (rev 02) 00:1c.2 0604: 8086:2940 (rev 02) 00:1d.0 0c03: 8086:2934 (rev 02) 00:1d.1 0c03: 8086:2935 (rev 02) 00:1d.2 0c03: 8086:2936 (rev 02) 00:1d.7 0c03: 8086:293a (rev 02) 00:1e.0 0604: 8086:244e (rev 92) 00:1f.0 0601: 8086:2916 (rev 02) 00:1f.2 0106: 8086:2922 (rev 02) 00:1f.3 0c05: 8086:2930 (rev 02) 03:00.0 0200: 14e4:165a 04:03.0 0300: 1002:515e (rev 02) 09:00.0 0c04: 1077:2432 (rev 03) 09:00.1 0c04: 1077:2432 (rev 03) 0c:00.0 0100: 1000:0056 (rev 02)
-d
-d (devices with specified) 剛剛用 -s 來查詢,如果知道 裝置的 Vendor ID + Device ID (透過參數 -n 可以得知) ,也可以指定裝置來查詢.
[root@benjr ~]# lspci -d 1274:1371 02:02.0 Multimedia audio controller: Ensoniq ES1371/ES1373 / Creative Labs CT2518 (rev 02)
-m
-m (machine) readable form,一般透過 lspci 的資料可能會很亂,透過 -m 可以將 lspci 輸出資料做一些格式化,還可以使用 -mm 以及 -vmm .
[root@benjr ~]# lspci -s 02:03.0 -vmm Slot: 02:03.0 Class: USB controller Vendor: VMware Device: USB2 EHCI Controller SVendor: VMware SDevice: USB2 EHCI Controller PhySlot: 35 ProgIf: 20
其他關於 lspci 的使用方式請參考.
- 透過 #lspci 查詢 PCI-E Bus 匯流排速度,請參考 https://benjr.tw/10842
- 關於 lspci 詳細資訊所代表的意思,請參考 https://benjr.tw/98087
看 Graphic card 的版本.
看 PCI-E/ PCI 的 bus 速度
關於 PCI-E 的細項,請參考
http://benjr.tw/10842