summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2018-11-29 19:39:05 +0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2019-01-08 03:57:38 +0000
commitc752f0a187164b4aee07095aa6cf06bb356f338e (patch)
treeca643bc6793b1b0608475255211d3da7a281d320
parentb69230fa10f5db2b346b4a9205f83cdf6d591556 (diff)
downloadvboot-c752f0a187164b4aee07095aa6cf06bb356f338e.tar.gz
2api: add call to reset Cr50
When booting into Alt OS legacy mode, we plan to disable TPM before handing off control to the OS. We need to reset Cr50 to get TPM back to its normal state. Add an API call to accomplish this. BUG=b:120586131 TEST=compile, flash, and boot eve Change-Id: I7eec4d97f4c59c63ab5cd0910e6a37f7e2877fc6 Reviewed-on: https://chromium-review.googlesource.com/c/1354146 Commit-Queue: Joel Kitching <kitching@chromium.org> Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
-rw-r--r--firmware/2lib/2stub.c6
-rw-r--r--firmware/2lib/include/2api.h7
-rw-r--r--firmware/2lib/include/2return_codes.h3
3 files changed, 16 insertions, 0 deletions
diff --git a/firmware/2lib/2stub.c b/firmware/2lib/2stub.c
index cca28831..1a8a7312 100644
--- a/firmware/2lib/2stub.c
+++ b/firmware/2lib/2stub.c
@@ -70,3 +70,9 @@ int vb2ex_tpm_set_mode(enum vb2_tpm_mode mode_val)
{
return VB2_ERROR_EX_TPM_SET_MODE_UNIMPLEMENTED;
}
+
+__attribute__((weak))
+int vb2ex_tpm_cr50_reset(uint16_t delay_ms)
+{
+ return VB2_ERROR_EX_TPM_RESET_UNIMPLEMENTED;
+}
diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h
index 3874aa71..9e3cdaa0 100644
--- a/firmware/2lib/include/2api.h
+++ b/firmware/2lib/include/2api.h
@@ -727,4 +727,11 @@ int vb2ex_tpm_get_mode(enum vb2_tpm_mode *mode_val);
*/
int vb2ex_tpm_set_mode(enum vb2_tpm_mode mode_val);
+/*
+ * Ask the Cr50 to reset after the delay specified.
+ *
+ * @returns VB2_SUCCESS, or non-zero error code.
+ */
+int vb2ex_tpm_cr50_reset(uint16_t delay_ms);
+
#endif /* VBOOT_2_API_H_ */
diff --git a/firmware/2lib/include/2return_codes.h b/firmware/2lib/include/2return_codes.h
index 913c625a..58744e20 100644
--- a/firmware/2lib/include/2return_codes.h
+++ b/firmware/2lib/include/2return_codes.h
@@ -615,6 +615,9 @@ enum vb2_return_code {
/* TPM set mode function is unimplemented (stubbed in 2lib/2stub.c) */
VB2_ERROR_EX_TPM_SET_MODE_UNIMPLEMENTED,
+ /* TPM reset function is unimplemented (stubbed in 2lib/2stub.c) */
+ VB2_ERROR_EX_TPM_RESET_UNIMPLEMENTED,
+
/**********************************************************************
* Errors generated by host library (non-firmware) start here.