next up previous contents
Next: Configuring PCI-PCI Bridges - Up: Linux PCI Initialization Previous: The Linux Kernel PCI

The PCI Device Driver

  The PCI device driver is not really a device driver at all but a function of the operating system called at system initialisation time. The PCI initialisation code must scan all of the PCI busses in the system looking for all PCI devices in the system (including PCI-PCI bridge devices).

It uses the PCI BIOS code to find out if every possible slot in the current PCI bus that it is scanning is occupied. If the PCI slot is occupied, it builds a pci_dev  data structure describing the device and links into the list of known PCI devices (pointed at by pci_devices ).

The PCI initialisation code starts by scanning PCI Bus 0. It tries to read the Vendor Identification and Device Identification fields for every possible PCI device in every possible PCI slot. When it finds an occupied slot it builds a pci_dev  data structure describing the device. All of the pci_dev  data structures built by the PCI initialisation code (including all of the PCI-PCI Bridges) are linked into a singly linked list; pci_devices .

If the PCI device that was found was a PCI-PCI bridge then a pci_bus  data structure is built and linked into the tree of pci_bus  and pci_dev  data structures pointed at by pci_root . The PCI initialisation code can tell if the PCI device is a PCI-PCI Bridge because it has a class code of 0x060400. The Linux kernel then configures the PCI bus on the other (downstream) side of the PCI-PCI Bridge that it has just found. If more PCI-PCI Bridges are found then these are also configured. This process is known as a depthwise algorithm; the system's PCI topology is fully mapped depthwise before searching breadthwise. Looking at Figure gif on page gif, Linux would configure PCI Bus 1 with its Ethernet and SCSI device before it configured the video device on PCI Bus 0.

As Linux searches for downstream PCI busses it must also configure the intervening PCI-PCI bridges' secondary and subordinate bus numbers. This is described in detail in Section gif below.




next up previous contents
Next: Configuring PCI-PCI Bridges - Up: Linux PCI Initialization Previous: The Linux Kernel PCI

David A. Rusling
david.rusling@reo.mts.dec.com