summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2018-11-21 00:05:12 +0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-12-04 01:18:22 +0000
commit7a82ccc6bd8edf869c354c8004d275d46ae553d4 (patch)
treefa3c8e6cf6d777dab6c9089c429a1f1e55257fb2
parent3af78d31382aae6765a88d257b10e318192fd61e (diff)
downloadvboot-7a82ccc6bd8edf869c354c8004d275d46ae553d4.tar.gz
vboot_api: add VbSaveTpmState call for use in depthcharge
When booting into Alt OS legacy mode, we plan to save TPM state and disable TPM before handing off control to the OS. This API call is needed for saving state in depthcharge just before boot. BUG=b:118172063 TEST=None Change-Id: Ibbee0d6375de2179afa0ba64d272af72185db5a5 Reviewed-on: https://chromium-review.googlesource.com/c/1344329 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--Makefile1
-rw-r--r--firmware/include/vboot_api.h9
-rw-r--r--firmware/lib/vboot_tpm.c13
3 files changed, 23 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 33c410cc..d7b05007 100644
--- a/Makefile
+++ b/Makefile
@@ -343,6 +343,7 @@ VBSLK_SRCS = \
firmware/lib/vboot_audio.c \
firmware/lib/vboot_display.c \
firmware/lib/vboot_kernel.c \
+ firmware/lib/vboot_tpm.c \
firmware/lib/vboot_ui.c \
firmware/lib/vboot_ui_menu.c \
firmware/lib/region-kernel.c \
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h
index 05a509d1..73e5b5f6 100644
--- a/firmware/include/vboot_api.h
+++ b/firmware/include/vboot_api.h
@@ -435,6 +435,15 @@ VbError_t VbUnlockDevice(void);
*/
VbError_t VbLockDevice(void);
+/**
+ * Save the TPM state.
+ *
+ * Exposes a function to save TPM state. Expected to be used in depthcharge
+ * right before disabling the TPM, so that the next time TPM is asked to wake
+ * up and restore its state (S3 resume), it will have state available.
+ */
+uint32_t VbSaveTpmState(void);
+
/*****************************************************************************/
/* Debug output (from utility.h) */
diff --git a/firmware/lib/vboot_tpm.c b/firmware/lib/vboot_tpm.c
new file mode 100644
index 00000000..9c8edd6a
--- /dev/null
+++ b/firmware/lib/vboot_tpm.c
@@ -0,0 +1,13 @@
+/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * TPM functions implemented in vboot_reference and exposed to depthcharge.
+ */
+
+#include "tlcl.h"
+#include "vboot_api.h"
+
+uint32_t VbSaveTpmState(void) {
+ return TlclSaveState();
+}