From: Breno Lima Date: Tue, 20 Feb 2018 01:19:26 +0000 (+0000) Subject: arm: imx: hab: Define HAB_RVT_BASE according to the processor version X-Git-Tag: v2018.03-rc4~28^2~5 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7b889baf29c3c891a26eea0eeb3769263af80476;p=u-boot arm: imx: hab: Define HAB_RVT_BASE according to the processor version Currently the following devices are using a different definition for ROM Vector Table addresses: - i.MX6DQP = All rev - i.MX6DQ >= rev 1.5 - i.MX6SDL >= rev 1.2 There is no need to create a new RVT macros since the only update were the RVT base address. Remove HAB_RVT_*_NEW macros and define a new RVT base address. More details about RVT base address can be found on processors Reference Manual and in the following documents: EB803: i.MX 6Dual/6Quad Applications Processor Silicon Revision 1.2 to 1.3 Comparison EB804: i.MX 6Solo/6DualLite Application Processor Silicon Revision 1.1 to 1.2/1.3 Comparison Signed-off-by: Breno Lima Reviewed-by: Fabio Estevam --- diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h index 93475a61da..561de9c6f7 100644 --- a/arch/arm/include/asm/mach-imx/hab.h +++ b/arch/arm/include/asm/mach-imx/hab.h @@ -168,7 +168,14 @@ typedef void hapi_clock_init_t(void); #ifdef CONFIG_ROM_UNIFIED_SECTIONS #define HAB_RVT_BASE 0x00000100 #else -#define HAB_RVT_BASE 0x00000094 +#define HAB_RVT_BASE_NEW 0x00000098 +#define HAB_RVT_BASE_OLD 0x00000094 +#define HAB_RVT_BASE ((is_mx6dqp()) ? \ + HAB_RVT_BASE_NEW : \ + (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ? \ + HAB_RVT_BASE_NEW : \ + (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ? \ + HAB_RVT_BASE_NEW : HAB_RVT_BASE_OLD) #endif #define HAB_RVT_ENTRY (*(uint32_t *)(HAB_RVT_BASE + 0x04)) @@ -179,12 +186,6 @@ typedef void hapi_clock_init_t(void); #define HAB_RVT_REPORT_STATUS (*(uint32_t *)(HAB_RVT_BASE + 0x24)) #define HAB_RVT_FAILSAFE (*(uint32_t *)(HAB_RVT_BASE + 0x28)) -#define HAB_RVT_REPORT_EVENT_NEW (*(uint32_t *)0x000000B8) -#define HAB_RVT_REPORT_STATUS_NEW (*(uint32_t *)0x000000BC) -#define HAB_RVT_AUTHENTICATE_IMAGE_NEW (*(uint32_t *)0x000000A8) -#define HAB_RVT_ENTRY_NEW (*(uint32_t *)0x0000009C) -#define HAB_RVT_EXIT_NEW (*(uint32_t *)0x000000A0) - #define HAB_CID_ROM 0 /**< ROM Caller ID */ #define HAB_CID_UBOOT 1 /**< UBOOT Caller ID*/ diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 79e8bf6979..c3fc699d02 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -13,96 +13,6 @@ #include #include -/* -------- start of HAB API updates ------------*/ - -#define hab_rvt_report_event_p \ -( \ - (is_mx6dqp()) ? \ - ((hab_rvt_report_event_t *)HAB_RVT_REPORT_EVENT_NEW) : \ - (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ? \ - ((hab_rvt_report_event_t *)HAB_RVT_REPORT_EVENT_NEW) : \ - (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ? \ - ((hab_rvt_report_event_t *)HAB_RVT_REPORT_EVENT_NEW) : \ - ((hab_rvt_report_event_t *)HAB_RVT_REPORT_EVENT) \ -) - -#define hab_rvt_report_status_p \ -( \ - (is_mx6dqp()) ? \ - ((hab_rvt_report_status_t *)HAB_RVT_REPORT_STATUS_NEW) :\ - (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ? \ - ((hab_rvt_report_status_t *)HAB_RVT_REPORT_STATUS_NEW) :\ - (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ? \ - ((hab_rvt_report_status_t *)HAB_RVT_REPORT_STATUS_NEW) :\ - ((hab_rvt_report_status_t *)HAB_RVT_REPORT_STATUS) \ -) - -#define hab_rvt_authenticate_image_p \ -( \ - (is_mx6dqp()) ? \ - ((hab_rvt_authenticate_image_t *)HAB_RVT_AUTHENTICATE_IMAGE_NEW) : \ - (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ? \ - ((hab_rvt_authenticate_image_t *)HAB_RVT_AUTHENTICATE_IMAGE_NEW) : \ - (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ? \ - ((hab_rvt_authenticate_image_t *)HAB_RVT_AUTHENTICATE_IMAGE_NEW) : \ - ((hab_rvt_authenticate_image_t *)HAB_RVT_AUTHENTICATE_IMAGE) \ -) - -#define hab_rvt_entry_p \ -( \ - (is_mx6dqp()) ? \ - ((hab_rvt_entry_t *)HAB_RVT_ENTRY_NEW) : \ - (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ? \ - ((hab_rvt_entry_t *)HAB_RVT_ENTRY_NEW) : \ - (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ? \ - ((hab_rvt_entry_t *)HAB_RVT_ENTRY_NEW) : \ - ((hab_rvt_entry_t *)HAB_RVT_ENTRY) \ -) - -#define hab_rvt_exit_p \ -( \ - (is_mx6dqp()) ? \ - ((hab_rvt_exit_t *)HAB_RVT_EXIT_NEW) : \ - (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ? \ - ((hab_rvt_exit_t *)HAB_RVT_EXIT_NEW) : \ - (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ? \ - ((hab_rvt_exit_t *)HAB_RVT_EXIT_NEW) : \ - ((hab_rvt_exit_t *)HAB_RVT_EXIT) \ -) - -static inline void hab_rvt_failsafe_new(void) -{ -} - -#define hab_rvt_failsafe_p \ -( \ - (is_mx6dqp()) ? \ - ((hab_rvt_failsafe_t *)hab_rvt_failsafe_new) : \ - (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ? \ - ((hab_rvt_failsafe_t *)hab_rvt_failsafe_new) : \ - (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ? \ - ((hab_rvt_failsafe_t *)hab_rvt_failsafe_new) : \ - ((hab_rvt_failsafe_t *)HAB_RVT_FAILSAFE) \ -) - -static inline enum hab_status hab_rvt_check_target_new(enum hab_target target, - const void *start, - size_t bytes) -{ - return HAB_SUCCESS; -} - -#define hab_rvt_check_target_p \ -( \ - (is_mx6dqp()) ? \ - ((hab_rvt_check_target_t *)hab_rvt_check_target_new) : \ - (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ? \ - ((hab_rvt_check_target_t *)hab_rvt_check_target_new) : \ - (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ? \ - ((hab_rvt_check_target_t *)hab_rvt_check_target_new) : \ - ((hab_rvt_check_target_t *)HAB_RVT_CHECK_TARGET) \ -) - #define ALIGN_SIZE 0x1000 #define MX6DQ_PU_IROM_MMU_EN_VAR 0x009024a8 #define MX6DLS_PU_IROM_MMU_EN_VAR 0x00901dd0 @@ -344,8 +254,9 @@ static int get_hab_status(void) hab_rvt_report_event_t *hab_rvt_report_event; hab_rvt_report_status_t *hab_rvt_report_status; - hab_rvt_report_event = hab_rvt_report_event_p; - hab_rvt_report_status = hab_rvt_report_status_p; + hab_rvt_report_event = (hab_rvt_report_event_t *)HAB_RVT_REPORT_EVENT; + hab_rvt_report_status = + (hab_rvt_report_status_t *)HAB_RVT_REPORT_STATUS; if (imx_hab_is_enabled()) puts("\nSecure boot enabled\n"); @@ -424,7 +335,7 @@ static int do_hab_failsafe(cmd_tbl_t *cmdtp, int flag, int argc, return 1; } - hab_rvt_failsafe = hab_rvt_failsafe_p; + hab_rvt_failsafe = (hab_rvt_failsafe_t *)HAB_RVT_FAILSAFE; hab_rvt_failsafe(); return 0; @@ -582,10 +493,11 @@ int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size, struct ivt_header *ivt_hdr; enum hab_status status; - hab_rvt_authenticate_image = hab_rvt_authenticate_image_p; - hab_rvt_entry = hab_rvt_entry_p; - hab_rvt_exit = hab_rvt_exit_p; - hab_rvt_check_target = hab_rvt_check_target_p; + hab_rvt_authenticate_image = + (hab_rvt_authenticate_image_t *)HAB_RVT_AUTHENTICATE_IMAGE; + hab_rvt_entry = (hab_rvt_entry_t *)HAB_RVT_ENTRY; + hab_rvt_exit = (hab_rvt_exit_t *)HAB_RVT_EXIT; + hab_rvt_check_target = (hab_rvt_check_target_t *)HAB_RVT_CHECK_TARGET; if (!imx_hab_is_enabled()) { puts("hab fuse not enabled\n");