summaryrefslogtreecommitdiffstats
path: root/layout.c
diff options
context:
space:
mode:
authorDaniel Campello <campello@chromium.org>2021-04-19 18:43:09 -0600
committerEdward O'Callaghan <quasisec@chromium.org>2021-05-04 02:18:43 +0000
commit7367f77aa45bfbbb826b6f8cbc2318dfe5a689c7 (patch)
treee0912df65a061eef4a999e4b734e7f8e03ef1267 /layout.c
parent6509912a1de079dd7cbd173d0232e23787b2ec67 (diff)
downloadflashrom-7367f77aa45bfbbb826b6f8cbc2318dfe5a689c7.tar.gz
flashrom-7367f77aa45bfbbb826b6f8cbc2318dfe5a689c7.tar.bz2
flashrom-7367f77aa45bfbbb826b6f8cbc2318dfe5a689c7.zip
cli_classic.c: implement set_wp_region operation
set_wp_region allows to set the wp_range based on a layout region. Signed-off-by: Daniel Campello <campello@chromium.org> Change-Id: Ibad68a038ab38b9986b0d8b5f5eb6c73b20ef381 Reviewed-on: https://review.coreboot.org/c/flashrom/+/52531 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'layout.c')
-rw-r--r--layout.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/layout.c b/layout.c
index 7fd203d13..4d1dd560f 100644
--- a/layout.c
+++ b/layout.c
@@ -184,6 +184,20 @@ static int find_romentry(struct flashrom_layout *const l, char *name, char *file
return 0;
}
+int get_region_range(struct flashrom_layout *const l, const char *name,
+ unsigned int *start, unsigned int *len)
+{
+ size_t i;
+ for (i = 0; i < l->num_entries; ++i) {
+ if (!strcmp(l->entries[i].name, name)) {
+ *start = l->entries[i].start;
+ *len = l->entries[i].end - l->entries[i].start + 1;
+ return 0;
+ }
+ }
+ return 1;
+}
+
/* process -i arguments
* returns 0 to indicate success, >0 to indicate failure
*/