1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-01 14:11:15 +02:00

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>
This commit is contained in:
Daniel Campello
2021-04-19 18:43:09 -06:00
committed by Edward O'Callaghan
parent 6509912a1d
commit 7367f77aa4
3 changed files with 31 additions and 0 deletions

View File

@ -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
*/