summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2024-01-25 22:26:07 +0100
committerArthur Heymans <arthur@aheymans.xyz>2024-01-29 15:04:18 +0000
commit3e99ba02a40cb1035c9ed22552cfc22aaf6bda7d (patch)
treeb2a03e9da5ac03153aedc8bb43586739d53be6af /src/soc
parente4e26560ee70d4215cbfb5f24cbbc9283177c4d9 (diff)
device: Add a helper function to add a downstream bus
Adding downstream busses at runtime is a common pattern so add a helper function. Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Change-Id: Ic898189b92997b93304fcbf47c73e2bb5ec09023 Reviewed-on: https://review.coreboot.org/c/coreboot/+/80210 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/intel/xeon_sp/chip_common.c9
-rw-r--r--src/soc/intel/xeon_sp/spr/ioat.c7
2 files changed, 2 insertions, 14 deletions
diff --git a/src/soc/intel/xeon_sp/chip_common.c b/src/soc/intel/xeon_sp/chip_common.c
index bf2a015ed9..845e968a62 100644
--- a/src/soc/intel/xeon_sp/chip_common.c
+++ b/src/soc/intel/xeon_sp/chip_common.c
@@ -72,14 +72,7 @@ void iio_pci_domain_scan_bus(struct device *dev)
if (!sr)
return;
- if (!dev->link_list) {
- dev->link_list = calloc(1, sizeof(struct bus));
- if (!dev->link_list)
- die("%s: out of memory.\n", __func__);
- }
-
- struct bus *bus = dev->link_list;
- bus->dev = dev;
+ struct bus *bus = alloc_bus(dev);
bus->secondary = sr->BusBase;
bus->subordinate = sr->BusBase;
bus->max_subordinate = sr->BusLimit;
diff --git a/src/soc/intel/xeon_sp/spr/ioat.c b/src/soc/intel/xeon_sp/spr/ioat.c
index 02f35cfe77..60936a8a42 100644
--- a/src/soc/intel/xeon_sp/spr/ioat.c
+++ b/src/soc/intel/xeon_sp/spr/ioat.c
@@ -45,12 +45,7 @@ static void create_ioat_domain(const union xeon_domain_path dp, struct bus *cons
domain->ops = &ioat_domain_ops;
- domain->link_list = calloc(1, sizeof(struct bus));
- if (!domain->link_list)
- die("%s: out of memory.\n", __func__);
-
- struct bus *const bus = domain->link_list;
- bus->dev = domain;
+ struct bus *const bus = alloc_bus(domain);
bus->secondary = bus_base;
bus->subordinate = bus->secondary;
bus->max_subordinate = bus_limit;