summaryrefslogtreecommitdiff
path: root/common/flash.c
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@google.com>2017-07-07 16:08:37 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-07-08 03:49:53 -0700
commit74d09422e98320766641f9e96b3ec0fe93a9d842 (patch)
treecfb01ad4d5134b9882d02536ef8c75d586d4c077 /common/flash.c
parentef3afbf95941e271162e7fc6e089a6a5e8e49452 (diff)
downloadchrome-ec-74d09422e98320766641f9e96b3ec0fe93a9d842.tar.gz
common/flash: Add option to set PSTATE to be locked by default
For hammer, we do not want to require finalization in factory, so we just protect RO whenever WP GPIO is set. BRANCH=none BUG=b:63378217 TEST=Enable CONFIG_FLASH_PSTATE_LOCKED, flash hammer, check with flashinfo that RO protection matches WP status. Change-Id: I902ee478c00a3c932277d2a7d0622c070654a5eb Reviewed-on: https://chromium-review.googlesource.com/563217 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common/flash.c')
-rw-r--r--common/flash.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/flash.c b/common/flash.c
index 46319a9508..99dea9ee98 100644
--- a/common/flash.c
+++ b/common/flash.c
@@ -98,7 +98,11 @@ BUILD_ASSERT(sizeof(struct persist_state) % CONFIG_FLASH_WRITE_SIZE == 0);
#endif
const uint32_t pstate_data __attribute__((section(".rodata.pstate"))) =
+#ifdef CONFIG_FLASH_PSTATE_LOCKED
+ PSTATE_MAGIC_LOCKED;
+#else
PSTATE_MAGIC_UNLOCKED;
+#endif
#endif /* !CONFIG_FLASH_PSTATE_BANK */
#endif /* CONFIG_FLASH_PSTATE */