What limits the number of buses, devices and functions on a PCI bus?
I found an answer:


  In addition to the normal memory-mapped and I/O port spaces, each
  device function on the bus has a configuration space, which is 256
  bytes long, addressable by knowing the eight-bit PCI bus, five-bit
  device, and three-bit function numbers for the device (commonly
  referred to as the BDF or B/D/F, as abbreviated from
  bus/device/function). This allows up to 256 buses, each with up to
  32 devices, each supporting eight functions.