diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2021-06-25 15:23:24 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-06-30 23:48:31 +0000 |
commit | 8afa696aa05a02ee6a4015533a011a6b82716f05 (patch) | |
tree | 31fe0b4cef21f51d4f0d0c8f157219a9bf556641 /board/cr50/board.c | |
parent | 1e68e66a387c91b63a7a79324f3c828f7f0fed4b (diff) | |
download | chrome-ec-8afa696aa05a02ee6a4015533a011a6b82716f05.tar.gz |
tpm_mode: make available to all boards and restore on resets
This patch removes the restriction of TPM_MODE vendor command,
allowing any board's AP to disable TPM mode if required.
In addition, TPM reset processing flow is being modified to always
reboot the H1 in case TPM reset happens when TPM is disabled.
BUG=b:191180387, b:191180208
TEST=on an Atlas device:
localhost ~ # gsctool -a -f
start
target running protocol version 6
keyids: RO 0xaa66150f, RW 0x334f70df
offsets: backup RO at 0, backup RW at 0x4000
Current versions:
RO 0.0.11
RW 0.6.30
$ localhost ~ # gsctool -a -m disable
TPM Mode: disabled (2)
localhost ~ # gsctool -a -f
start
[WARNING:bus.cc(638)] Bus::SendWithReplyAndBlock took 1516ms to...
Problems reading from TPM, got 10 bytes
Failed to start transfer
localhost ~ # reboot
-- GSC reboots during device rebnoot
localhost ~ # gsctool -a -f
start
target running protocol version 6
keyids: RO 0xaa66150f, RW 0x334f70df
offsets: backup RO at 0, backup RW at 0x4000
Current versions:
RO 0.0.11
RW 0.6.30
localhost ~ # reboot
-- GSC does NOT reboot during device rebnoot
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Change-Id: I492bd2f201f3c5c7d1cd9b228ec6ab1cdcf8fa53
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2987913
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Diffstat (limited to 'board/cr50/board.c')
-rw-r--r-- | board/cr50/board.c | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/board/cr50/board.c b/board/cr50/board.c index 25f226542d..71453e888e 100644 --- a/board/cr50/board.c +++ b/board/cr50/board.c @@ -177,11 +177,6 @@ int board_has_ina_support(void) return !(board_properties & BOARD_NO_INA_SUPPORT); } -int board_tpm_mode_change_allowed(void) -{ - return !!(board_properties & BOARD_ALLOW_CHANGE_TPM_MODE); -} - int board_has_ec_cr50_comm_support(void) { return !!(board_properties & BOARD_EC_CR50_COMM_SUPPORT); @@ -324,8 +319,7 @@ static struct board_cfg board_cfg_table[] = { .strap_cfg = 0x70, .board_properties = BOARD_PERIPH_CONFIG_I2C | BOARD_USE_PLT_RESET | BOARD_WP_DISABLE_DELAY | - BOARD_CLOSED_SOURCE_SET1 | BOARD_NO_INA_SUPPORT | - BOARD_ALLOW_CHANGE_TPM_MODE, + BOARD_CLOSED_SOURCE_SET1 | BOARD_NO_INA_SUPPORT, }, /* Dedede/Puff/Volteer: DIOA9 = 5K PU, DIOA1 = 1M PU */ { @@ -1049,32 +1043,37 @@ static void deferred_tpm_rst_isr(void) { CPRINTS("%s", __func__); - /* - * TPM reset is used to detect the AP, connect AP. Let the AP state - * machine know the AP is on. - */ - set_ap_on(); + if (get_tpm_mode() != TPM_MODE_DISABLED) { - /* - * If no reboot request is posted, OR if the other RW's header is not - * ready to run - do not try rebooting the device, just reset the - * TPM. - * - * The inactive header will have to be restored by the appropriate - * vendor command, the device will be rebooted then. - */ - if (!reboot_request_posted || other_rw_is_inactive()) { - /* Reset TPM, no need to wait for completion. */ - tpm_reset_request(0, 0); - return; - } + /* + * TPM reset is used to detect the AP, connect AP. Let the AP + * state machine know the AP is on. + */ + set_ap_on(); - /* - * Reset TPM and wait to completion to make sure nvmem is - * committed before reboot. - */ - tpm_reset_request(1, 0); + /* + * If no reboot request is posted, OR if the other RW's header + * is not ready to run - do not try rebooting the device, just + * reset the TPM. + * + * The inactive header will have to be restored by the + * appropriate vendor command, the device will be rebooted + * then. + */ + if (!reboot_request_posted || other_rw_is_inactive()) { + /* Reset TPM, no need to wait for completion. */ + tpm_reset_request(0, 0); + return; + } + + /* + * Reset TPM and wait to completion to make sure nvmem is + * committed before reboot. + */ + tpm_reset_request(1, 0); + } + cflush(); /* This will never return. */ system_reset(SYSTEM_RESET_MANUALLY_TRIGGERED | SYSTEM_RESET_HARD); } |