Commit b09ba056 authored by Roberto Vargas's avatar Roberto Vargas
Browse files

mem_protect: Add DRAM2 to the list of mem protected ranges



On ARM platforms, the maximum size of the address space is limited
to 32-bits as defined in arm_def.h. In order to access DRAM2, which
is defined beyond the 32-bit address space, the maximum address space
is increased to 36-bits in AArch64. It is possible to increase the
virtual space for AArch32, but it is more difficult and not supported
for now.

NOTE - the actual maximum memory address space is platform dependent
and is checked at run-time by querying the PARange field in the
ID_AA64MMFR0_EL1 register.

Change-Id: I6cb05c78a63b1fed96db9a9773faca04a5b93d67
Signed-off-by: default avatarRoberto Vargas <roberto.vargas@arm.com>
parent f145403c
...@@ -177,7 +177,12 @@ ...@@ -177,7 +177,12 @@
ARM_NS_DRAM1_SIZE, \ ARM_NS_DRAM1_SIZE, \
MT_MEMORY | MT_RW | MT_NS) MT_MEMORY | MT_RW | MT_NS)
#define ARM_MAP_DRAM2 MAP_REGION_FLAT( \
ARM_DRAM2_BASE, \
ARM_DRAM2_SIZE, \
MT_MEMORY | MT_RW | MT_NS)
#ifdef SPD_tspd #ifdef SPD_tspd
#define ARM_MAP_TSP_SEC_MEM MAP_REGION_FLAT( \ #define ARM_MAP_TSP_SEC_MEM MAP_REGION_FLAT( \
TSP_SEC_MEM_BASE, \ TSP_SEC_MEM_BASE, \
TSP_SEC_MEM_SIZE, \ TSP_SEC_MEM_SIZE, \
...@@ -224,8 +229,18 @@ ...@@ -224,8 +229,18 @@
* Required platform porting definitions common to all ARM standard platforms * Required platform porting definitions common to all ARM standard platforms
*****************************************************************************/ *****************************************************************************/
/*
* We need to access DRAM2 from BL2 for PSCI_MEM_PROTECT for
* AArch64 builds
*/
#ifdef AARCH64
#define PLAT_PHY_ADDR_SPACE_SIZE (1ull << 36)
#define PLAT_VIRT_ADDR_SPACE_SIZE (1ull << 36)
#else
#define PLAT_PHY_ADDR_SPACE_SIZE (1ull << 32) #define PLAT_PHY_ADDR_SPACE_SIZE (1ull << 32)
#define PLAT_VIRT_ADDR_SPACE_SIZE (1ull << 32) #define PLAT_VIRT_ADDR_SPACE_SIZE (1ull << 32)
#endif
/* /*
* This macro defines the deepest retention state possible. A higher state * This macro defines the deepest retention state possible. A higher state
......
...@@ -36,6 +36,9 @@ const mmap_region_t plat_arm_mmap[] = { ...@@ -36,6 +36,9 @@ const mmap_region_t plat_arm_mmap[] = {
CSS_MAP_DEVICE, CSS_MAP_DEVICE,
SOC_CSS_MAP_DEVICE, SOC_CSS_MAP_DEVICE,
ARM_MAP_NS_DRAM1, ARM_MAP_NS_DRAM1,
#ifdef AARCH64
ARM_MAP_DRAM2,
#endif
#ifdef SPD_tspd #ifdef SPD_tspd
ARM_MAP_TSP_SEC_MEM, ARM_MAP_TSP_SEC_MEM,
#endif #endif
......
...@@ -79,6 +79,9 @@ const mmap_region_t plat_arm_mmap[] = { ...@@ -79,6 +79,9 @@ const mmap_region_t plat_arm_mmap[] = {
MAP_DEVICE0, MAP_DEVICE0,
MAP_DEVICE1, MAP_DEVICE1,
ARM_MAP_NS_DRAM1, ARM_MAP_NS_DRAM1,
#ifdef AARCH64
ARM_MAP_DRAM2,
#endif
#ifdef SPD_tspd #ifdef SPD_tspd
ARM_MAP_TSP_SEC_MEM, ARM_MAP_TSP_SEC_MEM,
#endif #endif
......
...@@ -68,10 +68,10 @@ ...@@ -68,10 +68,10 @@
#ifdef IMAGE_BL2 #ifdef IMAGE_BL2
#ifdef SPD_opteed #ifdef SPD_opteed
# define PLAT_ARM_MMAP_ENTRIES 10 # define PLAT_ARM_MMAP_ENTRIES 11
# define MAX_XLAT_TABLES 5 # define MAX_XLAT_TABLES 5
#else #else
# define PLAT_ARM_MMAP_ENTRIES 9 # define PLAT_ARM_MMAP_ENTRIES 10
# define MAX_XLAT_TABLES 4 # define MAX_XLAT_TABLES 4
#endif #endif
#endif #endif
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
#endif #endif
#ifdef IMAGE_BL31 #ifdef IMAGE_BL31
# define PLAT_ARM_MMAP_ENTRIES 6 # define PLAT_ARM_MMAP_ENTRIES 7
# define MAX_XLAT_TABLES 3 # define MAX_XLAT_TABLES 3
#endif #endif
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
mem_region_t arm_ram_ranges[] = { mem_region_t arm_ram_ranges[] = {
{ARM_NS_DRAM1_BASE, ARM_NS_DRAM1_SIZE}, {ARM_NS_DRAM1_BASE, ARM_NS_DRAM1_SIZE},
#ifdef AARCH64
{ARM_DRAM2_BASE, ARM_DRAM2_SIZE},
#endif
}; };
/******************************************************************************* /*******************************************************************************
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment