diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2019-06-04 09:01:42 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-06-05 22:41:09 +0000 |
commit | 5188d521f467f1933e925a4e45db770b8a75edaa (patch) | |
tree | 35a4b62b8cdada4df7d0d289e0c42ce145c72259 /common/tpm_registers.c | |
parent | d76c396bf65e912c2aa2ca1e905daa74996cdb27 (diff) | |
download | chrome-ec-5188d521f467f1933e925a4e45db770b8a75edaa.tar.gz |
tpm: reset command_ready bit when entering idle state
TPM could enter idle state even when current command has not yet been
fully processed (for instance if the AP releases locality at an
arbitrary moment).
The status register command_ready bit needs to be unconditionally
reset when TPM enters idle state.
BRANCH=cr50, cr50-mp
BUG=none
TEST=verified reliable behavior during lengthy concurrent runs of
processes accessing TPM. The same type of testing was causing
occasional TPM lockups before this fix.
Change-Id: I6e1dc334713c666e4ef566d41bd0cbff841f1179
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1643828
Reviewed-by: Andrey Pronin <apronin@chromium.org>
Diffstat (limited to 'common/tpm_registers.c')
-rw-r--r-- | common/tpm_registers.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/common/tpm_registers.c b/common/tpm_registers.c index 6a0e7e6ac7..62aa4ce23e 100644 --- a/common/tpm_registers.c +++ b/common/tpm_registers.c @@ -187,9 +187,12 @@ static void set_tpm_state(enum tpm_states state) /* Make sure FIFO is empty. */ tpm_.fifo_read_index = 0; tpm_.fifo_write_index = 0; - tpm_.regs.sts &= ~data_avail; - /* Set burst size for the following write requests. */ - tpm_.regs.sts &= ~(burst_count_mask << burst_count_shift); + /* + * Set proper fields of the status register: FIFO depth 63, + * not ready, no data available. + */ + tpm_.regs.sts &= ~((burst_count_mask << burst_count_shift) | + command_ready | data_avail); tpm_.regs.sts |= 63 << burst_count_shift; } } @@ -283,7 +286,6 @@ static void sts_reg_write_cr(void) case tpm_state_executing_cmd: case tpm_state_receiving_cmd: set_tpm_state(tpm_state_idle); - tpm_.regs.sts &= ~command_ready; break; } } |