1

I know how to check how many PCI slots are not used yet on my server, by using dmidecode and looking for Available slots:

# 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

and I also know how to check what PCI type and version are all the slots in the server (available and used), by using lspci -vvv and looking for LnkCap data:

# 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, ...

where the speed of 2.5GT/s and the 1x suggest it's a PCI-e 1x slot. That's fine, but how do I relate these outputs to deduce what PCI type and version are the free slots in my server?

I initially tried to assume the Handle numbers of dmidecode matched the first column values in lspci output, but they don't. Any ideas?

EDIT

As per Mark Wagner's comment, the numbers between lspci and dmidecode do not match because lspci shows informations about a bridge, not a slot, and lspci doesn't show anything for unused slots. That means lspci is not useful in my case, my question is still the same, but likely the answer will not use lspci.

Lucio Crusca
  • 420
  • 3
  • 12
  • 33
  • The output from `lspci` is information about a bridge, not a slot. `lspci` only shows information about slots with a card in them. – Mark Wagner Dec 18 '20 at 23:47
  • Ok, thanks, that explains why numbers do not match. Given that, I assume `lspci` is almost useless in my case. Any clues about how to get the information I need? – Lucio Crusca Dec 19 '20 at 08:58

1 Answers1

1

You can use dmidecode with slot option something like this:

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

Handle 0x0900, DMI type 9, 17 bytes System Slot Information Designation: PCI1 Type: x8 PCI Express 3 x16 Current Usage: Available Length: Long ID: 1 Characteristics: 3.3 V is provided

if you want to chech which one are in use is the same thing:

$ sudo dmidecode -t slot |grep -A 4 -B 5 "In Use"

Handle 0x0901, DMI type 9, 17 bytes System Slot Information Designation: PCI2 Type: x16 PCI Express 3 Current Usage: In Use Length: Long ID: 2 Characteristics: 3.3 V is provided