Rework page table setup for varying number of mem regions
authorDaniel Boulby <daniel.boulby@arm.com>
Fri, 6 Jul 2018 15:54:44 +0000 (16:54 +0100)
committerDaniel Boulby <daniel.boulby@arm.com>
Tue, 24 Jul 2018 14:01:57 +0000 (15:01 +0100)
Change arm_setup_page_tables() to take a variable number of memory
regions. Remove coherent memory region from BL1, BL2 and BL2U as
their coherent memory region doesn't contain anything and
therefore has a size of 0. Add check to ensure this
doesn't change without us knowing.

Change-Id: I790054e3b20b056dda1043a4a67bd7ac2d6a3bc0
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
16 files changed:
include/plat/arm/common/arm_def.h
include/plat/arm/common/plat_arm.h
include/plat/arm/css/common/css_def.h
plat/arm/board/common/board_css_common.c
plat/arm/board/juno/include/platform_def.h
plat/arm/common/arm_bl1_setup.c
plat/arm/common/arm_bl2_el3_setup.c
plat/arm/common/arm_bl2_setup.c
plat/arm/common/arm_bl2u_setup.c
plat/arm/common/arm_bl31_setup.c
plat/arm/common/arm_common.c
plat/arm/common/sp_min/arm_sp_min_setup.c
plat/arm/common/tsp/arm_tsp_setup.c
plat/ti/k3/common/k3_bl31_setup.c
plat/xilinx/zynqmp/bl31_zynqmp_setup.c
plat/xilinx/zynqmp/tsp/tsp_plat_setup.c

index e3d0edbce21e01b528c57e94fdcce3fdcee8661f..12137ae4cdce0894ce10b68be1e9f2717142b9f7 100644 (file)
                                                ARM_EL3_TZC_DRAM1_SIZE, \
                                                MT_MEMORY | MT_RW | MT_SECURE)
 
+#if SEPARATE_CODE_AND_RODATA
+#define ARM_MAP_BL_CODE                        MAP_REGION_FLAT(                        \
+                                               BL_CODE_BASE,                   \
+                                               BL_CODE_END - BL_CODE_BASE,     \
+                                               MT_CODE | MT_SECURE)
+#define ARM_MAP_BL_RO_DATA             MAP_REGION_FLAT(                        \
+                                               BL_RO_DATA_BASE,                \
+                                               BL_RO_DATA_END                  \
+                                                       - BL_RO_DATA_BASE,      \
+                                               MT_RO_DATA | MT_SECURE)
+#endif
+#if USE_COHERENT_MEM
+#define ARM_MAP_BL_COHERENT_RAM                MAP_REGION_FLAT(                        \
+                                               BL_COHERENT_RAM_BASE,           \
+                                               BL_COHERENT_RAM_END             \
+                                                       - BL_COHERENT_RAM_BASE, \
+                                               MT_DEVICE | MT_RW | MT_SECURE)
+#endif
+
 /*
  * The number of regions like RO(code), coherent and data required by
  * different BL stages which need to be mapped in the MMU.
index 33f2c7dbef447a1bcb82511bbe94de47bae24fb2..c26052afc0c2b39298efbfe62e75dbd3ee810b39 100644 (file)
@@ -69,17 +69,8 @@ typedef struct arm_tzc_regions_info {
 /*
  * Utility functions common to ARM standard platforms
  */
