summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvano di Ninno <silvano.dininno@nxp.com>2018-11-22 02:39:19 +0100
committerSilvano di Ninno <silvano.dininno@nxp.com>2018-11-26 09:55:22 +0100
commit75902ddf254508287150da3319274369088473e5 (patch)
treefcbd9a1dad7aaa66fc4b1b7927f110b1b480d7a5
parentaf3a8301a1a88a4e66c6f3887ada2ce5c31ef9b8 (diff)
TEE-330-1: OP-TEE: Add support for i.MX 8QM
Reuse Trusty support for OP-TEE Signed-off-by: Silvano di Ninno <silvano.dininno@nxp.com> (cherry picked from commit a558c8fb87171f4ebcc44bb0b8aa699c989a2a7d)
-rw-r--r--plat/imx/imx8qm/imx8qm_bl31_setup.c22
-rw-r--r--plat/imx/imx8qm/include/platform_def.h4
-rw-r--r--plat/imx/imx8qm/platform.mk4
3 files changed, 18 insertions, 12 deletions
diff --git a/plat/imx/imx8qm/imx8qm_bl31_setup.c b/plat/imx/imx8qm/imx8qm_bl31_setup.c
index df1316f3..f0d3cf39 100644
--- a/plat/imx/imx8qm/imx8qm_bl31_setup.c
+++ b/plat/imx/imx8qm/imx8qm_bl31_setup.c
@@ -173,7 +173,7 @@ void mx8_partition_resources(void)
bool owned, owned2;
sc_faddr_t start, end, reg_end;
int i;
-#ifdef SPD_trusty
+#ifdef TEE_IMX8
sc_rm_mr_t mr_tee = 64;
bool mr_tee_atf_same = false;
sc_faddr_t reg_start;
@@ -213,7 +213,7 @@ void mx8_partition_resources(void)
if (BL31_BASE >= start && (BL31_LIMIT - 1) <= end) {
mr_record = mr; /* Record the mr for ATF running */
}
-#ifdef SPD_trusty
+#ifdef TEE_IMX8
else if (BL32_BASE >= start && (BL32_LIMIT -1) <= end) {
mr_tee = mr;
}
@@ -227,7 +227,7 @@ void mx8_partition_resources(void)
}
}
-#ifdef SPD_trusty
+#ifdef TEE_IMX8
if (mr_tee != 64) {
err = sc_rm_get_memreg_info(ipc_handle, mr_tee, &start, &end);
if (err) {
@@ -259,7 +259,7 @@ void mx8_partition_resources(void)
#endif
if (mr_record != 64) {
err = sc_rm_get_memreg_info(ipc_handle, mr_record, &start, &end);
-#ifdef SPD_trusty
+#ifdef TEE_IMX8
if (BL32_BASE >= start && (BL32_LIMIT - 1) <= end)
mr_tee_atf_same = true;
#endif
@@ -268,7 +268,7 @@ void mx8_partition_resources(void)
ERROR("Memreg get info failed, %u\n", mr_record);
} else {
if ((BL31_LIMIT - 1) < end) {
-#ifdef SPD_trusty
+#ifdef TEE_IMX8
if ((end > BL32_BASE) && mr_tee_atf_same)
reg_end = BL32_BASE - 1;
#endif
@@ -281,17 +281,17 @@ void mx8_partition_resources(void)
ERROR("Memreg assign failed, 0x%lx -- 0x%lx\n", (sc_faddr_t)BL31_LIMIT, reg_end);
}
}
-#ifdef SPD_trusty
+#ifdef TEE_IMX8
if (mr_tee_atf_same) {
if ((BL32_LIMIT - 1) < end) {
reg_start = BL32_LIMIT;
err = sc_rm_memreg_alloc(ipc_handle, &mr, reg_start, end);
if (err) {
- ERROR("sc_rm_memreg_alloc failed, 0x%lx -- 0x%lx\n", reg_start, reg_end);
+ ERROR("sc_rm_memreg_alloc failed, 0x%lx -- 0x%lx\n", reg_start, end);
} else {
err = sc_rm_assign_memreg(ipc_handle, os_part, mr);
if (err)
- ERROR("Memreg assign failed, 0x%lx -- 0x%lx\n", reg_start, reg_end);
+ ERROR("Memreg assign failed, 0x%lx -- 0x%lx\n", reg_start, end);
}
}
}
@@ -408,14 +408,16 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
*/
bl33_image_ep_info.pc = PLAT_NS_IMAGE_OFFSET;
bl33_image_ep_info.spsr = get_spsr_for_bl33_entry();
-#ifdef SPD_trusty
+#ifdef TEE_IMX8
SET_PARAM_HEAD(&bl32_image_ep_info, PARAM_EP, VERSION_1, 0);
SET_SECURITY_STATE(bl32_image_ep_info.h.attr, SECURE);
bl32_image_ep_info.pc = BL32_BASE;
bl32_image_ep_info.spsr = 0;
+#ifdef SPD_trusty
bl32_image_ep_info.args.arg0 = BL32_SIZE;
bl32_image_ep_info.args.arg1 = BL32_BASE;
#endif
+#endif
SET_SECURITY_STATE(bl33_image_ep_info.h.attr, NON_SECURE);
/* init the first cluster's cci slave interface */
@@ -443,7 +445,7 @@ void bl31_plat_arch_setup(void)
mmap_add_region(IMX_WUP_IRQSTR, IMX_WUP_IRQSTR, 0x10000,
MT_DEVICE | MT_RW);
-#ifdef SPD_trusty
+#ifdef TEE_IMX8
mmap_add_region(BL32_BASE, BL32_BASE, BL32_SIZE, MT_MEMORY | MT_RW);
#endif
#if USE_COHERENT_MEM
diff --git a/plat/imx/imx8qm/include/platform_def.h b/plat/imx/imx8qm/include/platform_def.h
index 2c599926..bf0494b5 100644
--- a/plat/imx/imx8qm/include/platform_def.h
+++ b/plat/imx/imx8qm/include/platform_def.h
@@ -31,7 +31,7 @@
#define BL31_BASE 0x80000000
#define BL31_LIMIT 0x80020000
-#ifdef SPD_trusty
+#ifdef TEE_IMX8
#define BL32_BASE 0xfe000000
#define BL32_SIZE 0x00200000
#define BL32_LIMIT 0x100000000
@@ -70,7 +70,7 @@
#define SC_CONSOLE 0
#define DEBUG_CONSOLE 0
-#ifdef SPD_trusty
+#ifdef TEE_IMX8
#define DEBUG_CONSOLE_A53 1
#else
#define DEBUG_CONSOLE_A53 0
diff --git a/plat/imx/imx8qm/platform.mk b/plat/imx/imx8qm/platform.mk
index a1fa341c..18ab466f 100644
--- a/plat/imx/imx8qm/platform.mk
+++ b/plat/imx/imx8qm/platform.mk
@@ -73,3 +73,7 @@ ERRATA_A72_859971 := 1
ERRATA_A53_835769 := 1
ERRATA_A53_843419 := 1
ERRATA_A53_855873 := 1
+
+ifneq (${SPD},none)
+$(eval $(call add_define,TEE_IMX8))
+endif