How to Check PCI Version Support for Empty Slots in Linux


2 views

When working with PCI devices in Linux, the common lspci -vvv command only shows information for populated slots. This leaves system administrators and developers without visibility into the PCI version capabilities of empty slots on their motherboards.

Here are several approaches to uncover PCI version information for all slots:

Method 1: Using dmidecode

The dmidecode utility provides detailed system hardware information:

sudo dmidecode -t slot

Example output:

Handle 0x0007, DMI type 9, 17 bytes
System Slot Information
    Designation: PCIEX16_1
    Type: x16 PCI Express
    Current Usage: Available
    Length: Long
    Characteristics:
        3.3 V is provided
        Opening is shared
        PME signal is supported
    Bus Address: 0000:00:01.0

Method 2: Examining sysfs

The Linux sysfs filesystem exposes PCI slot information:

ls /sys/bus/pci/slots/

For each slot:

cat /sys/bus/pci/slots/[slot_number]/bus_speed

Method 3: Checking Kernel Messages

Boot-time kernel messages often contain PCI initialization details:

dmesg | grep -i pci

Look for entries like:

[    0.361942] pci 0000:00:01.0: PCI bridge to [bus 01]
[    0.361950] pci 0000:00:01.0:   bridge window [io  0xd000-0xdfff]
[    0.361953] pci 0000:00:01.0:   bridge window [mem 0xf0000000-0xf01fffff]
[    0.361956] pci 0000:00:01.0:   bridge window [mem 0xf0200000-0xf03fffff pref]

When examining the outputs:

  • PCI Express slots will show generation information (1.0, 2.0, 3.0, etc.)
  • Standard PCI slots typically indicate version 2.3 for modern systems
  • Slot speed (2.5GT/s, 5GT/s, 8GT/s) can help identify the generation

Here's a simple bash script to collect PCI slot information:

#!/bin/bash

echo "=== PCI Slot Information ==="
echo

# Check dmidecode
echo "DMI Decode Information:"
sudo dmidecode -t slot | grep -A5 "System Slot Information"
echo

# Check sysfs
echo "Sysfs Slot Information:"
for slot in /sys/bus/pci/slots/*; do
    echo "Slot $(basename $slot):"
    echo "  Bus Speed: $(cat $slot/bus_speed 2>/dev/null || echo 'Unknown')"
done
echo

# Check lspci for bridges
echo "PCI Bridge Information:"
lspci -v | grep -i "pci bridge" -A3

For precise technical details, you can access the PCI configuration space:

sudo apt install pciutils-dev
sudo lspci -xxxx -s 00:01.0

This will display the raw PCI configuration header where you can examine:

  • Offset 0x0C: Status and Command registers
  • Offset 0x34: Capabilities Pointer
  • Capability ID 0x10: PCI Express Capability

If software methods don't yield results, consider:

  1. Consulting the motherboard manual or specifications
  2. Checking the BIOS/UEFI settings for PCI information
  3. Physically inspecting the motherboard for slot markings

When working with Linux systems, determining the PCIe version (1.0, 2.0, 3.0, etc.) of empty slots can be tricky. Standard tools like lspci -vvv only show information for populated slots, leaving system administrators and developers without complete bus information.

Here are several approaches to get this information:

1. Using lspci with Bus Details

While lspci -vvv doesn't show empty slots, you can get some bus-level information:

sudo lspci -vvv | grep -i 'LnkSta:'

This shows the current link status and negotiated speed for connected devices, which can help infer the bus capabilities.

2. Checking Kernel Messages

The kernel logs often contain PCI bus initialization information:

dmesg | grep -i pci

Look for entries containing "PCI:","PCI Express", or "Max Payload Size" which might indicate bus capabilities.

3. Examining sysfs Entries

The Linux kernel exposes PCI bus information through sysfs. Try:

ls /sys/bus/pci/devices/

Even for empty slots, you might find bridge devices that indicate capabilities.

4. Using setpci Utility

The setpci command can read PCI configuration space directly:

sudo setpci -s 00:00.0 CAP_EXP+0x0c.l

This requires knowing the bridge device ID and offsets for PCIe capability registers.

For more detailed information, you might need to:

1. Parse ACPI Tables

The acpidump utility can reveal PCI bus information:

sudo acpidump > acpi.txt
acpixtract acpi.txt
iasl -d DSDT.dat

Search the output for PCI-related definitions.

2. Check Motherboard Documentation

When available, the motherboard manual or datasheet remains the most reliable source for PCIe version information.

Here's a simple bash script to attempt PCIe version detection:

#!/bin/bash

for device in /sys/bus/pci/devices/*; do
  if [ -f "$device/max_link_speed" ]; then
    echo -n "Device $(basename $device): "
    cat "$device/max_link_speed" | tr -d '\n'
    echo " (Max supported)"
    cat "$device/current_link_speed" | tr -d '\n'
    echo " (Current)"
  fi
done

Note that some methods might only show:

  • The current negotiated speed rather than maximum capability
  • Only populated slots' information
  • Bridge capabilities rather than slot capabilities