diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-07-17 13:51:44 -0700 |
---|---|---|
committer | Randall Spangler <rspangler@chromium.org> | 2012-07-18 13:48:46 -0700 |
commit | ad2268e7396abc6ff094376eedec2402b06f3b21 (patch) | |
tree | 4ddfbb8b0bafbefc4e709173a4c743f52086ae94 /chip/lm4/flash.c | |
parent | 2bee304abda0f51bbc3d673daae26e583fb7ca55 (diff) | |
download | chrome-ec-ad2268e7396abc6ff094376eedec2402b06f3b21.tar.gz |
Simplify flash protection, part 1
1. If the flash protection state is locked, RO firmware is explicitly locked.
2. Protecting flash now locks the entire flash.
BUG=chrome-os-partner:11150
TEST=manual
flashinfo -> nothing protected
flashwp now
flashinfo -> unlocked,applied; everything protected
reboot
flashinfo -> nothing protected
flashwp lock ->
flashinfo -> locked,applied; now has 40 Y's at start and 1 at end
reboot
flashinfo -> locked,applied; now has 40 Y's at start and 1 at end
remove WP screw
reboot
flashinfo -> locked, not applied; nothing protected
flashwp unlock
flashinfo -> nothing protected
Change-Id: I2cf0e8bfe82ab7a5bf88b9161b7a05b889cae71a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27717
Diffstat (limited to 'chip/lm4/flash.c')
-rw-r--r-- | chip/lm4/flash.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/chip/lm4/flash.c b/chip/lm4/flash.c index 20c90793bd..c69538d5bc 100644 --- a/chip/lm4/flash.c +++ b/chip/lm4/flash.c @@ -171,15 +171,17 @@ int flash_physical_erase(int offset, int size) } -int flash_physical_get_protect(int block) +int flash_physical_get_protect(int bank) { - return (LM4_FLASH_FMPPE[F_BANK(block)] & F_BIT(block)) ? 0 : 1; + return (LM4_FLASH_FMPPE[F_BANK(bank)] & F_BIT(bank)) ? 0 : 1; } -void flash_physical_set_protect(int block) +void flash_physical_set_protect(int start_bank, int bank_count) { - LM4_FLASH_FMPPE[F_BANK(block)] &= ~F_BIT(block); + int bank; + for (bank = start_bank; bank < start_bank + bank_count; bank++) + LM4_FLASH_FMPPE[F_BANK(bank)] &= ~F_BIT(bank); } int flash_physical_pre_init(void) |