如何在 Linux shell 中檢查空閒 PCI 插槽的 PCI 類型和版本

如何在 Linux shell 中檢查空閒 PCI 插槽的 PCI 類型和版本

dmidecode我知道如何透過使用和尋找插槽來檢查我的伺服器上尚未使用多少個 PCI 插槽Available

# dmidecode
[...]
Handle 0x0014, DMI type 9, 13 bytes
System Slot Information
    Designation: PCI1
    Type: 32-bit PCI
    Current Usage: Available
    Length: Long
    ID: 2
    Characteristics:
        5.0 V is provided
        PME signal is supported

lspci -vvv我還知道如何透過使用和查找LnkCap資料來檢查伺服器中所有插槽(可用和已使用)的 PCI 類型和版本:

# lspci -vvv
[...]
00:1f.0 PCI bridge: Silicon Integrated Systems [SiS] PCI-to-PCI bridge (prog-if 00 [Normal decode])
    [...]
    LnkCap: Port #0, Speed 2.5GT/s, Width x1, ...

其中 2.5GT/s 的速度和 1x 表明它是 PCI-e 1x 插槽。很好,但是我如何關聯這些輸出來推斷 PCI 類型和版本自由的我的伺服器中的插槽?

我最初嘗試假設輸出中的第一列值匹配Handle的數量,但事實並非如此。有任何想法嗎?dmidecodelspci

編輯

根據 Mark Wagner 的評論,lspci和之間的數字dmidecode不匹配,因為lspci顯示有關橋的信息,而不是插槽的信息,並且lspci不顯示未使用插槽的任何信息。這意味著lspci在我的情況下沒有用,我的問題仍然相同,但答案可能不會使用lspci.

答案1

您可以將 dmidecode 與插槽選項一起使用,如下所示:

$ sudo dmidecode -t slot |grep -A 4 -B 5 可用

句柄 0x0900,DMI 類型 9,17 位元組 系統插槽資訊 名稱: PCI1 類型:x8 PCI Express 3 x16 目前用途:可用 長度:長 ID:1 特性:提供 3.3 V

如果你想檢查正在使用的是同一件事:

$ sudo dmidecode -t slot |grep -A 4 -B 5“使用中”

句柄 0x0901,DMI 類型 9,17 位元組 系統插槽資訊 名稱: PCI2 類型:x16 PCI Express 3 目前用途:使用中 長度:長 ID:2 特性:提供 3.3 V

相關內容