-void arm_setup_page_tables(uintptr_t total_base,
-                       size_t total_size,
-                       uintptr_t code_start,
-                       uintptr_t code_limit,
-                       uintptr_t rodata_start,
-                       uintptr_t rodata_limit
-#if USE_COHERENT_MEM
-                       , uintptr_t coh_start,
-                       uintptr_t coh_limit
-#endif
-);
+void arm_setup_page_tables(const mmap_region_t bl_regions[],
+                          const mmap_region_t plat_regions[]);
 
 #if defined(IMAGE_BL31) || (defined(AARCH32) && defined(IMAGE_BL32))
 /*
index 725c27cbcff9e7beae8cd328123b3c40526f07fb..048c58a3145de260259d2485e62494c5ba14332b 100644 (file)
                                                NSRAM_SIZE,     \
                                                MT_DEVICE | MT_RW | MT_NS)
 
+#if defined(IMAGE_BL2U)
+#define CSS_MAP_SCP_BL2U               MAP_REGION_FLAT(                \
+                                               SCP_BL2U_BASE,          \
+                                               SCP_BL2U_LIMIT          \
+                                                       - SCP_BL2U_BASE,\
+                                               MT_RW_DATA | MT_SECURE)
+#endif
+
 /* Platform ID address */
 #define SSC_VERSION_OFFSET                     0x040
 
index c4e83a4273a15baaee753f2afcf1e7a659a1f38a..40b1a275af6e08a29047dbcc3523eced777df5bc 100644 (file)
@@ -53,6 +53,8 @@ const mmap_region_t plat_arm_mmap[] = {
 const mmap_region_t plat_arm_mmap[] = {
        ARM_MAP_SHARED_RAM,
        CSS_MAP_DEVICE,
+       CSS_MAP_SCP_BL2U,
+       V2M_MAP_IOFPGA,
        SOC_CSS_MAP_DEVICE,
        {0}
 };
index 80d4ba81aee2a47a1362cd41480467d13069fb9b..a781c4f097e383568f252605e285214377c90c59 100644 (file)
@@ -98,7 +98,7 @@
 #endif
 
 #ifdef IMAGE_BL2U
-# define PLAT_ARM_MMAP_ENTRIES         4
+# define PLAT_ARM_MMAP_ENTRIES         5
 # define MAX_XLAT_TABLES               3
 #endif
 
index d141f647ec02d977355fae966e06fc4228e0d96a..180eae98b79ec94385f91662a7e24de95f9f9edc 100644 (file)
@@ -7,6 +7,7 @@
 #include <arch.h>
 #include <arm_def.h>
 #include <arm_xlat_tables.h>
+#include <assert.h>
 #include <bl1.h>
 #include <bl_common.h>
 #include <plat_arm.h>
 #pragma weak bl1_plat_sec_mem_layout
 #pragma weak bl1_plat_prepare_exit
 
+#define MAP_BL1_TOTAL          MAP_REGION_FLAT(                        \
+                                       bl1_tzram_layout.total_base,    \
+                                       bl1_tzram_layout.total_size,    \
+                                       MT_MEMORY | MT_RW | MT_SECURE)
+#define MAP_BL1_CODE           MAP_REGION_FLAT(                        \
+                                       BL_CODE_BASE,                   \
+                                       BL1_CODE_END - BL_CODE_BASE,    \
+                                       MT_CODE | MT_SECURE)
+#define MAP_BL1_RO_DATA                MAP_REGION_FLAT(                        \
+                                       BL1_RO_DATA_BASE,               \
+                                       BL1_RO_DATA_END                 \
+                                               - BL_RO_DATA_BASE,      \
+                                       MT_RO_DATA | MT_SECURE)
 
 /* Data structure which holds the extents of the trusted SRAM for BL1*/
 static meminfo_t bl1_tzram_layout;
