summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2016-09-26 15:47:16 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-09-27 00:27:37 -0700
commitd6d12ec67bb0d20229ee0c273bc9d917b0821eb4 (patch)
tree8583a23dd0806c9ec0e20d1d1b80bd3be482cb2e
parent98541217dfd5f0a3fa29db27c4469c6de26842f3 (diff)
downloadchrome-ec-d6d12ec67bb0d20229ee0c273bc9d917b0821eb4.tar.gz
cr50: tpm: ignore sys_rst_l/plt_rst_l when TPM reset is in progress
There is no point in invoking TPM reset while the current invocation is in progress. One of the cases when this is happening is early start up on Kevin/Gru: the device starts booting, the EC comes around to pulsing sys_rst_l when TPM is already busy installing endorsement certificates. There is no point in issuing another reset at that point, just let the process continue. BRANCH=none BUG=chrome-os-partner:52366 TEST=firmware_TPMKernelVersion firmware_TPMExtend autotests still pass on kevin. Certificate installation during startup does not get interrupted any more. Change-Id: Ibdface9f7a76186e210ef0f4111cd5fe9905bba9 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/389811 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--board/cr50/board.c8
-rw-r--r--common/tpm_registers.c7
-rw-r--r--include/tpm_registers.h7
3 files changed, 19 insertions, 3 deletions
diff --git a/board/cr50/board.c b/board/cr50/board.c
index e370973778..b232633a87 100644
--- a/board/cr50/board.c
+++ b/board/cr50/board.c
@@ -390,9 +390,13 @@ void sys_rst_asserted(enum gpio_signal signal)
* Cr50 drives SYS_RST_L in certain scenarios, in those cases
* this signal's assertion should be ignored here.
*/
- CPRINTS("%s", __func__);
- if (usb_spi_update_in_progress() || is_sys_rst_asserted())
+ CPRINTS("%s from %d", __func__, signal);
+ if (usb_spi_update_in_progress() ||
+ is_sys_rst_asserted() ||
+ tpm_is_resetting()) {
+ CPRINTS("%s ignored", __func__);
return;
+ }
/* Re-initialize the TPM software state */
tpm_reset();
diff --git a/common/tpm_registers.c b/common/tpm_registers.c
index a2bdec4925..0e2733b472 100644
--- a/common/tpm_registers.c
+++ b/common/tpm_registers.c
@@ -625,6 +625,11 @@ int tpm_reset(void)
return 1;
}
+int tpm_is_resetting(void)
+{
+ return reset_in_progress;
+}
+
static void tpm_reset_now(void)
{
reset_in_progress = 1;
@@ -659,7 +664,7 @@ static void tpm_reset_now(void)
void tpm_task(void)
{
- tpm_init();
+ tpm_reset_now();
while (1) {
uint8_t *response;
unsigned response_size;
diff --git a/include/tpm_registers.h b/include/tpm_registers.h
index 9c9390ffb7..dfdfefdc34 100644
--- a/include/tpm_registers.h
+++ b/include/tpm_registers.h
@@ -42,6 +42,13 @@ void tpm_register_interface(interface_restart_func interface_restart);
int tpm_reset(void);
/*
+ * Return true if tpm is being reset. Usually this helps to avoid unnecessary
+ * extra reset early at startup time, when TPM could be busy installing
+ * endorsement certificates.
+ */
+int tpm_is_resetting(void);
+
+/*
* This structure describes the header of all commands and responses sent and
* received over TPM FIFO.
*