From 2d442a017eee0d3bed69bd3014f158895bfadfda Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Mon, 30 Oct 2017 14:34:07 +0800 Subject: [PATCH] MLK-16728 imx8mq: evk: reserve the tee space when tee enabled rom_pointer[0] contains the base, rom_pointer[1] contains the size. When TEE enabled, if not reserve the space, uboot relocation may overwrite TEE or trigger fault when TZASC enabled. Signed-off-by: Peng Fan Reviewed-by: Ye Li --- arch/arm/cpu/armv8/imx8m/Makefile | 2 -- arch/arm/include/asm/arch-imx8m/sys_proto.h | 1 + board/freescale/imx8mq_evk/imx8m_evk.c | 6 +++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/arm/cpu/armv8/imx8m/Makefile b/arch/arm/cpu/armv8/imx8m/Makefile index 0ae895ced1..ed90ebd4ff 100644 --- a/arch/arm/cpu/armv8/imx8m/Makefile +++ b/arch/arm/cpu/armv8/imx8m/Makefile @@ -4,7 +4,5 @@ # SPDX-License-Identifier: GPL-2.0+ # -ifdef CONFIG_SPL_BUILD obj-y += lowlevel_init.o -endif obj-y += clock.o clock_slice.o soc.o diff --git a/arch/arm/include/asm/arch-imx8m/sys_proto.h b/arch/arm/include/asm/arch-imx8m/sys_proto.h index cbe867a820..1adeeefe9e 100644 --- a/arch/arm/include/asm/arch-imx8m/sys_proto.h +++ b/arch/arm/include/asm/arch-imx8m/sys_proto.h @@ -9,3 +9,4 @@ void set_wdog_reset(struct wdog_regs *wdog); void enable_tzc380(void); void restore_boot_params(void); +extern unsigned long rom_pointer[]; diff --git a/board/freescale/imx8mq_evk/imx8m_evk.c b/board/freescale/imx8mq_evk/imx8m_evk.c index 525d0486c6..ab329f1770 100644 --- a/board/freescale/imx8mq_evk/imx8m_evk.c +++ b/board/freescale/imx8mq_evk/imx8m_evk.c @@ -82,7 +82,11 @@ int board_postclk_init(void) int dram_init(void) { - gd->ram_size = PHYS_SDRAM_SIZE; + /* rom_pointer[1] contains the size of TEE occupies */ + if (rom_pointer[1]) + gd->ram_size = PHYS_SDRAM_SIZE - rom_pointer[1]; + else + gd->ram_size = PHYS_SDRAM_SIZE; return 0; } -- 2.17.1