@@ -84,17 +98,19 @@ void bl1_early_platform_setup(void)
  *****************************************************************************/
 void arm_bl1_plat_arch_setup(void)
 {
-       arm_setup_page_tables(bl1_tzram_layout.total_base,
-                             bl1_tzram_layout.total_size,
-                             BL_CODE_BASE,
-                             BL1_CODE_END,
-                             BL1_RO_DATA_BASE,
-                             BL1_RO_DATA_END
 #if USE_COHERENT_MEM
-                             , BL_COHERENT_RAM_BASE,
-                             BL_COHERENT_RAM_END
+       /* ARM platforms dont use coherent memory in BL1 */
+       assert((BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE) == 0U);
 #endif
-                            );
+
+       const mmap_region_t bl_regions[] = {
+               MAP_BL1_TOTAL,
+               MAP_BL1_CODE,
+               MAP_BL1_RO_DATA,
+               {0}
+       };
+
+       arm_setup_page_tables(bl_regions, plat_arm_get_mmap());
 #ifdef AARCH32
        enable_mmu_secure(0);
 #else
index e7247c63dacc6a57f9a735662b851883c6307b33..1d602bb1e7efc6a5f5fa4e739ef055502eb963a1 100644 (file)
@@ -3,6 +3,8 @@
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
+#include <arm_def.h>
+#include <assert.h>
 #include <generic_delay_timer.h>
 #include <plat_arm.h>
 #include <platform.h>
 #pragma weak bl2_el3_plat_arch_setup
 #pragma weak bl2_el3_plat_prepare_exit
 
+#define MAP_BL2_EL3_TOTAL      MAP_REGION_FLAT(                                \
+                                       bl2_el3_tzram_layout.total_base,        \
+                                       bl2_el3_tzram_layout.total_size,        \
+                                       MT_MEMORY | MT_RW | MT_SECURE)
+
 static meminfo_t bl2_el3_tzram_layout;
 
 /*
@@ -60,17 +67,20 @@ void bl2_el3_early_platform_setup(u_register_t arg0 __unused,
  ******************************************************************************/
 void arm_bl2_el3_plat_arch_setup(void)
 {
-       arm_setup_page_tables(bl2_el3_tzram_layout.total_base,
-                             bl2_el3_tzram_layout.total_size,
-                             BL_CODE_BASE,
-                             BL_CODE_END,
-                             BL_RO_DATA_BASE,
-                             BL_RO_DATA_END
+
 #if USE_COHERENT_MEM
-                             , BL_COHERENT_RAM_BASE,
-                             BL_COHERENT_RAM_END
+       /* Ensure ARM platforms dont use coherent memory in BL2_AT_EL3 */
+       assert(BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE == 0U);
 #endif
-                             );
+
+       const mmap_region_t bl_regions[] = {
+               MAP_BL2_EL3_TOTAL,
+               ARM_MAP_BL_CODE,
+               ARM_MAP_BL_RO_DATA,
+               {0}
+       };
+
+       arm_setup_page_tables(bl_regions, plat_arm_get_mmap());
 
 #ifdef AARCH32
        enable_mmu_secure(0);
index 3aa99f80562aa8affd90105842a8ae2f2fe2deb4..88bf1e6cd7cb11e2d88ed9304f1b3139920b0359 100644 (file)
@@ -35,6 +35,11 @@ CASSERT(BL2_BASE >= ARM_TB_FW_CONFIG_LIMIT, assert_bl2_base_overflows);
 #pragma weak bl2_plat_arch_setup
 #pragma weak bl2_plat_sec_mem_layout
 
+#define MAP_BL2_TOTAL          MAP_REGION_FLAT(                        \
+                                       bl2_tzram_layout.total_base,    \
+                                       bl2_tzram_layout.total_size,    \
+                                       MT_MEMORY | MT_RW | MT_SECURE)
+
 #if LOAD_IMAGE_V2
 
 #pragma weak bl2_plat_handle_post_image_load
