2009年3月24日 星期二

PCI bus number assignment & Linux

So, bus number is assigned by software.


PCI-to-PCI Bridge Architecture Specification, Revision 1.1, December 18, 1998

3.1.2. Type 1 Configuration Transaction Support

During a Type 1 configuration transaction, address bits AD[23::16] specify a unique PCI bus in the PCI hierarchy on which the target of the transaction resides. The bridge compares the specified bus number with three configuration registers that are programmed by initialization code to determine whether to claim and forward a Type 1 configuration transaction across the bridge.

(...................)

3.1.2.1. Primary Interface

(...................)

The bridge ignores a Type 1 configuration transaction on its primary interface, if the bus number specified by address bits AD[23::16] does not fall within the range of bus numbers specified by the Secondary Bus Number (inclusive) and Subordinate Bus Number (inclusive) registers. In this case, the Type 1 configuration transaction is specifying a bus number that is not located behind the bridge.

The bridge claims a Type 1 configuration transaction on its primary interface, if the bus number specified by address bits AD[23::16] falls within the range of bus numbers specified by the Secondary Bus Number (inclusive) and Subordinate Bus Number (inclusive) registers. In this case, the Type 1 configuration transaction is specifying a bus number that is located behind the bridge.
ie, if "Secondary Bus Number" >="bus number specified" >= "Subordinate Bus Number", the bus is located behind the bridge

3.2.5.2. Primary Bus Number Register

The Primary Bus Number register is used to record the bus number of the PCI bus segment to which the primary interface of the bridge is connected. Configuration software programs the value in this register. The bridge uses this register to decode Type 1 configuration transactions on the secondary interface that must be converted to Special Cycle transactions on the primary interface. A bridge must2 implement this register as a read/write register and the default state after reset must be zero.

3.2.5.3. Secondary Bus Number Register

The Secondary Bus Number register is used to record the bus number of the PCI bus segment to which the secondary interface of the bridge is connected. Configuration software programs the value in this register. The bridge uses this register to determine when to respond to a Type 1 configuration transaction on the primary interface and convert it to a Type 0 transaction on the secondary interface. The bridge also uses the Secondary Bus Number register and the Subordinate Bus Number register to determine when to forward Type 1 configuration transactions upstream. A bridge must implement this register as a read/write register and the default state after reset must be zero.

3.2.5.4. Subordinate Bus Number Register

The Subordinate Bus Number register is used to record the bus number of the highest numbered PCI bus segment which is behind (or subordinate to) the bridge. Configuration software programs the value in this register. The bridge uses this register in conjunction with the Secondary Bus Number register to determine when to respond to a Type 1 configuration transaction on the primary interface and to pass it to the secondary interface. The bridge also uses the Secondary Bus Number register and the Subordinate Bus Number register to determine when to forward Type 1 configuration transactions upstream. A bridge must implement this register as a read/write register and the default state after reset must be zero.

(...................)

11.2. System Initialization

When bridges are present in a system, the BIOS is required to provide the following functions during the initialization process (each will be discussed in the following sections):
· Assignment of PCI bus numbers
· Allocation of address spaces (Prefetchable Memory, Memory Mapped I/O, I/O)
· Writing the IRQ number into each device
· Initializing the PCI display subsystem

11.2.1. Assigning Bus Numbers

The BIOS must assign PCI bus numbers to each bridge in the system. In what order they are assigned and when the assignments are made is not specified. All buses located behind a bridge must reside between the Secondary Bus Number and the Subordinate Bus Number (inclusive).

Linux设备驱动之pci设备的枚举
http://www.diybl.com/course/6_system/linux/Linuxjs/2008827/137983_6.html

沒有留言: