summaryrefslogtreecommitdiff
path: root/include/tpm_registers.h
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2016-09-21 16:58:26 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-09-24 16:22:14 -0700
commit4250da3ba977fd6bfb80b1bf6086cd142c461e5a (patch)
tree486186f63516d68ef1f7738523a640727fb306b7 /include/tpm_registers.h
parente29005abe7497988e14e0ef87f602a5417d003e6 (diff)
downloadchrome-ec-4250da3ba977fd6bfb80b1bf6086cd142c461e5a.tar.gz
Cr50: Add mostly-synchronous tpm_reset() function.
To reset the TPM task, we send it an event so that it will reset only when it's not busy doing actual TPM stuff that might fiddle with the stack or shared memory. But that means that we can't always know when the task finally gets around to resetting itself. This CL adds a tpm_reset() function that blocks until the reset actually occurs. Obviously it can't do that if it's being called in interrupt context or from the TPM task itself, but otherwise it does. BUG=chrome-os-partner:52366 BRANCH=none CQ-DEPEND=CL:361680 TEST=make buildall, test on Gru, manual tests In addition to the normal rebooting, logging in/out, and so forth. I added a temporary console command to call tpm_reset() and scattered a bunch of ccprintfs around it. When called due to SYS_RST_L, it didn't block. When invoked with the console command, it did. Change-Id: I51e8b1299dbdcd1a12273cf48a890e93ed32a8c8 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/388125 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include/tpm_registers.h')
-rw-r--r--include/tpm_registers.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/tpm_registers.h b/include/tpm_registers.h
index 35f6dff471..037fc73441 100644
--- a/include/tpm_registers.h
+++ b/include/tpm_registers.h
@@ -32,6 +32,17 @@ void sps_tpm_disable(void);
size_t tpm_get_burst_size(void);
/*
+ * Reset the TPM. This sends a request to the TPM task, so that the reset can
+ * happen when the TPM task finishes whatever it's doing at the moment.
+ *
+ * Returns 0 if the request was made, but we can't wait for it to complete
+ * because we're in interrupt context or something similar. Otherwise, it
+ * blocks and returns 1 after the TPM has been cleared, or returns -1 if the
+ * request timed out.
+ */
+int tpm_reset(void);
+
+/*
* This structure describes the header of all commands and responses sent and
* received over TPM FIFO.
*