@@ -231,17 +236,20 @@ void bl2_platform_setup(void)
  ******************************************************************************/
 void arm_bl2_plat_arch_setup(void)
 {
-       arm_setup_page_tables(bl2_tzram_layout.total_base,
-                             bl2_tzram_layout.total_size,
-                             BL_CODE_BASE,
-                             BL_CODE_END,
-                             BL_RO_DATA_BASE,
-                             BL_RO_DATA_END
+
 #if USE_COHERENT_MEM
-                             , BL_COHERENT_RAM_BASE,
-                             BL_COHERENT_RAM_END
+       /* Ensure ARM platforms dont use coherent memory in BL2 */
+       assert((BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE) == 0U);
 #endif
-                             );
+
+       const mmap_region_t bl_regions[] = {
+               MAP_BL2_TOTAL,
+               ARM_MAP_BL_CODE,
+               ARM_MAP_BL_RO_DATA,
+               {0}
+       };
+
+       arm_setup_page_tables(bl_regions, plat_arm_get_mmap());
 
 #ifdef AARCH32
        enable_mmu_secure(0);
index cd691e5c358e3bbaa0d600d78986fcde32585315..77d1186c7f8daaf7d4794a8616f4db28963480ad 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <arch_helpers.h>
 #include <arm_def.h>
+#include <assert.h>
 #include <bl_common.h>
 #include <generic_delay_timer.h>
 #include <plat_arm.h>
 #pragma weak bl2u_early_platform_setup
 #pragma weak bl2u_plat_arch_setup
 
+#define MAP_BL2U_TOTAL         MAP_REGION_FLAT(                        \
+                                       BL2U_BASE,                      \
+                                       BL2U_LIMIT - BL2U_BASE,         \
+                                       MT_MEMORY | MT_RW | MT_SECURE)
+
 /*
  * Perform ARM standard platform setup for BL2U
  */
@@ -58,18 +64,21 @@ void bl2u_early_platform_setup(meminfo_t *mem_layout, void *plat_info)
  ******************************************************************************/
 void arm_bl2u_plat_arch_setup(void)
 {
-       arm_setup_page_tables(BL2U_BASE,
-                             BL31_LIMIT,
-                             BL_CODE_BASE,
-                             BL_CODE_END,
-                             BL_RO_DATA_BASE,
-                             BL_RO_DATA_END
+
 #if USE_COHERENT_MEM
-                             ,
-                             BL_COHERENT_RAM_BASE,
-                             BL_COHERENT_RAM_END
+       /* Ensure ARM platforms dont use coherent memory in BL2U */
+       assert((BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE) == 0U);
 #endif
-               );
+
+       const mmap_region_t bl_regions[] = {
+               MAP_BL2U_TOTAL,
+               ARM_MAP_BL_CODE,
+               ARM_MAP_BL_RO_DATA,
+               {0}
+       };
+
+       arm_setup_page_tables(bl_regions, plat_arm_get_mmap());
+
 #ifdef AARCH32
        enable_mmu_secure(0);
 #else
index 6346f0fffd2bf440f8804ec1c73f121df8788210..6be2933478383e17ebcc64b6fcbeeebb6eba183f 100644 (file)
@@ -37,6 +37,10 @@ CASSERT(BL31_BASE >= ARM_TB_FW_CONFIG_LIMIT, assert_bl31_base_overflows);
 #pragma weak bl31_plat_arch_setup
 #pragma weak bl31_plat_get_next_image_ep_info
 
+#define MAP_BL31_TOTAL MAP_REGION_FLAT(                        \
+                                       BL31_BASE,                      \
+                                       BL31_END - BL31_BASE,           \
+                                       MT_MEMORY | MT_RW | MT_SECURE)
 
 /*******************************************************************************
  * Return a pointer to the 'entry_point_info' structure of the next image for the
@@ -280,17 +284,19 @@ void bl31_plat_runtime_setup(void)
  ******************************************************************************/
 void arm_bl31_plat_arch_setup(void)
 {
-       arm_setup_page_tables(BL31_BASE,
-                             BL31_END - BL31_BASE,
-                             BL_CODE_BASE,
-                             BL_CODE_END,
-                             BL_RO_DATA_BASE,
-                             BL_RO_DATA_END
+
+       const mmap_region_t bl_regions[] = {
+               MAP_BL31_TOTAL,
+               ARM_MAP_BL_CODE,
+               ARM_MAP_BL_RO_DATA,
 #if USE_COHERENT_MEM
-                             , BL_COHERENT_RAM_BASE,
-                             BL_COHERENT_RAM_END
+               ARM_MAP_BL_COHERENT_RAM,
 #endif
-                             );
+               {0}
+       };
+
+       arm_setup_page_tables(bl_regions, plat_arm_get_mmap());
+
        enable_mmu_el3(0);
 }
 
