Ubuntu – Find PCI configuration

pciUbuntu

In this page, Figure 6.1 shows an example of PCI configuration, with two buses.

Using Linux (Ubuntu), is it possible to get the PCI configuration of the actual motherboard? I mean: determine how many PCI buses are present, find if there is a PCI-express bus and the bridges, so that one can draw a diagram similar to that Figure 6.1.

lspci gives a list of the PCI devices, but it does not seem to explicitly show the connections and the buses structure.

Best Answer

dmidecode and lshw together provide a reasonable picture. dmidecode, on a correctly-configured system (i.e. one with correctly-populated DMI tables), will list physical slots and their characteristics. For example, on my system, I see information such as

Handle 0x001C, DMI type 9, 17 bytes
System Slot Information
        Designation: SLOT7 PCI-E 2.0 X 1
        Type: x1 PCI Express
        Current Usage: In Use
        Length: Short
        ID: 0
        Characteristics:
                3.3 V is provided
                Opening is shared
                PME signal is supported
        Bus Address: 0000:07:00.0

and

Handle 0x0021, DMI type 9, 17 bytes
System Slot Information
        Designation: SLOT1 PCI 33MHz
        Type: 32-bit PCI
        Current Usage: In Use
        Length: Short
        ID: 5
        Characteristics:
                3.3 V is provided
                Opening is shared
                PME signal is supported
        Bus Address: 0000:09:00.0

The designations can be quite detailed; on this particular board the physical slots and electrical capabilities are correctly identified (e.g. PCI-E 3.0 X8 (IN X16)).

lshw indicates the bridge connections, and its information can be matched with dmidecode's using the bus addresses. This allows motherboard-hosted bridges to be distinguished from adapter-hosted bridges. (For example, one of my systems has two PCI slots on a C226 motherboard, using a PCI bridge on the motherboard; it also has an ATTO SCSI PCI Express HBA which uses two PCI-hosted chips behind another PCI bridge, on the card itself. lshw's output doesn't make it easy to distinguish the two cases, but combined with dmidecode's output it's obvious which is which.)

Related Question