Why do we call a phase5 function in the middle of phase3? Boot log excerpt on qemu follows:
Phase 3: Enumerating buses... dev_phase3_scan: scanning root(Root Device) scan_static_bus for root (Root Device) cpus: Unknown device path type: 0 cpus() enabled dev_phase5: bus_0(PCI_BUS: 0000) missing ops
domain_0(PCI_DOMAIN: 0000) enabled domain_0(PCI_DOMAIN: 0000) scanning... dev_phase3_scan: scanning domain_0(PCI_DOMAIN: 0000)
As a side note, I'd like to ask everybody working on v3 to read through a complete boot log of his favourite board and ask for explanations if he/she doesn't understand something or if something looks fishy. Sorting the whole boot log and trying to explain duplicate lines is also very interesting.
This is one of those interesting hardware gotchas. What it boils down to is that sometimes you need to enable a hardware resource to see things "behind" it, even if you don't really intend to enable it.
Why do this? Because it is important to allocate resources -- memory address space, io address space -- even if you don't enable in the bios, because you might in the OS.
So you very explicitly have to violate the rules about ordering of operations because you can't do resource scanning without enabling the device.
Sorry if this is unclear.