diff options
author | Nico Huber <nico.h@gmx.de> | 2019-06-15 15:55:11 +0200 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2021-06-26 15:54:22 +0000 |
commit | f394fcec0da2fd4a9d1bd7a7911065344e67ce34 (patch) | |
tree | cdce7e8fe9c980df3602711cc7de9881f2deaf3e /flashrom.c | |
parent | 7ebd578100e6526ef46c98cb9978d692160d8179 (diff) | |
download | flashrom-f394fcec0da2fd4a9d1bd7a7911065344e67ce34.tar.gz flashrom-f394fcec0da2fd4a9d1bd7a7911065344e67ce34.tar.bz2 flashrom-f394fcec0da2fd4a9d1bd7a7911065344e67ce34.zip |
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>
Diffstat (limited to 'flashrom.c')
-rw-r--r-- | flashrom.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -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", |