Subject: Re: PCI configuration
To: None <>
From: Nathan J. Williams <nathanw@MIT.EDU>
List: tech-kern
Date: 02/02/2001 17:21:18
Jason R Thorpe <> writes:

> 	for each device on the bus {
> 		assign space to the device;
> 		if device is a bridge {
> 			create extent map for bridge and
> 			    recurse, allowing the bridge
> 			    to assign addresses to its
> 			    devices;
> 		}
> 	}
> When you encounter a PCI-something bridge, you have to recurse.  This
> is why you have to do it in 2 loops -- if you do it in one loop,
> the PCI bridge won't have it's space allocated to it when it needs to
> assign addresses to the devices behind it... and you need to program
> the mapping window in the bridge.

Additionally, if the bridge is a type that allows adding devices at
runtime (CardBus, or hot-swap PCI, should we ever support that), you
want to allocate extra space and bus numbers for devices/sub-busses
that may be there in the future, so that you don't have to renumber
buses and remap devices (Major pain-and-suffering here!) when a device
is hot-plugged.

(How much space and how many bus numbers is a good question that I'm
not going to try to answer.)

        - Nathan