1
0
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:
Nico Huber
2019-06-15 15:55:11 +02:00
parent 7ebd578100
commit f394fcec0d
5 changed files with 55 additions and 50 deletions

View File

@ -826,15 +826,11 @@ notfound:
struct single_layout *const fallback = &flash->fallback_layout;
fallback->base.entries = &fallback->entry;
fallback->base.capacity = 1;
fallback->base.num_entries = 1;
fallback->entry.start = 0;
fallback->entry.end = flash->chip->total_size * 1024 - 1;
fallback->entry.included = true;
fallback->entry.name = strdup("complete flash");
if (!fallback->entry.name) {
msg_cerr("Failed to probe chip: %s\n", strerror(errno));
fallback->base.num_entries = 0;
if (flashrom_layout_add_region(&fallback->base,
0, flash->chip->total_size * 1024 - 1, "complete flash") ||
flashrom_layout_include_region(&fallback->base, "complete flash"))
return -1;
}
tmp = flashbuses_to_text(flash->chip->bustype);
msg_cinfo("%s %s flash chip \"%s\" (%d kB, %s) ", force ? "Assuming" : "Found",