[PATCH 06/26] i.MX: HABv4: retrieve HAB ROM version for i.MX8M

Marco Felsch m.felsch at pengutronix.de
Tue Oct 10 07:32:54 PDT 2023


From: Rouven Czerwinski <r.czerwinski at pengutronix.de>

The HAB userguide mentions this additional API calls introduced in 2018
(which coincides with the introduction of i.MX8M SoCs).
Call this API call unconditionally on i.MX8M SoCs to print the HAB
version the ROM code supports.

Signed-off-by: Rouven Czerwinski <r.czerwinski at pengutronix.de>
---
 drivers/hab/habv4.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/hab/habv4.c b/drivers/hab/habv4.c
index 0238b98dfb7e..f74de009fce0 100644
--- a/drivers/hab/habv4.c
+++ b/drivers/hab/habv4.c
@@ -168,6 +168,7 @@ struct habv4_rvt {
 #define FSL_SIP_HAB_REPORT_STATUS       0x04
 #define FSL_SIP_HAB_FAILSAFE            0x05
 #define FSL_SIP_HAB_CHECK_TARGET        0x06
+#define FSL_SIP_HAB_GET_VERSION		0x07
 
 static enum hab_status hab_sip_report_status(enum hab_config *config,
 					     enum habv4_state *state)
@@ -193,6 +194,15 @@ static enum hab_status hab_sip_report_status(enum hab_config *config,
 	return (enum hab_status)res.a0;
 }
 
+static uint32_t hab_sip_get_version(void)
+{
+	struct arm_smccc_res res;
+
+	arm_smccc_smc(FSL_SIP_HAB, FSL_SIP_HAB_GET_VERSION, 0, 0, 0, 0, 0, 0, &res);
+
+	return (uint32_t)res.a0;
+}
+
 #define IMX8MQ_ROM_OCRAM_ADDRESS	0x9061C0
 #define IMX8MM_ROM_OCRAM_ADDRESS	0x908040
 #define IMX8MN_ROM_OCRAM_ADDRESS	0x908040
@@ -610,6 +620,8 @@ static int init_imx8m_hab_get_status(void)
 		/* can happen in multi-image builds and is not an error */
 		return 0;
 
+	pr_info("ROM version: 0x%x\n", hab_sip_get_version());
+
 	/*
 	 * Nobody will check the return value if there were HAB errors, but the
 	 * initcall will fail spectaculously with a strange error message.
-- 
2.39.2




More information about the barebox mailing list