* [U-Boot] [PATCH] imx :hab: Add hab version command
@ 2019-06-18 21:08 Sjoerd Simons
2019-10-14 12:40 ` sbabic at denx.de
0 siblings, 1 reply; 2+ messages in thread
From: Sjoerd Simons @ 2019-06-18 21:08 UTC (permalink / raw)
To: u-boot
THe RVT data includes a major and minor version in its header
parameter. Add a new command to print this out.
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
---
Unfortunately there doesn't seem to be a way to get the minor version of
the hab ROM. While there is a get_version function pointer in the vector
table it's documented to only be valid during the ROM phase and a quick
hack to try and call it on my board always returned 1 :/.
arch/arm/include/asm/mach-imx/hab.h | 1 +
arch/arm/mach-imx/hab.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h
index 95df88423c..5c82a148b4 100644
--- a/arch/arm/include/asm/mach-imx/hab.h
+++ b/arch/arm/include/asm/mach-imx/hab.h
@@ -189,6 +189,7 @@ typedef void hapi_clock_init_t(void);
#define HAB_CID_ROM 0 /**< ROM Caller ID */
#define HAB_CID_UBOOT 1 /**< UBOOT Caller ID*/
+#define HAB_TAG_RVT 0xDD /* ROM Vector Table */
#define HAB_CMD_HDR 0xD4 /* CSF Header */
#define HAB_CMD_WRT_DAT 0xCC /* Write Data command tag */
#define HAB_CMD_CHK_DAT 0xCF /* Check Data command tag */
diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c
index d42a15e877..e8487932c0 100644
--- a/arch/arm/mach-imx/hab.c
+++ b/arch/arm/mach-imx/hab.c
@@ -365,6 +365,21 @@ static int do_hab_failsafe(cmd_tbl_t *cmdtp, int flag, int argc,
return 0;
}
+static int do_hab_version(cmd_tbl_t *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+ struct hab_hdr *hdr = (struct hab_hdr *)HAB_RVT_BASE;
+
+ if (hdr->tag != HAB_TAG_RVT) {
+ printf("Unexpected header tag: %x\n", hdr->tag);
+ return CMD_RET_FAILURE;
+ }
+
+ printf("HAB version: %d.%d\n", hdr->par >> 4, hdr->par & 0xf);
+
+ return 0;
+}
+
static int do_authenticate_image_or_failover(cmd_tbl_t *cmdtp, int flag,
int argc, char * const argv[])
{
@@ -421,6 +436,12 @@ U_BOOT_CMD(
"ivt_offset - hex offset of IVT in the image"
);
+U_BOOT_CMD(
+ hab_version, 1, 0, do_hab_version,
+ "print HAB major/minor version",
+ ""
+ );
+
#endif /* !defined(CONFIG_SPL_BUILD) */
/* Get CSF Header length */
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] imx :hab: Add hab version command
2019-06-18 21:08 [U-Boot] [PATCH] imx :hab: Add hab version command Sjoerd Simons
@ 2019-10-14 12:40 ` sbabic at denx.de
0 siblings, 0 replies; 2+ messages in thread
From: sbabic at denx.de @ 2019-10-14 12:40 UTC (permalink / raw)
To: u-boot
> THe RVT data includes a major and minor version in its header
> parameter. Add a new command to print this out.
> Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-14 12:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-18 21:08 [U-Boot] [PATCH] imx :hab: Add hab version command Sjoerd Simons
2019-10-14 12:40 ` sbabic at denx.de
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.