[coreboot] [PATCH] v3: fix PCI bus scan / device tree interaction

ron minnich rminnich at gmail.com
Fri Aug 29 21:40:02 CEST 2008

On Thu, Aug 28, 2008 at 7:22 PM, Carl-Daniel Hailfinger
<c-d.hailfinger.devel.2006 at gmx.net> wrote:

> pci_scan_bus(bus, ...) is not called with the expected bus type.
> Instead, it is called with a domain type from pci_domain_scan_bus().
> pci_scan_bus(bus, ...) looks at bus->children and expects it to be a PCI
> device. Of course the children of the domain are the buses and
> bus->children is a PCI bus. That causes all lookups in the device tree
> to fail horribly.

I am going to guess as to why this might have happened. In v2 we had this:

static void root_complex_enable_dev(struct device *dev)
        /* Set the operations if it is a special bus type */
        if (dev->path.type == DEVICE_PATH_PCI_DOMAIN) {
                dev->ops = &pci_domain_ops;
        else if (dev->path.type == DEVICE_PATH_APIC_CLUSTER) {
                dev->ops = &cpu_bus_ops;

So we would swap the ops around as we walked the tree. This was very
confusing to many people. I removed this confusion for v3, but maybe I
missed something in the process. I'm not sure.

> - For dynamic PCI devices on qemu, have_resources is now always 0. The
> reason can be seen in this error message:
> "read_resources: bus_0(PCI_BUS: 0000) missing phase4_read_resources"
> Basically, we have phase4_read_resources defined for the PCI domain, but
> not for PCI bus 0. We can either inherit phase4_read_resources from the
> domain or we define phase4_read_resources for each PCI bus. I prefer the
> latter.

probably the latter, but we should back off a bit until we define the rules.


More information about the coreboot mailing list