Sergii Dmytruk has uploaded this change for review.
writeprotect: add WPS bit and set it to zero
Handle WPS by always setting it to zero until proper support for it is
implemented.
Change-Id: I2c26ec65d64a3b6fb1f1a73690bc771415db2744
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
---
M flash.h
M writeprotect.c
2 files changed, 6 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/31/60231/1
diff --git a/flash.h b/flash.h
index 16a31ed..a49e615 100644
--- a/flash.h
+++ b/flash.h
@@ -315,6 +315,7 @@
struct reg_bit_info tb;
struct reg_bit_info sec;
struct reg_bit_info cmp;
+ struct reg_bit_info wps; /* Write Protect Selection (per sector protection when set) */
} reg_bits;
wp_range_decode_fn_t decode_range;
diff --git a/writeprotect.c b/writeprotect.c
index bcd0657..39c782f 100644
--- a/writeprotect.c
+++ b/writeprotect.c
@@ -79,6 +79,7 @@
ret |= read_reg_bit(flash, bits->tb, &cfg->tb, &cfg->tb_bit_present);
ret |= read_reg_bit(flash, bits->sec, &cfg->sec, &cfg->sec_bit_present);
ret |= read_reg_bit(flash, bits->cmp, &cfg->cmp, &cfg->cmp_bit_present);
+ /* Note: WPS bit isn't read here, because it's not part of any range. */
for(size_t i = 0; bits->bp[i].reg != INVALID_REG; i++) {
ret |= read_reg_bit(flash, bits->bp[i], &cfg->bp[i], &tmp);
@@ -130,6 +131,8 @@
set_reg_bit(reg_values, write_masks, bits->tb, cfg->tb);
set_reg_bit(reg_values, write_masks, bits->sec, cfg->sec);
set_reg_bit(reg_values, write_masks, bits->cmp, cfg->cmp);
+ /* Note: always setting WPS bit to zero until its fully supported. */
+ set_reg_bit(reg_values, write_masks, bits->wps, 0);
/* Write each register */
for (enum flash_reg reg = INVALID_REG; reg < MAX_REGISTERS; reg++) {
@@ -262,6 +265,8 @@
if (can_write_bit(bits->cmp))
range_bits[bit_count++] = &cfg.cmp;
+ /* TODO: take WPS bit into account. */
+
/* Enumerate all values the range bits can take and find the range
* associated with each one. */
*count = (1 << bit_count);
To view, visit change 60231. To unsubscribe, or for help writing mail filters, visit settings.