diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2017-07-31 19:01:04 -0700 |
---|---|---|
committer | Bernie Thompson <bhthompson@chromium.org> | 2017-08-19 00:08:19 +0000 |
commit | e677db8b20f2b38f9affb9d77d7d814ec6f8f97a (patch) | |
tree | 3943e4ada7c54a364e9bb70e6d24a3f18807e27a | |
parent | 7ad487dc3d862e7095dd84b80251c776dd157288 (diff) | |
download | chrome-ec-e677db8b20f2b38f9affb9d77d7d814ec6f8f97a.tar.gz |
cr50: make sure tpm reset in factory mode always happens
When the chip is used in the factory harness, the AP device state is
set to off, which prevents tpm reset from being invoked, which in turn
prevent the certificate from being copied into NVMEM.
Let's not wait for the AP to be up when running in chip factory mode.
BRANCH=cr50
BUG=b:63686091
TEST=running cert installation procedure produces SPI dummy byte of
c0c0c0c0... after the successful installation and of cbcbcbcb...
after repeated cert installation attempts.
Change-Id: Ibc4ff50511dccd8412a380ec03fc5ff8a14b0282
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/594953
Tested-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
(cherry picked from commit b52781d9931662257b3d4322799c31d399b4ca48)
Reviewed-on: https://chromium-review.googlesource.com/598487
(cherry picked from commit b9f0b1d3b0db48baf5ae5bf0eb62bb114ff404b7)
Reviewed-on: https://chromium-review.googlesource.com/622225
Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
Commit-Queue: Bernie Thompson <bhthompson@chromium.org>
Tested-by: Bernie Thompson <bhthompson@chromium.org>
-rw-r--r-- | common/tpm_registers.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/common/tpm_registers.c b/common/tpm_registers.c index 4e921ed451..cec0e4547b 100644 --- a/common/tpm_registers.c +++ b/common/tpm_registers.c @@ -820,20 +820,26 @@ void tpm_task(void) { uint32_t evt; - /* - * Just in case there is a resume from deep sleep where AP is not out - * of reset, let's not proceed until AP is actually up. - */ - while (device_get_state(DEVICE_AP) != DEVICE_STATE_ON) { + + if (!chip_factory_mode()) { /* - * The only event we should expect at this point would be the - * reset request. + * Just in case there is a resume from deep sleep where AP is + * not out of reset, let's not proceed until AP is actually + * up. No need to worry about the AP state in chip factory + * mode of course. */ - evt = task_wait_event(-1); - if (evt & TPM_EVENT_RESET) - break; + while (device_get_state(DEVICE_AP) != DEVICE_STATE_ON) { + /* + * The only event we should expect at this point would + * be the reset request. + */ + evt = task_wait_event(-1); + if (evt & TPM_EVENT_RESET) + break; - cprints(CC_TASK, "%s: unexpected event %x\n", __func__, evt); + cprints(CC_TASK, "%s: unexpected event %x\n", + __func__, evt); + } } tpm_reset_now(0); |