From 5b8d50e40701ebb6a7ba548ccaa96ba879587fb9 Mon Sep 17 00:00:00 2001 From: Sathees Balya Date: Thu, 15 Nov 2018 14:22:30 +0000 Subject: plat/arm: Save BL2 descriptors to reserved memory. On ARM platforms, the BL2 memory can be overlaid by BL31/BL32. The memory descriptors describing the list of executable images are created in BL2 R/W memory, which could be possibly corrupted later on by BL31/BL32 due to overlay. This patch creates a reserved location in SRAM for these descriptors and are copied over by BL2 before handing over to next BL image. Also this patch increases the PLAT_ARM_MAX_BL2_SIZE for juno when TBBR is enabled. Fixes ARM-Software/tf-issues#626 Change-Id: I755735706fa702024b4032f51ed4895b3687377f Signed-off-by: Sathees Balya --- common/desc_image_load.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'common') diff --git a/common/desc_image_load.c b/common/desc_image_load.c index ada02f8d..405bb834 100644 --- a/common/desc_image_load.c +++ b/common/desc_image_load.c @@ -20,11 +20,28 @@ static bl_params_t next_bl_params; ******************************************************************************/ void flush_bl_params_desc(void) { - flush_dcache_range((uintptr_t)bl_mem_params_desc_ptr, - sizeof(*bl_mem_params_desc_ptr) * bl_mem_params_desc_num); + flush_bl_params_desc_args(bl_mem_params_desc_ptr, + bl_mem_params_desc_num, + &next_bl_params); +} + +/******************************************************************************* + * This function flushes the data structures specified as arguments so that they + * are visible in memory for the next BL image. + ******************************************************************************/ +void flush_bl_params_desc_args(bl_mem_params_node_t *mem_params_desc_ptr, + unsigned int mem_params_desc_num, + bl_params_t *next_bl_params_ptr) +{ + assert(mem_params_desc_ptr != NULL); + assert(mem_params_desc_num != 0U); + assert(next_bl_params_ptr != NULL); + + flush_dcache_range((uintptr_t)mem_params_desc_ptr, + sizeof(*mem_params_desc_ptr) * mem_params_desc_num); - flush_dcache_range((uintptr_t)&next_bl_params, - sizeof(next_bl_params)); + flush_dcache_range((uintptr_t)next_bl_params_ptr, + sizeof(*next_bl_params_ptr)); } /******************************************************************************* -- cgit v1.2.3