device/device.h: Drop multiple links
Multiple links are unused throughout the tree and make the code more confusing as an iteration over all busses is needed to get downstream devices. This also not done consistently e.g. the allocator does not care about multiple links on busses. A better way of dealing multiple links below a device is to feature dummy devices with each their respective bus. This drops the sconfig capability to declare the same device multiple times which was previously used to declare multiple links. Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Change-Id: Iab6fe269faef46ae77ed1ea425440cf5c7dbd49b Reviewed-on: https://review.coreboot.org/c/coreboot/+/78328 Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jincheng Li <jincheng.li@intel.com> Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
This commit is contained in:
committed by
Felix Held
parent
27ce0ec2b6
commit
80c79a5dc3
@@ -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 */
|
||||
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++)
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
smp_write_intsrc(mc, irqtype, irqflag,
|
||||
srcbus, (slot<<2)|i, dstapic,
|
||||
dstirq_x[i]);
|
||||
goto next;
|
||||
}
|
||||
|
||||
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]) {
|
||||
|
Reference in New Issue
Block a user