Nikolai Artemiev has uploaded this change for review.
libflashrom,writeprotect: add flashrom_wp_get_range()
BUG=b:195381327,b:153800563
TEST=flashrom --wp-{status,range}
BRANCH=none
Change-Id: I5a1dfcf384166b1bac319d286306747e1dcaa000
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
---
M libflashrom.h
M writeprotect.c
2 files changed, 19 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/83/59183/1
diff --git a/libflashrom.h b/libflashrom.h
index eeb29ab..b55df18 100644
--- a/libflashrom.h
+++ b/libflashrom.h
@@ -138,4 +138,6 @@
int flashrom_wp_write_chip_config(struct flashrom_flashctx *flash, const struct flashrom_wp_chip_config *cfg);
int flashrom_wp_compare_chip_configs(const struct flashrom_wp_chip_config *cfga, const struct flashrom_wp_chip_config *cfgb);
+int flashrom_wp_get_range(const struct flashrom_wp_chip_config *cfg, struct flashrom_wp_range *range);
+
#endif /* !__LIBFLASHROM_H__ */
diff --git a/writeprotect.c b/writeprotect.c
index 3ce551d..7a8da71 100644
--- a/writeprotect.c
+++ b/writeprotect.c
@@ -168,3 +168,20 @@
return ord;
}
+
+/**
+ * @brief Get the range selected by a WP configuration.
+ *
+ * @param[in] cfg A flash chip's WP configuration.
+ * @param[out] range The range selected by the configuration.
+ *
+ * @return 0 on success
+ */
+int flashrom_wp_get_range(const struct wp_chip_config *cfg, struct wp_range *range)
+{
+ range->chip_len = cfg->chip->total_size * cfg->chip->page_size;
+ cfg->chip->decode_range(cfg, range);
+
+ return 0;
+}
+
To view, visit change 59183. To unsubscribe, or for help writing mail filters, visit settings.