diff options
author | Arthur Heymans <arthur@aheymans.xyz> | 2023-08-24 15:12:19 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2024-01-29 18:23:22 +0000 |
commit | 80c79a5dc31cca9f157cd2f35f435dfa7648ce11 (patch) | |
tree | 0f1bcc76e774ef03808e1b1e5f531d5464aff9e4 /src/soc/amd/common/block | |
parent | 27ce0ec2b62bf824a94dfeaf223a08bd26465fcd (diff) |
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/soc/amd/common/block')
-rw-r--r-- | src/soc/amd/common/block/acpi/ivrs.c | 11 | ||||
-rw-r--r-- | src/soc/amd/common/block/lpc/lpc.c | 24 |
2 files changed, 17 insertions, 18 deletions
diff --git a/src/soc/amd/common/block/acpi/ivrs.c b/src/soc/amd/common/block/acpi/ivrs.c index 9d0ece1d6c..57b5974e71 100644 --- a/src/soc/amd/common/block/acpi/ivrs.c +++ b/src/soc/amd/common/block/acpi/ivrs.c @@ -140,7 +140,6 @@ static void add_ivhd_device_entries(struct device *parent, struct device *dev, unsigned long *current, uint16_t nb_bus) { struct device *sibling; - struct bus *link; if (!root_level) return; @@ -155,11 +154,11 @@ static void add_ivhd_device_entries(struct device *parent, struct device *dev, ivrs_add_device_or_bridge(parent, dev, current); } - for (link = dev->link_list; link; link = link->next) - for (sibling = link->children; sibling; sibling = - sibling->sibling) - add_ivhd_device_entries(dev, sibling, depth + 1, depth, root_level, - current, nb_bus); + if (!dev->link_list) + return; + for (sibling = dev->link_list->children; sibling; sibling = sibling->sibling) + add_ivhd_device_entries(dev, sibling, depth + 1, depth, root_level, current, + nb_bus); } static unsigned long acpi_ivhd_misc(unsigned long current, struct device *dev) diff --git a/src/soc/amd/common/block/lpc/lpc.c b/src/soc/amd/common/block/lpc/lpc.c index 4e81316881..c076361080 100644 --- a/src/soc/amd/common/block/lpc/lpc.c +++ b/src/soc/amd/common/block/lpc/lpc.c @@ -278,20 +278,20 @@ static void configure_child_espi_windows(struct device *child) static void lpc_enable_children_resources(struct device *dev) { - struct bus *link; struct device *child; - for (link = dev->link_list; link; link = link->next) { - for (child = link->children; child; child = child->sibling) { - if (!child->enabled) - continue; - if (child->path.type != DEVICE_PATH_PNP) - continue; - if (CONFIG(SOC_AMD_COMMON_BLOCK_USE_ESPI)) - configure_child_espi_windows(child); - else - configure_child_lpc_windows(dev, child); - } + if (!dev->link_list) + return; + + for (child = dev->link_list->children; child; child = child->sibling) { + if (!child->enabled) + continue; + if (child->path.type != DEVICE_PATH_PNP) + continue; + if (CONFIG(SOC_AMD_COMMON_BLOCK_USE_ESPI)) + configure_child_espi_windows(child); + else + configure_child_lpc_windows(dev, child); } } |