allocator_v4: Completely ignore resources with 0 limit
It seems pass 1 and 2 were inconsistent. The first would account for
resources with a limit of 0 even though the second can't assign anything
for them.
Change-Id: I86fb8edc8d4b3c9310517e07f29f73a6b859a7c4
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65402
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
diff --git a/src/device/resource_allocator_v4.c b/src/device/resource_allocator_v4.c
index 18667b7..2b62fc8 100644
--- a/src/device/resource_allocator_v4.c
+++ b/src/device/resource_allocator_v4.c
@@ -69,6 +69,10 @@
if (!child_res->size)
continue;
+ /* Resources with 0 limit can't be assigned anything. */
+ if (!child_res->limit)
+ continue;
+
/*
* Propagate the resource alignment to the bridge resource. The
* condition can only be true for the first (largest) resource. For all
@@ -84,15 +88,14 @@
bridge_res->align = child_res->align;
/*
- * Propagate the resource limit to the bridge resource only if child
- * resource limit is non-zero. If a downstream device has stricter
- * requirements w.r.t. limits for any resource, that constraint needs to
- * be propagated back up to the downstream bridges of the domain. This
- * guarantees that the resource allocation which starts at the domain
- * level takes into account all these constraints thus working on a
- * global view.
+ * Propagate the resource limit to the bridge resource. If a downstream
+ * device has stricter requirements w.r.t. limits for any resource, that
+ * constraint needs to be propagated back up to the downstream bridges
+ * of the domain. This guarantees that the resource allocation which
+ * starts at the domain level takes into account all these constraints
+ * thus working on a global view.
*/
- if (child_res->limit && (child_res->limit < bridge_res->limit))
+ if (child_res->limit < bridge_res->limit)
bridge_res->limit = child_res->limit;
/*