summaryrefslogtreecommitdiff
path: root/chip/lm4/flash.c
diff options
context:
space:
mode:
authorLouis Yung-Chieh Lo <yjlou@chromium.org>2012-08-23 15:30:05 +0800
committerGerrit <chrome-bot@google.com>2012-08-25 15:12:41 -0700
commitb11c1e234b86498311c340bd8b9b51b8d22e2ff5 (patch)
tree45100ad8096956ad5b7722df9ba593a9d654e515 /chip/lm4/flash.c
parent26f45005642527e51f6814ac8e98544651a8fba5 (diff)
downloadchrome-ec-b11c1e234b86498311c340bd8b9b51b8d22e2ff5.tar.gz
Rename EC_FLASH_PROTECT_RW_* flags to EC_FLASH_PROTECT_ALL_*.
Current *_RW_NOW/RW_AT_BOOT is used to lock the entire flash. This could lead confusion in the future. So, rename them. Since the bit definition is unchanged, thus the callers (u-boot, flashrom) is fine if they don't change the name. BUG=chrome-os-partner:12951 BRANCH=snow,link TEST=build in chroot only:daisy,snow,link,bds Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Change-Id: I2395e93793f590e6fb8aae7006eb8e5c836002bc Reviewed-on: https://gerrit.chromium.org/gerrit/31199 Commit-Ready: Yung-Chieh Lo <yjlou@chromium.org> Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org> Tested-by: Yung-Chieh Lo <yjlou@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'chip/lm4/flash.c')
-rw-r--r--chip/lm4/flash.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/chip/lm4/flash.c b/chip/lm4/flash.c
index c9922b4ea4..9309fc7c35 100644
--- a/chip/lm4/flash.c
+++ b/chip/lm4/flash.c
@@ -296,7 +296,7 @@ uint32_t flash_get_protect(void)
i < RO_BANK_OFFSET + RO_BANK_COUNT) ||
i == PSTATE_BANK);
int bank_flag = (is_ro ? EC_FLASH_PROTECT_RO_NOW :
- EC_FLASH_PROTECT_RW_NOW);
+ EC_FLASH_PROTECT_ALL_NOW);
if (flash_physical_get_protect(i)) {
/* At least one bank in the region is protected */
@@ -307,6 +307,10 @@ uint32_t flash_get_protect(void)
}
}
+ if ((flags & EC_FLASH_PROTECT_ALL_NOW) &&
+ !(flags & EC_FLASH_PROTECT_RO_NOW))
+ flags |= EC_FLASH_PROTECT_ERROR_INCONSISTENT;
+
/* Check if blocks were stuck locked at pre-init */
if (stuck_locked)
flags |= EC_FLASH_PROTECT_ERROR_STUCK;
@@ -347,8 +351,8 @@ int flash_set_protect(uint32_t mask, uint32_t flags)
protect_banks(RO_BANK_OFFSET, RO_BANK_COUNT);
}
- if ((mask & EC_FLASH_PROTECT_RW_NOW) &&
- (flags & EC_FLASH_PROTECT_RW_NOW)) {
+ if ((mask & EC_FLASH_PROTECT_ALL_NOW) &&
+ (flags & EC_FLASH_PROTECT_ALL_NOW)) {
/* Protect the entire flash */
protect_banks(0, CONFIG_FLASH_PHYSICAL_SIZE /
CONFIG_FLASH_BANK_SIZE);
@@ -361,7 +365,7 @@ int flash_pre_init(void)
{
uint32_t reset_flags = system_get_reset_flags();
uint32_t prot_flags = flash_get_protect();
- uint32_t unwanted_prot_flags = EC_FLASH_PROTECT_RW_NOW |
+ uint32_t unwanted_prot_flags = EC_FLASH_PROTECT_ALL_NOW |
EC_FLASH_PROTECT_ERROR_INCONSISTENT;
/*