PCI Bus Demystified, Second Edition

Now that we've seen how Plug-and-Play configuration works and how a large system may be built up from multiple bus segments via bridging, it's time to consider the software implications of configuring a PCI system. This is commonly known as "enumerating the bus" and basically consists of traversing the entire bus hierarchy starting at segment 0 to determine:
How many P2P bridges are present and their relative hierarchy
How many devices are connected to each bus segment
What resources each device requires.
Having determined the sum total of required resources memory space, prefetchable memory space, I/O space, interrupts the software traverses the hierarchy again allocating resources to devices. Resources for all bridges and devices "behind," downstream, of a given bridge are allocated contiguously.
Obviously, system configuration is something that must happen fairly soon after power is turned on. At the very least, the BIOS requires access to the screen and keyboard to output its messages and to provide for BIOS configuration. It also requires access to a disk drive to boot the operating system. So the BIOS must include some minimum level of configurability.
In fact, contemporary BlOSes have the ability to completely configure the PCI bus hierarchy and store the resulting configuration in a nonvolatile structure called Extended System Configuration Data (ESCD). Each time the system is powered up, the BIOS compares the current set of installed devices against the ESCD. If it's the same, as it usually is, then the ESCD configuration can just...