summaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2020-05-23 18:15:34 +0200
committerFelix Held <felix-coreboot@felixheld.de>2022-06-27 14:00:23 +0000
commit74169c1c71b69b19b64d692fc16da35afe51a55b (patch)
tree9820ed8a8f862206643fd5e11e4800a55e06c8d2 /src/device
parentb327704a3f6e230c0b51eba63e0e2c3fe64b6923 (diff)
allocator_v4: Make it explicit that we start with the highest alignment
As we walk the results of largest_resource(), we actually know that the condition can only be true for the first return value. So there's no need to keep track of the first loop iteration. Change-Id: I6d6b99e38706c0c70f3570222d97a1d71ba79744 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/65401 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/device')
-rw-r--r--src/device/resource_allocator_v4.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/device/resource_allocator_v4.c b/src/device/resource_allocator_v4.c
index 707ccf0a96..18667b7623 100644
--- a/src/device/resource_allocator_v4.c
+++ b/src/device/resource_allocator_v4.c
@@ -43,7 +43,6 @@ static void update_bridge_resource(const struct device *bridge, struct resource
const struct device *child;
struct resource *child_res;
resource_t base;
- bool first_child_res = true;
const unsigned long type_mask = IORESOURCE_TYPE_MASK | IORESOURCE_PREFETCH;
struct bus *bus = bridge->link_list;
@@ -71,21 +70,19 @@ static void update_bridge_resource(const struct device *bridge, struct resource
continue;
/*
- * Propagate the resource alignment to the bridge resource if this is
- * the first child resource with non-zero size being considered. For all
+ * Propagate the resource alignment to the bridge resource. The
+ * condition can only be true for the first (largest) resource. For all
* other children resources, alignment is taken care of by updating the
* base to round up as per the child resource alignment. It is
* guaranteed that pass 2 follows the exact same method of picking the
* resource for allocation using largest_resource(). Thus, as long as
- * the alignment for first child resource is propagated up to the bridge
- * resource, it can be guaranteed that the alignment for all resources
- * is appropriately met.
+ * the alignment for the largest child resource is propagated up to the
+ * bridge resource, it can be guaranteed that the alignment for all
+ * resources is appropriately met.
*/
- if (first_child_res && (child_res->align > bridge_res->align))
+ if (child_res->align > bridge_res->align)
bridge_res->align = child_res->align;
- first_child_res = false;
-
/*
* Propagate the resource limit to the bridge resource only if child
* resource limit is non-zero. If a downstream device has stricter