summaryrefslogtreecommitdiffstats
path: root/src/arch
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2023-08-24 15:12:19 +0200
committerFelix Held <felix-coreboot@felixheld.de>2024-01-29 18:23:22 +0000
commit80c79a5dc31cca9f157cd2f35f435dfa7648ce11 (patch)
tree0f1bcc76e774ef03808e1b1e5f531d5464aff9e4 /src/arch
parent27ce0ec2b62bf824a94dfeaf223a08bd26465fcd (diff)
downloadcoreboot-80c79a5dc31cca9f157cd2f35f435dfa7648ce11.tar.gz
coreboot-80c79a5dc31cca9f157cd2f35f435dfa7648ce11.tar.bz2
coreboot-80c79a5dc31cca9f157cd2f35f435dfa7648ce11.zip
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>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/x86/mpspec.c83
1 files changed, 40 insertions, 43 deletions
diff --git a/src/arch/x86/mpspec.c b/src/arch/x86/mpspec.c
index 7744f68e8502..3ddee2f6b9ac 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]) {