Anastasia Klimchuk submitted this change.
writeprotect: add get_wp_range() for decoding ranges
BUG=b:195381327,b:153800563
BRANCH=none
TEST=flashrom --wp-{status,range} at end of patch series
Change-Id: I5a1dfcf384166b1bac319d286306747e1dcaa000
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/59183
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
---
M writeprotect.c
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/writeprotect.c b/writeprotect.c
index 20b5afc..ca9d9ec 100644
--- a/writeprotect.c
+++ b/writeprotect.c
@@ -150,9 +150,17 @@
return FLASHROM_WP_OK;
}
+/** Get the range selected by a WP configuration. */
+static enum flashrom_wp_result get_wp_range(struct wp_range *range, struct flashctx *flash, const struct wp_bits *bits)
+{
+ flash->chip->decode_range(&range->start, &range->len, bits, flashrom_flash_getsize(flash));
+
+ return FLASHROM_WP_OK;
+}
+
static bool chip_supported(struct flashctx *flash)
{
- return false;
+ return (flash->chip != NULL) && (flash->chip->decode_range != NULL);
}
enum flashrom_wp_result wp_read_cfg(struct flashrom_wp_cfg *cfg, struct flashctx *flash)
@@ -166,11 +174,11 @@
if (ret == FLASHROM_WP_OK)
ret = read_wp_bits(&bits, flash);
- /* TODO: implement get_wp_range() and get_wp_mode() and call them */
- /*
if (ret == FLASHROM_WP_OK)
ret = get_wp_range(&cfg->range, flash, &bits);
+ /* TODO: implement and get_wp_mode() and call it */
+ /*
if (ret == FLASHROM_WP_OK)
ret = get_wp_mode(&cfg->mode, &bits);
*/
To view, visit change 59183. To unsubscribe, or for help writing mail filters, visit settings.