Figure: Linux Kernel PCI Data Structures
As the Linux kernel initialises the PCI system it builds data structures mirroring the real PCI topology of the system. Figure shows the relationships of the data structures that it would build for the example PCI system in Figure on page .
Each PCI device (including the PCI-PCI Bridges) is described by a pci_dev data structure. Each PCI bus is described by a pci_bus data structure. The result is a tree structure of PCI buses each of which has a number of child PCI devices attached to them. As a PCI bus can only be reached using a PCI-PCI Bridge (except the primary PCI bus, bus 0), each pci_bus contains a pointer to the PCI device (the PCI-PCI Bridge) that it is accessed through. That PCI device is a child of the the PCI Buses parent PCI bus.
Not shown in the Figure is a pointer to all of the PCI devices in the system, pci_devices . All of the PCI devices in the system have their pci_dev data structures queued onto this queue.. This queue is used by the Linux kernel to quickly find all of the PCI devices in the system.