From fd6f05fca036bf309a4f2546bbb448024c4597de Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Tue, 17 Oct 2023 16:51:08 +0200 Subject: i.MX: HABv4: retrieve HAB ROM version for i.MX8M 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 Link: https://lore.barebox.org/20231017145131.3069283-7-m.felsch@pengutronix.de Signed-off-by: Sascha Hauer --- drivers/hab/habv4.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/hab/habv4.c b/drivers/hab/habv4.c index 0238b98dfb..f74de009fc 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. -- cgit v1.2.3