summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2019-07-29 17:19:47 -0700
committerCommit Bot <commit-bot@chromium.org>2021-02-25 16:57:48 +0000
commita394204886987f2bb031dc45e9371b5de4c2e371 (patch)
treecf1d99ba04f65461b7416a2152a0bb18cb81c259
parent59c76a03669cad7a3cfc3c03feba5ea1d02f1347 (diff)
downloadchrome-ec-a394204886987f2bb031dc45e9371b5de4c2e371.tar.gz
g: add flash log entry for dcrypto failures
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> (cherry picked from commit a7f759a384ca2e1ff0daf559949a40d45aa76863) Change-Id: I415193c8436b8cb50a2e697c49741834c4db3c65 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2510895 Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org> Commit-Queue: Mary Ruthven <mruthven@chromium.org> (cherry picked from commit f1b2d893b4fb5d3d039944fc2864d41abd10d468) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2718417
-rw-r--r--chip/g/dcrypto/dcrypto_runtime.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/chip/g/dcrypto/dcrypto_runtime.c b/chip/g/dcrypto/dcrypto_runtime.c
index 129ebe5a76..0fc46099ed 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;
}
}