During system initilization software enumerates the different buses, devices and functions with the help of two I/O Ports (CONFIG_ADDRESS 0xCF8, CONFIG_DATA 0xCFC) and two configuration cycle types.
Type 1 PCI Configuration Cycle
Type 0 PCI Configuration Cycle
PCI-PCI Bridge Numbering example
Now, when system software writes the corresponding value for bus number 1, device 0, function 0 and register 0 into I/O Port CONFIG_ADDRESS, the PCI bridge with secondary bus number 1 configured receives a type 1 configuration cycle with this information and creates a type 0 configuration cylce on bus 1. Because bits 31:11 are used to select the appropriate device with the help of the ID selection technique, every pci device on the bus has as IDSEL pin which is uniquely hardwired to one of 21 address pins, which correspond to bits 31:11 in type 0 configuration cycle. So bit 11 would select device 0, bit 12 would select device 1 and so on.
Now, every text, explanation, ... I have read, states that a bus can handle up to 32 devices which seems pretty obvious because in type 1 configuration cycles 5 bits (15:11) are used to encode the device number but in type 0 configuration cycles these 5 bits are mapped to one of the 21 bits of a type 1 configuration cycle. However, this limits the maximum number of possible devices to 21.
So what is the real device limit?