index 32fd9ee68c95a33bac88cd5d222fb774131dddf3..52d22684611a6934a8cde1cd3c394fab22f6fb7d 100644 (file)
@@ -28,61 +28,34 @@ extern const mmap_region_t plat_arm_mmap[];
 
 /*
  * Set up the page tables for the generic and platform-specific memory regions.
- * The extents of the generic memory regions are specified by the function
- * arguments and consist of:
- * - Trusted SRAM seen by the BL image;
+ * The size of the Trusted SRAM seen by the BL image must be specified as well
+ * as an array specifying the generic memory regions which can be;
  * - Code section;
  * - Read-only data section;
  * - Coherent memory region, if applicable.
  */
-void arm_setup_page_tables(uintptr_t total_base,
-                          size_t total_size,
-                          uintptr_t code_start,
-                          uintptr_t code_limit,
-                          uintptr_t rodata_start,
-                          uintptr_t rodata_limit
-#if USE_COHERENT_MEM
-                          ,
-                          uintptr_t coh_start,
-                          uintptr_t coh_limit
-#endif
-                          )
+
+void arm_setup_page_tables(const mmap_region_t bl_regions[],
+                          const mmap_region_t plat_regions[])
 {
+#if LOG_LEVEL >= LOG_LEVEL_VERBOSE
+       const mmap_region_t *regions = bl_regions;
+
+       while (regions->size != 0U) {
+               VERBOSE("Region: 0x%lx - 0x%lx has attributes 0x%x\n",
+                               regions->base_va,
+                               (regions->base_va + regions->size),
+                               regions->attr);
+               regions++;
+       }
+#endif
        /*
         * Map the Trusted SRAM with appropriate memory attributes.
         * Subsequent mappings will adjust the attributes for specific regions.
         */
-       VERBOSE("Trusted SRAM seen by this BL image: %p - %p\n",
-               (void *) total_base, (void *) (total_base + total_size));
-       mmap_add_region(total_base, total_base,
-                       total_size,
-                       MT_MEMORY | MT_RW | MT_SECURE);
-
-       /* Re-map the code section */
-       VERBOSE("Code region: %p - %p\n",
-               (void *) code_start, (void *) code_limit);
-       mmap_add_region(code_start, code_start,
-                       code_limit - code_start,
-                       MT_CODE | MT_SECURE);
-
-       /* Re-map the read-only data section */
-       VERBOSE("Read-only data region: %p - %p\n",
-               (void *) rodata_start, (void *) rodata_limit);
-       mmap_add_region(rodata_start, rodata_start,
-                       rodata_limit - rodata_start,
-                       MT_RO_DATA | MT_SECURE);
-
-#if USE_COHERENT_MEM
-       /* Re-map the coherent memory region */
-       VERBOSE("Coherent region: %p - %p\n",
-               (void *) coh_start, (void *) coh_limit);
-       mmap_add_region(coh_start, coh_start,
-                       coh_limit - coh_start,
-                       MT_DEVICE | MT_RW | MT_SECURE);
-#endif
-
+       mmap_add(bl_regions);
        /* Now (re-)map the platform-specific memory regions */
-       mmap_add(plat_arm_get_mmap());
+       mmap_add(plat_regions);
 
        /* Create the page tables to reflect the above mappings */
        init_xlat_tables();
index b42e35f3a33a1f33aa12b67f292e9b794e877184..c7f317c59f033b82b04dadd72c397a8fb0d34f67 100644 (file)
@@ -22,6 +22,11 @@ static entry_point_info_t bl33_image_ep_info;
 #pragma weak sp_min_plat_arch_setup
 #pragma weak plat_arm_sp_min_early_platform_setup
 
+#define MAP_BL_SP_MIN_TOTAL    MAP_REGION_FLAT(                        \
+                                       BL32_BASE,                      \
+                                       BL32_END - BL32_BASE,           \
+                                       MT_MEMORY | MT_RW | MT_SECURE)
+
 /*
  * Check that BL32_BASE is above ARM_TB_FW_CONFIG_LIMIT. The reserved page
  * is required for SOC_FW_CONFIG/TOS_FW_CONFIG passed from BL2.
@@ -196,18 +201,17 @@ void sp_min_plat_runtime_setup(void)
  ******************************************************************************/
 void sp_min_plat_arch_setup(void)
 {
-
-       arm_setup_page_tables(BL32_BASE,
-                             (BL32_END - BL32_BASE),
-                             BL_CODE_BASE,
-                             BL_CODE_END,
-                             BL_RO_DATA_BASE,
-                             BL_RO_DATA_END
+       const mmap_region_t bl_regions[] = {
+               MAP_BL_SP_MIN_TOTAL,
+               ARM_MAP_BL_CODE,
+               ARM_MAP_BL_RO_DATA,
 #if USE_COHERENT_MEM
-                             , BL_COHERENT_RAM_BASE,
-                             BL_COHERENT_RAM_END
+               ARM_MAP_BL_COHERENT_RAM,
 #endif
-                             );
+               {0}
+       };
+
+       arm_setup_page_tables(bl_regions, plat_arm_get_mmap());
 
        enable_mmu_secure(0);
 }
