]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
arm: imx: hab: Define HAB_RVT_BASE according to the processor version
authorBreno Lima <breno.lima@nxp.com>
Tue, 20 Feb 2018 01:19:26 +0000 (01:19 +0000)
committerStefano Babic <sbabic@denx.de>
Thu, 22 Feb 2018 13:36:06 +0000 (14:36 +0100)
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 <breno.lima@nxp.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
arch/arm/include/asm/mach-imx/hab.h
arch/arm/mach-imx/hab.c

index 93475a61da9cdcf59b514ce23ba703df5ae70e07..561de9c6f707163a052bdd30c4b831bc8aff3017 100644 (file)
@@ -168,7 +168,14 @@ typedef void hapi_clock_init_t(void);
 #ifdef CONFIG_ROM_UNIFIED_SECTIONS
 #define HAB_RVT_BASE                   0x00000100
 #else
 #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))
 #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_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*/
 
 #define HAB_CID_ROM 0 /**< ROM Caller ID */
 #define HAB_CID_UBOOT 1 /**< UBOOT Caller ID*/
 
index 79e8bf697973b78d0c9a2e7d18cbc97c4834f075..c3fc699d023998002b46d2bcc9943e33c1a7a884 100644 (file)
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-imx/hab.h>
 
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-imx/hab.h>
 
-/* -------- 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
 #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_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");
 
        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;
        }
 
                return 1;
        }
 
-       hab_rvt_failsafe = hab_rvt_failsafe_p;
+       hab_rvt_failsafe = (hab_rvt_failsafe_t *)HAB_RVT_FAILSAFE;
        hab_rvt_failsafe();
 
        return 0;
        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;
 
        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");
 
        if (!imx_hab_is_enabled()) {
                puts("hab fuse not enabled\n");