summaryrefslogtreecommitdiff
path: root/plat/imx/imx8mq
diff options
context:
space:
mode:
authorBai Ping <ping.bai@nxp.com>2018-05-11 17:11:39 +0800
committerAbel Vesa <abel.vesa@nxp.com>2018-06-11 10:33:03 +0300
commita15a09e462c9a24e42084e3043aa992c59875d86 (patch)
tree5d9123c5498b872b242e52bd732388b16a39e6d2 /plat/imx/imx8mq
parentc6bfdc70d29981ceef708c36fcb6e0e80891b818 (diff)
plat: imx8m: move hab file to common dir of imx8m
As the i.MX8MM and i.MX8MQ share the same hab file, move it to common/imx8m, make it reusable for all i.MX8M SOCs. Signed-off-by: Bai Ping <ping.bai@nxp.com>
Diffstat (limited to 'plat/imx/imx8mq')
-rw-r--r--plat/imx/imx8mq/hab.c107
-rw-r--r--plat/imx/imx8mq/include/platform_def.h2
-rw-r--r--plat/imx/imx8mq/platform.mk2
3 files changed, 3 insertions, 108 deletions
diff --git a/plat/imx/imx8mq/hab.c b/plat/imx/imx8mq/hab.c
deleted file mode 100644
index be5f81f8..00000000
--- a/plat/imx/imx8mq/hab.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright 2017 NXP
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <debug.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <smcc_helpers.h>
-#include <std_svc.h>
-#include <types.h>
-#include <mmio.h>
-#include <platform_def.h>
-#include <fsl_sip.h>
-#include <soc.h>
-#include <arch_helpers.h>
-
-
-/* Status definitions */
-enum hab_status {
- HAB_STS_ANY = 0x00,
- HAB_FAILURE = 0x33,
- HAB_WARNING = 0x69,
- HAB_SUCCESS = 0xf0
-};
-
-/* Security Configuration definitions */
-enum hab_config {
- HAB_CFG_RETURN = 0x33, /* < Field Return IC */
- HAB_CFG_OPEN = 0xf0, /* < Non-secure IC */
- HAB_CFG_CLOSED = 0xcc /* < Secure IC */
-};
-
-/* State definitions */
-enum hab_state {
- HAB_STATE_INITIAL = 0x33, /* Initialising state (transitory) */
- HAB_STATE_CHECK = 0x55, /* Check state (non-secure) */
- HAB_STATE_NONSECURE = 0x66, /* Non-secure state */
- HAB_STATE_TRUSTED = 0x99, /* Trusted state */
- HAB_STATE_SECURE = 0xaa, /* Secure state */
- HAB_STATE_FAIL_SOFT = 0xcc, /* Soft fail state */
- HAB_STATE_FAIL_HARD = 0xff, /* Hard fail state (terminal) */
- HAB_STATE_NONE = 0xf0, /* No security state machine */
- HAB_STATE_MAX
-};
-
-typedef enum hab_status hab_rvt_report_event_t(enum hab_status, uint32_t,
- uint8_t* , size_t*);
-typedef enum hab_status hab_rvt_report_status_t(enum hab_config *,
- enum hab_state *);
-typedef enum hab_status hab_loader_callback_f_t(void**, size_t*, const void*);
-typedef enum hab_status hab_rvt_entry_t(void);
-typedef enum hab_status hab_rvt_exit_t(void);
-typedef void *hab_rvt_authenticate_image_t(uint8_t, long,
- void **, size_t *, hab_loader_callback_f_t);
-
-#define HAB_RVT_BASE 0x00000880 /* HAB_RVT for i.MX8MQ */
-
-#define HAB_RVT_ENTRY_ARM64 ((unsigned long)*(uint32_t *)(HAB_RVT_BASE + 0x08))
-#define HAB_RVT_EXIT_ARM64 ((unsigned long)*(uint32_t *)(HAB_RVT_BASE + 0x10))
-#define HAB_RVT_AUTHENTICATE_IMAGE_ARM64 ((unsigned long)*(uint32_t *)(HAB_RVT_BASE + 0x20))
-#define HAB_RVT_REPORT_EVENT_ARM64 ((unsigned long)*(uint32_t *)(HAB_RVT_BASE + 0x40))
-#define HAB_RVT_REPORT_STATUS_ARM64 ((unsigned long)*(uint32_t *)(HAB_RVT_BASE + 0x48))
-
-#define hab_rvt_authenticate_image_p ((hab_rvt_authenticate_image_t *)HAB_RVT_AUTHENTICATE_IMAGE_ARM64)
-#define hab_rvt_entry_p ((hab_rvt_entry_t *)HAB_RVT_ENTRY_ARM64)
-#define hab_rvt_exit_p ((hab_rvt_exit_t *)HAB_RVT_EXIT_ARM64)
-#define hab_rvt_report_event_p ((hab_rvt_report_event_t *)HAB_RVT_REPORT_EVENT_ARM64)
-#define hab_rvt_report_status_p ((hab_rvt_report_status_t *)HAB_RVT_REPORT_STATUS_ARM64)
-
-#define HAB_CID_ATF 2 /**< ATF Caller ID*/
-
-int imx_hab_handler(uint32_t smc_fid, u_register_t x1, u_register_t x2,
- u_register_t x3, u_register_t x4)
-{
- hab_rvt_authenticate_image_t *hab_rvt_authenticate_image;
- hab_rvt_entry_t *hab_rvt_entry;
- hab_rvt_exit_t *hab_rvt_exit;
- hab_rvt_report_event_t *hab_rvt_report_event;
- hab_rvt_report_status_t *hab_rvt_report_status;
-
- switch(x1) {
- case FSL_SIP_HAB_AUTHENTICATE:
- hab_rvt_authenticate_image = hab_rvt_authenticate_image_p;
- return (unsigned long)hab_rvt_authenticate_image(HAB_CID_ATF, x2, (void **)x3, (size_t *)x4, NULL);
- case FSL_SIP_HAB_ENTRY:
- hab_rvt_entry = hab_rvt_entry_p;
- return hab_rvt_entry();
- case FSL_SIP_HAB_EXIT:
- hab_rvt_exit = hab_rvt_exit_p;
- return hab_rvt_exit();
- case FSL_SIP_HAB_REPORT_EVENT:
- hab_rvt_report_event = hab_rvt_report_event_p;
- return hab_rvt_report_event(HAB_FAILURE, (uint32_t)x2, (uint8_t *)x3, (size_t *)x4);
- case FSL_SIP_HAB_REPORT_STATUS:
- hab_rvt_report_status = hab_rvt_report_status_p;
- return hab_rvt_report_status((enum hab_config *)x2, (enum hab_state *)x3);
- default:
- return SMC_UNK;
-
- };
-
- return 0;
-}
-
diff --git a/plat/imx/imx8mq/include/platform_def.h b/plat/imx/imx8mq/include/platform_def.h
index 117e9015..7f3a2c82 100644
--- a/plat/imx/imx8mq/include/platform_def.h
+++ b/plat/imx/imx8mq/include/platform_def.h
@@ -40,6 +40,8 @@
#define MAX_XLAT_TABLES 4
#define MAX_MMAP_REGIONS 14
+#define HAB_RVT_BASE 0x00000880 /* HAB_RVT for i.MX8MQ */
+
#define IMX_BOOT_UART_BASE 0x30860000
#define IMX_BOOT_UART_CLK_IN_HZ 25000000 /* Select 25Mhz oscillator */
#define PLAT_CRASH_UART_BASE IMX_BOOT_UART_BASE
diff --git a/plat/imx/imx8mq/platform.mk b/plat/imx/imx8mq/platform.mk
index 936f5348..4065e452 100644
--- a/plat/imx/imx8mq/platform.mk
+++ b/plat/imx/imx8mq/platform.mk
@@ -18,7 +18,7 @@ BL31_SOURCES += plat/imx/common/imx8_helpers.S \
plat/imx/common/sip_svc.c \
plat/imx/imx8mq/imx8mq_bl31_setup.c \
plat/imx/imx8mq/src.c \
- plat/imx/imx8mq/hab.c \
+ plat/imx/common/imx8m/hab.c \
plat/imx/imx8mq/gpc.c \
plat/imx/imx8mq/imx8mq_psci.c \
plat/imx/imx8mq/imx_csu.c \