diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-07-25 16:44:12 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-07-25 18:07:17 -0700 |
commit | 3cc4745be2503a4da28ca92e63b9cf5397f5a820 (patch) | |
tree | be273bb2a774b99ffa61144d4cc2a724aeb5b0bc | |
parent | 36a3989fc437c513bcbeee7977d96239e7fe6295 (diff) | |
download | chrome-ec-3cc4745be2503a4da28ca92e63b9cf5397f5a820.tar.gz |
Don't protect firmware now if protect-ro-at-boot is not set
Otherwise, EC software sync protects the entire firmware except in recovery mode, regardless of the WP pin.
BUG=chrome-os-partner:11847
TEST=boot with WP enabled but RO-at-boot disabled; flashinfo should show
entire flash still writable
CQ-DEPEND=28444
Change-Id: I58d60adfaa952b127e8695213f95f6da0e34821d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28445
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r-- | chip/lm4/flash.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/chip/lm4/flash.c b/chip/lm4/flash.c index 826783b45b..8eab52ca9c 100644 --- a/chip/lm4/flash.c +++ b/chip/lm4/flash.c @@ -326,8 +326,12 @@ int flash_set_protect(uint32_t mask, uint32_t flags) retval = rv; } - /* All subsequent flags only work if write protect is disabled */ - if (!(flash_get_protect() & EC_FLASH_PROTECT_GPIO_ASSERTED)) + /* + * All subsequent flags only work if write protect is enabled (that is, + * hardware WP flag) *and* RO is protected at boot (software WP flag). + */ + if ((~flash_get_protect()) & (EC_FLASH_PROTECT_GPIO_ASSERTED | + EC_FLASH_PROTECT_RO_AT_BOOT)) return retval; if ((mask & EC_FLASH_PROTECT_RO_NOW) && |