mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-08-15 08:57:02 +02:00
Previously mem_protect used to be only supported from BL2. This is not helpful in the case when ARM TF-A BL2 is not used. This patch demonstrates mem_protect from el3_runtime firmware on ARM Platforms specifically when RESET_TO_BL31 or RESET_TO_SP_MIN flag is set as BL2 may be absent in these cases. The Non secure DRAM is dynamically mapped into EL3 mmap tables temporarily and then the protected regions are then cleared. This avoids the need to map the non secure DRAM permanently to BL31/sp_min. The stack size is also increased, because DYNAMIC_XLAT_TABLES require a bigger stack. Change-Id: Ia44c594192ed5c5adc596c0cff2c7cc18c001fde Signed-off-by: Roberto Vargas <roberto.vargas@arm.com>
88 lines
1.6 KiB
C
88 lines
1.6 KiB
C
/*
|
|
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
#include <arm_def.h>
|
|
#include <plat_arm.h>
|
|
|
|
/*
|
|
* Table of memory regions for different BL stages to map using the MMU.
|
|
* This doesn't include Trusted SRAM as arm_setup_page_tables() already
|
|
* takes care of mapping it.
|
|
*/
|
|
#ifdef IMAGE_BL1
|
|
const mmap_region_t plat_arm_mmap[] = {
|
|
ARM_MAP_SHARED_RAM,
|
|
V2M_MAP_FLASH0_RW,
|
|
V2M_MAP_IOFPGA,
|
|
CSS_MAP_DEVICE,
|
|
SOC_CSS_MAP_DEVICE,
|
|
#if TRUSTED_BOARD_BOOT
|
|
/* Map DRAM to authenticate NS_BL2U image. */
|
|
ARM_MAP_NS_DRAM1,
|
|
#endif
|
|
{0}
|
|
};
|
|
#endif
|
|
#ifdef IMAGE_BL2
|
|
const mmap_region_t plat_arm_mmap[] = {
|
|
ARM_MAP_SHARED_RAM,
|
|
V2M_MAP_FLASH0_RW,
|
|
#ifdef PLAT_ARM_MEM_PROT_ADDR
|
|
ARM_V2M_MAP_MEM_PROTECT,
|
|
#endif
|
|
V2M_MAP_IOFPGA,
|
|
CSS_MAP_DEVICE,
|
|
SOC_CSS_MAP_DEVICE,
|
|
ARM_MAP_NS_DRAM1,
|
|
#ifdef AARCH64
|
|
ARM_MAP_DRAM2,
|
|
#endif
|
|
#ifdef SPD_tspd
|
|
ARM_MAP_TSP_SEC_MEM,
|
|
#endif
|
|
#ifdef SPD_opteed
|
|
ARM_MAP_OPTEE_CORE_MEM,
|
|
ARM_OPTEE_PAGEABLE_LOAD_MEM,
|
|
#endif
|
|
{0}
|
|
};
|
|
#endif
|
|
#ifdef IMAGE_BL2U
|
|
const mmap_region_t plat_arm_mmap[] = {
|
|
ARM_MAP_SHARED_RAM,
|
|
CSS_MAP_DEVICE,
|
|
SOC_CSS_MAP_DEVICE,
|
|
{0}
|
|
};
|
|
#endif
|
|
#ifdef IMAGE_BL31
|
|
const mmap_region_t plat_arm_mmap[] = {
|
|
ARM_MAP_SHARED_RAM,
|
|
V2M_MAP_IOFPGA,
|
|
CSS_MAP_DEVICE,
|
|
#ifdef PLAT_ARM_MEM_PROT_ADDR
|
|
ARM_V2M_MAP_MEM_PROTECT,
|
|
#endif
|
|
SOC_CSS_MAP_DEVICE,
|
|
{0}
|
|
};
|
|
#endif
|
|
#ifdef IMAGE_BL32
|
|
const mmap_region_t plat_arm_mmap[] = {
|
|
#ifdef AARCH32
|
|
ARM_MAP_SHARED_RAM,
|
|
#ifdef PLAT_ARM_MEM_PROT_ADDR
|
|
ARM_V2M_MAP_MEM_PROTECT,
|
|
#endif
|
|
#endif
|
|
V2M_MAP_IOFPGA,
|
|
CSS_MAP_DEVICE,
|
|
SOC_CSS_MAP_DEVICE,
|
|
{0}
|
|
};
|
|
#endif
|
|
|
|
ARM_CASSERT_MMAP
|