summaryrefslogtreecommitdiffstats
path: root/writeprotect.h
diff options
context:
space:
mode:
authorNikolai Artemiev <nartemiev@google.com>2021-10-21 01:50:15 +1100
committerAnastasia Klimchuk <aklm@chromium.org>2022-03-01 04:29:42 +0000
commita548fe5a0341ec1318a0df911f90313d82e2a573 (patch)
tree05b428589f4fd186a268c6a1e680ff944c592059 /writeprotect.h
parent2c3a2d66a96b782f50dd886caea2a93dec69530e (diff)
downloadflashrom-a548fe5a0341ec1318a0df911f90313d82e2a573.tar.gz
flashrom-a548fe5a0341ec1318a0df911f90313d82e2a573.tar.bz2
flashrom-a548fe5a0341ec1318a0df911f90313d82e2a573.zip
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>
Diffstat (limited to 'writeprotect.h')
-rw-r--r--writeprotect.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/writeprotect.h b/writeprotect.h
index d54befad4..e27403dcf 100644
--- a/writeprotect.h
+++ b/writeprotect.h
@@ -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__ */