summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-01-15 15:25:28 -0700
committerCommit Bot <commit-bot@chromium.org>2021-01-20 00:39:07 +0000
commitb5855281c84b7f18533de252b8c6959df3e03469 (patch)
tree4355d9aa98b41e8fb1e2e6b9b1e8585f7d34fc93
parent9418a359d7a0ac28cffdd4288c206fa0979d681d (diff)
downloadchrome-ec-b5855281c84b7f18533de252b8c6959df3e03469.tar.gz
zephyr: Add support for vstore
This is needed for the AP firmware to store a hash during boot. Add it to the build. BUG=b:177686660 BRANCH=none TEST=make BOARD=volteer -j30 boot volteer and see that command 4b is handled without error: [1.540100 HC 0x4b] [1.540800 HC 0x49] Change-Id: Idb4a5b602995adb3911906f5b09d0bccf8cf8d46 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2633653 Tested-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
-rw-r--r--zephyr/CMakeLists.txt2
-rw-r--r--zephyr/Kconfig25
-rw-r--r--zephyr/shim/include/config_chip.h7
3 files changed, 34 insertions, 0 deletions
diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt
index f00c16e8c7..47ca1af9ef 100644
--- a/zephyr/CMakeLists.txt
+++ b/zephyr/CMakeLists.txt
@@ -194,4 +194,6 @@ zephyr_sources_ifdef(CONFIG_PLATFORM_EC_USBC_PPC_SN5S330
zephyr_sources_ifdef(CONFIG_PLATFORM_EC_USBC_PPC_SYV682X
"${PLATFORM_EC}/driver/ppc/syv682x.c")
+zephyr_sources_ifdef(CONFIG_PLATFORM_EC_VSTORE "${PLATFORM_EC}/common/vstore.c")
+
zephyr_sources_ifdef(CONFIG_SHELL "${PLATFORM_EC}/common/gpio_commands.c")
diff --git a/zephyr/Kconfig b/zephyr/Kconfig
index 97426970d6..6c16e7b3b1 100644
--- a/zephyr/Kconfig
+++ b/zephyr/Kconfig
@@ -352,4 +352,29 @@ config PLATFORM_EC_CONSOLE_CMD_WAITMS
endif # PLATFORM_EC_TIMER
+config PLATFORM_EC_VSTORE
+ bool "Secure temporary storage for verified boot"
+ default y
+ help
+ Enable support for storing a block of data received from the AP so it
+ can be read back later by the AP. This is helpful since the AP may
+ reboot or resume and want the data early in its start-up before it
+ has access to SDRAM.
+
+ There are a fixed number of slots and each can hold a fixed amount of
+ data (EC_VSTORE_SLOT_SIZE bytes). Once a slot is written it is locked
+ and cannot be written again unless explicitly unlocked.
+
+ Stored data is preserved when the EC moved from RO to RW.
+
+config PLATFORM_EC_VSTORE_SLOT_COUNT
+ int "Number of slots"
+ depends on PLATFORM_EC_VSTORE
+ default 1
+ help
+ Set the number of slots available in the verified-boot store. The
+ number required depends on the AP firmware. Typically the vstore is
+ used only for recording a hash of the read-write AP firmware for
+ checking on resume. For this, one slot is enough.
+
endif # PLATFORM_EC
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 17074aceed..268529915a 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -584,4 +584,11 @@ enum battery_type {
#define CONFIG_USB_PD_USB4
#endif
+#undef CONFIG_VSTORE
+#undef VSTORE_SLOT_COUNT
+#ifdef CONFIG_PLATFORM_EC_VSTORE
+#define CONFIG_VSTORE
+#define CONFIG_VSTORE_SLOT_COUNT CONFIG_PLATFORM_EC_VSTORE_SLOT_COUNT
+#endif
+
#endif /* __CROS_EC_CONFIG_CHIP_H */