How-to : Find the hardware component corresponding to a PCI address using lspci

 

pci

Introduction

This quick post may help you (and me for sure) to find out which hardware component is using which PCI bus.

In this post i will use a “real-life” example, which actually happened to me some days ago :I recently had an error reported by a script (which can be found here) based on the command line interface for Open Manage, in this log a PCI bus was reported as faulty, i then needed to find out which component was using this PCI bus …

 

1) The error message

Here is the error messages given by the DELL OpenManage web interface :

Mon Jul 9 14:24:33 2012A bus fatal error was detected on a component at bus 0 device 1 function 0.
Mon Jul 9 14:24:33 2012A bus fatal error was detected on a component at bus 1 device 0 function 0.

and the same messages from the command line interface :

Severity      : Critical
Date and Time : Mon Jul  9 14:24:33 2012
Description   : A bus fatal error was detected on a component at bus 1 device 0 function 0.

Severity      : Critical
Date and Time : Fri Jul 13 11:19:29 2012
Description   : A bus fatal error was detected on a component at bus 1 device 0 function 0.

We now clearly need to find what are the hardware components connected to those PCI bus.

 

2) Using and understanding lspci output

This section is about the lspci command, these are only basics commands related to our current problem.

2.1 General lspci output syntax

lspci print its results using the following syntax :

<domain>:<bus>:<slot>.<func>

 

2.1.1 Full address format

In order to get the full address (the one including the domain address)you might need to use the -D option. The reason for that is, as stated in the lspci man page : “By default, lspci suppresses them on machines which have only domain 0“.

2.1.1.1 Output example

0000:01:00.0 VGA compatible controller: nVidia Corporation NV44 [Quadro NVS 285] (rev a1)

 

2.1.2 Mono domain address format

The classic output of a lspci command is as :

<bus>:<slot>.<func>

2.1.2.1 Output example

01:00.0 VGA compatible controller: nVidia Corporation NV44 [Quadro NVS 285] (rev a1)

 

 

2.2 lspci basic usage

Calling lspci command without any options / arguments will print out every PCI bus and their related hardware information, such as :

[root@test ~]# lspci
00:00.0 Host bridge: Intel Corporation 5520 I/O Hub to ESI Port (rev 13)
00:01.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 1 (rev 13)
00:03.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 3 (rev 13)
01:00.0 Ethernet controller: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)
01:00.1 Ethernet controller: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)

Let’s have a look to this output and use the above informations about lspci syntax, given the following lspci output excerpt :

01:00.1 Ethernet controller: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)

The interesting part (in our case) is the first group of digit, the “bus address” : 01:00.1

which can be divided and read as :

  • 01 → This is the BUS address
  • 00 → This is the DEVICE address
  • 0  → This is the FUNCTION address

 

 

2.3 The -s option

We now want to identify the hardware corresponding to a given bus address : we need to use the -s option which allow us to filter the output according to the bus address given as argument, such as :

[root@test ~]# lspci -s 00:01.0
00:01.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 1 (rev 13)

We have here a problem with one PCI bus used by the processor … not very good indeed !

[root@test ~]# lspci -s 01:00.0
01:00.0 Ethernet controller: Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet (rev 20)

And it is here the network interface that is using the faulty PCI bus.

Now inform your boss that he is going to buy a new mother-board !

 

 

3) Conclusion

We now have an efficient way to find what hardware is related to a PCI bus address as well as some better understanding of lspci output.

 

Resources

  • http://prefetch.net/articles/linuxpci.html
  • lspci man page
Tagged on: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site supports SyntaxHighlighter via WP SyntaxHighlighter. It can highlight your code.
How to highlight your code: Paste your code in the comment form, select it and then click the language link button below. This will wrap your code in a <pre> tag and format it when submitted.