index 16125ad4fa35bab16863171cf4aad086972b9a78..491705dface6bc758bfe56c244d07219a7f79ff0 100644 (file)
@@ -5,6 +5,7 @@
  */
 
 #include <arm_def.h>
+#include <assert.h>
 #include <bl_common.h>
 #include <console.h>
 #include <debug.h>
 #pragma weak tsp_platform_setup
 #pragma weak tsp_plat_arch_setup
 
+#define MAP_BL_TSP_TOTAL       MAP_REGION_FLAT(                        \
+                                       BL32_BASE,                      \
+                                       BL32_END - BL32_BASE,           \
+                                       MT_MEMORY | MT_RW | MT_SECURE)
 
 /*******************************************************************************
  * Initialize the UART
@@ -69,16 +74,18 @@ void tsp_platform_setup(void)
  ******************************************************************************/
 void tsp_plat_arch_setup(void)
 {
-       arm_setup_page_tables(BL32_BASE,
-                             (BL32_END - BL32_BASE),
-                             BL_CODE_BASE,
-                             BL_CODE_END,
-                             BL_RO_DATA_BASE,
-                             BL_RO_DATA_END
 #if USE_COHERENT_MEM
-                             , BL_COHERENT_RAM_BASE,
-                             BL_COHERENT_RAM_END
+       /* Ensure ARM platforms dont use coherent memory in TSP */
+       assert((BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE) == 0U);
 #endif
-                             );
+
+       const mmap_region_t bl_regions[] = {
+               MAP_BL_TSP_TOTAL,
+               ARM_MAP_BL_CODE,
+               ARM_MAP_BL_RO_DATA,
+               {0}
+       };
+
+       arm_setup_page_tables(bl_regions, plat_arm_get_mmap());
        enable_mmu_el1(0);
 }
