The boot ROM of a few i.MX6 revisions runs its RNG self test
incorrectly and logs an event for it on every boot. An event that reads
HAB_ENG_FAIL on the CAAM and nothing further sends the reader looking
for a fault in their own image, which is not where it is.

Print from where that event comes.

Signed-off-by: Stefan Bigler <[email protected]>
Signed-off-by: Heiko Schocher <[email protected]>
---

 arch/arm/mach-imx/hab.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c
index f92f77670a8..35c497619d6 100644
--- a/arch/arm/mach-imx/hab.c
+++ b/arch/arm/mach-imx/hab.c
@@ -421,6 +421,19 @@ static inline u32 get_idx(u8 *list, u8 tgt, u32 size)
        return idx;
 }
 
+/*
+ * The boot ROM of a few i.MX6 revisions runs the RNG self test
+ * incorrectly and leaves this event behind on every boot. Say so, so
+ * that the reader does not go looking for a fault that is not there.
+ */
+static bool is_rng_self_test_event(struct record *rec)
+{
+       return rec->contents[0] == HAB_WARNING &&
+              rec->contents[1] == HAB_ENG_FAIL &&
+              rec->contents[2] == HAB_CTX_ENTRY &&
+              rec->contents[3] == HAB_ENG_CAAM;
+}
+
 static void process_event_record(uint8_t *event_data, size_t bytes)
 {
        struct record *rec = (struct record *)event_data;
@@ -433,6 +446,9 @@ static void process_event_record(uint8_t *event_data, 
size_t bytes)
               ARRAY_SIZE(hab_contexts))]);
        printf("%s", eng_str[get_idx(hab_engines, rec->contents[3],
               ARRAY_SIZE(hab_engines))]);
+
+       if (is_rng_self_test_event(rec))
+               puts("\nknown to come from the RNG self test of the boot ROM, 
harmless\n");
 }
 
 static void display_event(uint8_t *event_data, size_t bytes)
-- 
2.55.0

Reply via email to