diff options
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/x86/mpspec.c | 83 |
1 files changed, 40 insertions, 43 deletions
diff --git a/src/arch/x86/mpspec.c b/src/arch/x86/mpspec.c index 7744f68e85..3ddee2f6b9 100644 --- a/src/arch/x86/mpspec.c +++ b/src/arch/x86/mpspec.c @@ -282,48 +282,46 @@ void smp_write_intsrc_pci_bridge(struct mp_config_table *mc, int srcbus; int slot; - struct bus *link; unsigned char dstirq_x[4]; - for (link = dev->link_list; link; link = link->next) { + if (!dev->link_list) + return; - child = link->children; - srcbus = link->secondary; + child = dev->link_list->children; + srcbus = dev->link_list->secondary; - while (child) { - if (child->path.type != DEVICE_PATH_PCI) - goto next; + while (child) { + if (child->path.type != DEVICE_PATH_PCI) + goto next; - slot = (child->path.pci.devfn >> 3); - /* round pins */ - for (i = 0; i < 4; i++) - dstirq_x[i] = dstirq[(i + slot) % 4]; - - if ((child->class >> 16) != PCI_BASE_CLASS_BRIDGE) { - /* pci device */ - printk(BIOS_DEBUG, "route irq: %s\n", - dev_path(child)); - for (i = 0; i < 4; i++) - smp_write_intsrc(mc, irqtype, irqflag, - srcbus, (slot<<2)|i, dstapic, - dstirq_x[i]); - goto next; - } + slot = (child->path.pci.devfn >> 3); + /* round pins */ + for (i = 0; i < 4; i++) + dstirq_x[i] = dstirq[(i + slot) % 4]; - switch (child->class>>8) { - case PCI_CLASS_BRIDGE_PCI: - case PCI_CLASS_BRIDGE_PCMCIA: - case PCI_CLASS_BRIDGE_CARDBUS: - printk(BIOS_DEBUG, "route irq bridge: %s\n", - dev_path(child)); - smp_write_intsrc_pci_bridge(mc, irqtype, - irqflag, child, dstapic, dstirq_x); - } + if ((child->class >> 16) != PCI_BASE_CLASS_BRIDGE) { + /* pci device */ + printk(BIOS_DEBUG, "route irq: %s\n", + dev_path(child)); + for (i = 0; i < 4; i++) + smp_write_intsrc(mc, irqtype, irqflag, + srcbus, (slot<<2)|i, dstapic, + dstirq_x[i]); + goto next; + } -next: - child = child->sibling; + switch (child->class>>8) { + case PCI_CLASS_BRIDGE_PCI: + case PCI_CLASS_BRIDGE_PCMCIA: + case PCI_CLASS_BRIDGE_CARDBUS: + printk(BIOS_DEBUG, "route irq bridge: %s\n", + dev_path(child)); + smp_write_intsrc_pci_bridge(mc, irqtype, + irqflag, child, dstapic, dstirq_x); } +next: + child = child->sibling; } } @@ -478,17 +476,16 @@ void mptable_write_buses(struct mp_config_table *mc, int *max_pci_bus, memset(buses, 0, sizeof(buses)); for (dev = all_devices; dev; dev = dev->next) { - struct bus *bus; - for (bus = dev->link_list; bus; bus = bus->next) { - if (bus->secondary > 255) { - printk(BIOS_ERR, - "A bus claims to have a bus ID > 255?!? Aborting"); - return; - } - buses[bus->secondary] = 1; - if (highest < bus->secondary) - highest = bus->secondary; + struct bus *bus = dev->link_list; + if (!bus) + continue; + if (bus->secondary > 255) { + printk(BIOS_ERR, "A bus claims to have a bus ID > 255?!? Aborting\n"); + return; } + buses[bus->secondary] = 1; + if (highest < bus->secondary) + highest = bus->secondary; } for (i = 0; i <= highest; i++) { if (buses[i]) { |