mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-02 14:33:18 +02:00
layout: Introduce flashrom_layout_add_region()
Adds a region to an existing layout, as long as there is space. Change-Id: I50d473d0d5d1fb38bd6f9ae3d7127e9ea66a94e1 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/33517 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
@ -1278,25 +1278,20 @@ int layout_from_ich_descriptors(struct ich_layout *const layout, const void *con
|
||||
}
|
||||
|
||||
memset(layout, 0x00, sizeof(*layout));
|
||||
layout->base.entries = layout->entries;
|
||||
layout->base.capacity = ARRAY_SIZE(layout->entries);
|
||||
layout->base.num_entries = 0;
|
||||
|
||||
ssize_t i, j;
|
||||
ssize_t i;
|
||||
const ssize_t nr = MIN(ich_number_of_regions(cs, &desc.content), (ssize_t)ARRAY_SIZE(regions));
|
||||
for (i = 0, j = 0; i < nr; ++i) {
|
||||
for (i = 0; i < nr; ++i) {
|
||||
const chipoff_t base = ICH_FREG_BASE(desc.region.FLREGs[i]);
|
||||
const chipoff_t limit = ICH_FREG_LIMIT(desc.region.FLREGs[i]);
|
||||
if (limit <= base)
|
||||
continue;
|
||||
layout->entries[j].start = base;
|
||||
layout->entries[j].end = limit;
|
||||
layout->entries[j].included = false;
|
||||
layout->entries[j].name = strdup(regions[i]);
|
||||
if (!layout->entries[j].name)
|
||||
if (flashrom_layout_add_region(&layout->base, base, limit, regions[i]))
|
||||
return 2;
|
||||
++j;
|
||||
}
|
||||
layout->base.entries = layout->entries;
|
||||
layout->base.capacity = ARRAY_SIZE(layout->entries);
|
||||
layout->base.num_entries = j;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user