summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2019-06-18 23:08:59 +0200
committerStefano Babic <sbabic@denx.de>2019-10-14 09:31:41 +0200
commitb4eca2d787b09509e6a5a0f597e91bcb00558b4d (patch)
tree10c08d502ef36f9c0644514baa4c5761541536d0 /arch
parent5fba75373b6118a2e7f75740bd7374b534d722c7 (diff)
downloadu-boot-b4eca2d787b09509e6a5a0f597e91bcb00558b4d.tar.gz
u-boot-b4eca2d787b09509e6a5a0f597e91bcb00558b4d.tar.xz
u-boot-b4eca2d787b09509e6a5a0f597e91bcb00558b4d.zip
imx :hab: Add hab version command
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/mach-imx/hab.h1
-rw-r--r--arch/arm/mach-imx/hab.c21
2 files changed, 22 insertions, 0 deletions
diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h
index b905d84bdc..d8bd77075a 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 ce50dbe907..30db820b56 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 */