From: Peng Fan <peng....@nxp.com>

The boot image includes Edgelock Enclave(ELE) Firmware. Print the
information out to let user know which version firmware is being used.

Signed-off-by: Peng Fan <peng....@nxp.com>
---
 arch/arm/mach-imx/imx9/soc.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/arch/arm/mach-imx/imx9/soc.c b/arch/arm/mach-imx/imx9/soc.c
index 7bc896b74da..0b791568170 100644
--- a/arch/arm/mach-imx/imx9/soc.c
+++ b/arch/arm/mach-imx/imx9/soc.c
@@ -582,6 +582,39 @@ static int fixup_thermal_trips(void *blob, const char 
*name)
        return 0;
 }
 
+void build_info(void)
+{
+       u32 fw_version, sha1, res, status;
+       int ret;
+
+       printf("\nBuildInfo:\n");
+
+       ret = ele_get_fw_status(&status, &res);
+       if (ret) {
+               printf("  - ELE firmware status failed %d, 0x%x\n", ret, res);
+       } else if ((status & 0xff) == 1) {
+               ret = ele_get_fw_version(&fw_version, &sha1, &res);
+               if (ret) {
+                       printf("  - ELE firmware version failed %d, 0x%x\n", 
ret, res);
+               } else {
+                       printf("  - ELE firmware version %u.%u.%u-%x",
+                              (fw_version & (0x00ff0000)) >> 16,
+                              (fw_version & (0x0000fff0)) >> 4,
+                              (fw_version & (0x0000000f)), sha1);
+                       ((fw_version & (0x80000000)) >> 31) == 1 ? 
puts("-dirty\n") : puts("\n");
+               }
+       } else {
+               printf("  - ELE firmware not included\n");
+       }
+       puts("\n");
+}
+
+int arch_misc_init(void)
+{
+       build_info();
+       return 0;
+}
+
 int ft_system_setup(void *blob, struct bd_info *bd)
 {
        if (fixup_thermal_trips(blob, "cpu-thermal"))

-- 
2.35.3

Reply via email to