summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2023-04-12 16:35:24 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-04-13 05:53:29 +0000
commitfd4151fe81b041c480db9c265fb24e84aa6ef4dc (patch)
treef6c4420a1a3b8d866a31368c3ded312531c03c6a
parentd18304f13839491f818e6b7293467d514d94389d (diff)
downloadchrome-ec-fd4151fe81b041c480db9c265fb24e84aa6ef4dc.tar.gz
zephyr: Kconfig: add FLASH_PSTATE_BANK / FLASH_PSTATE_LOCKED
BUG=b:277557274 TEST=1. `zmake compare-builds --all` This change should not affect existing boards 2. write protect works on roach BRANCH=none Change-Id: I697215c1990c7d12cd81e9b50b940485934da1bb Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4415812 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
-rw-r--r--util/config_allowed.txt2
-rw-r--r--zephyr/Kconfig.flash24
-rw-r--r--zephyr/shim/include/config_chip.h10
3 files changed, 34 insertions, 2 deletions
diff --git a/util/config_allowed.txt b/util/config_allowed.txt
index d952250e8f..0a5d140b80 100644
--- a/util/config_allowed.txt
+++ b/util/config_allowed.txt
@@ -393,8 +393,6 @@ CONFIG_FLASH_MULTIPLE_REGION
CONFIG_FLASH_PHYSICAL
CONFIG_FLASH_PROTECT_NEXT_BOOT
CONFIG_FLASH_PROTECT_RW
-CONFIG_FLASH_PSTATE_BANK
-CONFIG_FLASH_PSTATE_LOCKED
CONFIG_FLASH_READOUT_PROTECTION
CONFIG_FLASH_READOUT_PROTECTION_AS_PSTATE
CONFIG_FLASH_REGION_TYPE_COUNT
diff --git a/zephyr/Kconfig.flash b/zephyr/Kconfig.flash
index 8f3c77499a..44c4b0617f 100644
--- a/zephyr/Kconfig.flash
+++ b/zephyr/Kconfig.flash
@@ -120,6 +120,30 @@ config PLATFORM_EC_FLASH_PSTATE
defined, write protect state is maintained solely by the physical
flash driver.
+if PLATFORM_EC_FLASH_PSTATE
+
+config PLATFORM_EC_FLASH_PSTATE_BANK
+ bool "Store the pstate data in its own dedicated bank of flash"
+ default y
+ help
+ Store the pstate data in its own dedicated bank of flash. This allows
+ disabling the protect-RO-at-boot flag without rewriting the RO
+ firmware, but costs a bank of flash.
+
+ If this is not defined, the pstate data is stored inside the RO
+ firmware image itself. This is more space-efficient, but the only way
+ to clear the flag once it's set is to rewrite the RO firmware (after
+ removing the WP screw, of course).
+
+config PLATFORM_EC_FLASH_PSTATE_LOCKED
+ bool "Lock the pstate by default"
+ depends on !PLATFORM_EC_FLASH_PSTATE_BANK
+ help
+ Lock the pstate by default, Currently only supported when
+ PLATFORM_EC_FLASH_PSTATE_BANK is not defined.
+
+endif # PLATFORM_EC_FLASH_PSTATE
+
config PLATFORM_EC_USE_ZEPHYR_FLASH_PAGE_LAYOUT
bool "Use Zephyr flash page layout API to get sector information"
default y if SOC_FAMILY_STM32
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 0ea6bcd187..2659ac66ce 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -585,6 +585,8 @@ extern char mock_jump_data[CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE];
#undef CONFIG_INTERNAL_STORAGE
#undef CONFIG_MAPPED_STORAGE
#undef CONFIG_FLASH_PSTATE
+#undef CONFIG_FLASH_PSTATE_BANK
+#undef CONFIG_FLASH_PSTATE_LOCKED
#ifdef CONFIG_PLATFORM_EC_FLASH_CROS
#ifdef CONFIG_BOARD_NATIVE_POSIX
@@ -620,6 +622,14 @@ extern char mock_jump_data[CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE];
#define CONFIG_FLASH_PSTATE
#endif
+#ifdef CONFIG_PLATFORM_EC_FLASH_PSTATE_BANK
+#define CONFIG_FLASH_PSTATE_BANK
+#endif
+
+#ifdef CONFIG_PLATFORM_EC_FLASH_PSTATE_LOCKED
+#define CONFIG_FLASH_PSTATE_LOCKED
+#endif
+
#undef CONFIG_CMD_FLASH
#ifdef CONFIG_PLATFORM_EC_CONSOLE_CMD_FLASH
#define CONFIG_CMD_FLASH