structure of /sys/class/pci_bus

From: Jon Smirl
Date: Sat Sep 04 2004 - 18:40:12 EST


I'm having some trouble with the way sysfs is structured for multiple
PCI busses.

[jonsmirl@smirl /]$ ls sys/class/pci_bus
0000:00 0000:01 0000:02

I have three busses in my system. It is Intel i875P.

[jonsmirl@smirl /]$ ls sys/class/pci_bus/0000:00
bridge cpuaffinity

Normal pci_bus entry

[jonsmirl@smirl /]$ ls sys/class/pci_bus/0000:00/bridge -l
lrwxrwxrwx 1 root root 0 Sep 4 13:10
sys/class/pci_bus/0000:00/bridge -> ../../../devices/pci0000:00

bridge for bus 0 is pci0000:00

[jonsmirl@smirl /]$ ls sys/class/pci_bus/0000:01/bridge -l
lrwxrwxrwx 1 root root 0 Sep 4 13:10
sys/class/pci_bus/0000:01/bridge ->
../../../devices/pci0000:00/0000:00:01.0

bridge for bus 0 is pci0000:00/0000:00:01.0

[jonsmirl@smirl /]$ ls sys/class/pci_bus/0000:02/bridge -l
lrwxrwxrwx 1 root root 0 Sep 4 13:10
sys/class/pci_bus/0000:02/bridge ->
../../../devices/pci0000:00/0000:00:1e.0

bridge for bus 2 is pci0000:00/0000:00:1e.0

[jonsmirl@smirl /]$ ls sys/class/pci_bus/0000:00/bridge
0000:00:00.0 0000:00:1d.0 0000:00:1d.2 0000:00:1d.7 0000:00:1f.0
0000:00:1f.2 0000:00:1f.5 power
0000:00:01.0 0000:00:1d.1 0000:00:1d.3 0000:00:1e.0 0000:00:1f.1
0000:00:1f.3 detach_state

But bridge 0 is not linked to a bridge node. It is linked to the host
device node instead. This is not symetrical with bus 1 and 2.

[jonsmirl@smirl /]$ ls sys/class/pci_bus/0000:01/bridge
0000:01:00.0 class detach_state irq resource subsystem_vendor
0000:01:00.1 config device power subsystem_device vendor

This is what a normal bridge node looks like

[jonsmirl@smirl /]$ cat sys/class/pci_bus/0000:01/bridge/class
0x060400

Bridge is a PCI bridge

[jonsmirl@smirl /]$ ls sys/class/pci_bus/0000:00/bridge/0000:00:00.0
class config detach_state device irq power resource
subsystem_device subsystem_vendor vendor

This is the real bridge node for bus 0.

[jonsmirl@smirl /]$ cat sys/class/pci_bus/0000:00/bridge/0000:00:00.0/class
0x060000

Class is Host bridge. Host bridge has two nodes in sysfs, a device
node, pci0000:00, and a pci_device node, 0000:00:00.0.

[jonsmirl@smirl /]$ ls sys/devices
pci0000:00 platform system

This shows the top level Host bridge.

Starting from here, how I am supposed to figure out that 0000:00:00.0
is the PCI device for controlling this bridge?

--
Jon Smirl
jonsmirl@xxxxxxxxx
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/