1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-09-18 02:45:23 +02:00

libflashrom,writeprotect: add flashrom_wp_get_available_ranges()

Generate list of available ranges by enumerating all possible values
that range bits (BPx, TB, ...) can take and using the chip's range
decoding function to get the range that is selected by each one.

BUG=b:195381327,b:153800563
BRANCH=none
TEST=flashrom --wp-list

Change-Id: Id51f038f03305c8536d80313e52f77d27835f34d
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/58481
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Nikolai Artemiev
2021-10-21 01:50:15 +11:00
committed by Anastasia Klimchuk
parent 2c3a2d66a9
commit a548fe5a03
4 changed files with 281 additions and 0 deletions

View File

@@ -37,6 +37,12 @@ struct flashrom_wp_cfg {
struct wp_range range;
};
/* Collection of multiple write protection ranges. */
struct flashrom_wp_ranges {
struct wp_range *ranges;
size_t count;
};
/*
* Description of a chip's write protection configuration.
*
@@ -77,4 +83,7 @@ enum flashrom_wp_result wp_write_cfg(struct flashrom_flashctx *, const struct fl
/* Read WP configuration from the chip */
enum flashrom_wp_result wp_read_cfg(struct flashrom_wp_cfg *, struct flashrom_flashctx *);
/* Get a list of protection ranges supported by the chip */
enum flashrom_wp_result wp_get_available_ranges(struct flashrom_wp_ranges **, struct flashrom_flashctx *);
#endif /* !__WRITEPROTECT_H__ */