diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2019-07-29 17:19:47 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-07-31 19:19:15 +0000 |
commit | a7f759a384ca2e1ff0daf559949a40d45aa76863 (patch) | |
tree | 53f7f436773b6416a58050779d31e0f2ed47b9cd /chip/g/dcrypto/dcrypto_runtime.c | |
parent | 74340f2dbe5ededa6cd466d32a727c7df977b956 (diff) | |
download | chrome-ec-stabilize-12386.B.tar.gz |
g: add flash log entry for dcrypto failuresstabilize-12386.B
We want to keep an eye on the dcrypto failures (which are never
supposed to happen of course). Let's add logging a flash event so that
the failures are visible through UMA.
BRANCH=cr50, cr50-mp
BUG=b:135772657
TEST=using additional code simulated a single failure, observed new
flash log entry by running 'gsctool -a -L' on the DUT.
Change-Id: Ib675bb1928166cadc069bf4be3b053a9cf837077
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1723097
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Diffstat (limited to 'chip/g/dcrypto/dcrypto_runtime.c')
-rw-r--r-- | chip/g/dcrypto/dcrypto_runtime.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/chip/g/dcrypto/dcrypto_runtime.c b/chip/g/dcrypto/dcrypto_runtime.c index 3f2efb54be..b20f561393 100644 --- a/chip/g/dcrypto/dcrypto_runtime.c +++ b/chip/g/dcrypto/dcrypto_runtime.c @@ -2,10 +2,11 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -#include "internal.h" -#include "task.h" +#include "flash_log.h" +#include "internal.h" #include "registers.h" +#include "task.h" #define DMEM_NUM_WORDS 1024 #define IMEM_NUM_WORDS 1024 @@ -95,6 +96,7 @@ void dcrypto_unlock(void) uint32_t dcrypto_call(uint32_t adr) { uint32_t event; + uint32_t state = 0; do { /* Reset all the status bits. */ @@ -114,13 +116,19 @@ uint32_t dcrypto_call(uint32_t adr) * all other bits are indicative of error. * Except for MOD_OPERAND_OUT_OF_RANGE, which is noise. */ - if ((GREG32(CRYPTO, INT_STATE) & - ~(GC_CRYPTO_INT_STATE_MOD_OPERAND_OUT_OF_RANGE_MASK | - GC_CRYPTO_INT_STATE_HOST_CMD_RECV_MASK)) == 0) + state = GREG32(CRYPTO, INT_STATE); + if ((state & + ~(GC_CRYPTO_INT_STATE_MOD_OPERAND_OUT_OF_RANGE_MASK | + GC_CRYPTO_INT_STATE_HOST_CMD_RECV_MASK)) == 0) return 0; /* fall through */ default: dcrypto_reset_and_wipe(); +#ifdef CONFIG_FLASH_LOG + /* State value of zero indicates event timeout. */ + flash_log_add_event(FE_LOG_DCRYPTO_FAILURE, + sizeof(state), &state); +#endif return 1; } } |