From 7367f77aa45bfbbb826b6f8cbc2318dfe5a689c7 Mon Sep 17 00:00:00 2001 From: Daniel Campello Date: Mon, 19 Apr 2021 18:43:09 -0600 Subject: 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 Change-Id: Ibad68a038ab38b9986b0d8b5f5eb6c73b20ef381 Reviewed-on: https://review.coreboot.org/c/flashrom/+/52531 Reviewed-by: Edward O'Callaghan Tested-by: build bot (Jenkins) --- layout.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'layout.c') 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 */ -- cgit v1.2.3