I'd like to clarify how the configuration address space in PCI and PCIe works.
Namely, a PCI peripheral on a bus is addressed with
device:function pair (the
domain:bus are not included, since only 1 bus is considered).
device address determined? What sets it?
According to the answer in this question on superuser and other texts the
device address is actually address of the PCI slot, and thus it should be wired in the hardware during manufacturing. Is it correct?
Then, how is this address defined in PCIe case?
From the same answer:
each device has its own individual point-to-point serial connection to its upstream device
-- thus, in PCIe each slot is connected to upstream switch device in star topology. And addresses of the slots are re-assigned by the switch on reset? (So, on power-up the switch calls for devices in each slot and if there is a response the switch assigns
device address to the slot?) As in the same answer:
(hence each bridge, including the top-level "root complex", tells each device what its device ID will be)
Or they are also resolved in hardware/firmware of the switch? (And the switch always has a
device address assigned to those wires going to a slot.)
It seems for easier hot-plug-ability each slot should have permanent address on the bus (on the "network" of the PCIe switch).