index ca7d214a16bacadf411cb4a3a4ff4cbe1abae97b..3de57a7c4f61786cb435f0917115838123426320 100644 (file)
@@ -99,12 +99,18 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
 
 void bl31_plat_arch_setup(void)
 {
-       arm_setup_page_tables(BL31_BASE,
-                             BL31_END - BL31_BASE,
-                             BL_CODE_BASE,
-                             BL_CODE_END,
-                             BL_RO_DATA_BASE,
-                             BL_RO_DATA_END);
+
+       const mmap_region_t bl_regions[] = {
+               MAP_REGION_FLAT(BL31_BASE, BL31_END - BL31_BASE,
+                               MT_MEMORY | MT_RW | MT_SECURE),
+               MAP_REGION_FLAT(BL_CODE_BASE, BL_CODE_END - BL_CODE_BASE,
+                               MT_CODE | MT_SECURE),
+               MAP_REGION_FLAT(BL_RO_DATA_BASE, BL_RO_DATA_END - BL_RO_DATA_END,
+                               MT_RO_DATA | MT_SECURE),
+               {0}
+       };
+
+       arm_setup_page_tables(bl_regions, plat_arm_get_mmap());
        enable_mmu_el3(0);
 }
 
index 0b3106f7a905c0558519c9e7231d19592ec7dbd8..abfb8c6fc41aa070edaae37d818bfa5a5f44e760 100644 (file)
@@ -179,13 +179,20 @@ void bl31_plat_arch_setup(void)
        plat_arm_interconnect_init();
        plat_arm_interconnect_enter_coherency();
 
-       arm_setup_page_tables(BL31_BASE,
-                             BL31_END - BL31_BASE,
-                             BL_CODE_BASE,
-                             BL_CODE_END,
-                             BL_RO_DATA_BASE,
-                             BL_RO_DATA_END,
-                             BL_COHERENT_RAM_BASE,
-                             BL_COHERENT_RAM_END);
+
+       const mmap_region_t bl_regions[] = {
+               MAP_REGION_FLAT(BL31_BASE, BL31_END - BL31_BASE,
+                       MT_MEMORY | MT_RW | MT_SECURE),
+               MAP_REGION_FLAT(BL_CODE_BASE, BL_CODE_END - BL_CODE_BASE,
+                               MT_CODE | MT_SECURE),
+               MAP_REGION_FLAT(BL_RO_DATA_BASE, BL_RO_DATA_END - BL_RO_DATA_BASE,
+                               MT_RO_DATA | MT_SECURE),
+               MAP_REGION_FLAT(BL_COHERENT_RAM_BASE,
+                               BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE,
+                               MT_DEVICE | MT_RW | MT_SECURE),
+               {0}
+       };
+
+       arm_setup_page_tables(bl_regions, plat_arm_get_mmap());
        enable_mmu_el3(0);
 }
index ecc4d0a972308cdbce3a99c841b6b461ed949219..52d4bf8cc335fd625b7f333fc6559d45c1e18011 100644 (file)
@@ -44,14 +44,19 @@ void tsp_platform_setup(void)
  ******************************************************************************/
 void tsp_plat_arch_setup(void)
 {
-       arm_setup_page_tables(BL32_BASE,
-                             BL32_END - BL32_BASE,
-                             BL_CODE_BASE,
-                             BL_CODE_END,
-                             BL_RO_DATA_BASE,
-                             BL_RO_DATA_END,
-                             BL_COHERENT_RAM_BASE,
-                             BL_COHERENT_RAM_END
-                             );
+       const mmap_region_t bl_regions[] = {
+               MAP_REGION_FLAT(BL32_BASE, BL32_END - BL32_BASE,
+                       MT_MEMORY | MT_RW | MT_SECURE),
+               MAP_REGION_FLAT(BL_CODE_BASE, BL_CODE_END - BL_CODE_BASE,
+                       MT_CODE | MT_SECURE),
+               MAP_REGION_FLAT(BL_RO_DATA_BASE, BL_RO_DATA_END - BL_RO_DATA_BASE,
+                       MT_RO_DATA | MT_SECURE),
+               MAP_REGION_FLAT(BL_COHERENT_RAM_BASE,
+                       BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE,
+                       MT_DEVICE | MT_RW | MT_SECURE),
+               {0}
+       };
+
+       arm_setup_page_tables(bl_regions, plat_arm_get_mmap());
        enable_mmu_el1(0);
 }