Fix build for SEPARATE_CODE_AND_RODATA=0
authorDaniel Boulby <daniel.boulby@arm.com>
Mon, 16 Jul 2018 13:09:15 +0000 (14:09 +0100)
committerDaniel Boulby <daniel.boulby@arm.com>
Wed, 1 Aug 2018 15:26:26 +0000 (16:26 +0100)
TF won't build since no memory region is specified
for when SEPARATE_CODE_AND_RODATA=0 it still relies on
the ARM_MAP_BL_RO_DATA region which is never defined for
this case. Create memory region combining code and RO data for
when the build flag SEPARATE_CODE_AND_RODATA=0 to fix this

Change-Id: I6c129eb0833497710cce55e76b8908ce03e0a638
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
include/plat/arm/common/arm_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/sp_min/arm_sp_min_setup.c
plat/arm/common/tsp/arm_tsp_setup.c

index 9a661d7a5e91389f2534b1fa9ed7555dbefd55cf..47f2ac210a484d6b449112e28b71bc7516be1517 100644 (file)
                                                ARM_EL3_TZC_DRAM1_SIZE, \
                                                MT_MEMORY | MT_RW | MT_SECURE)
 
+/*
+ * If SEPARATE_CODE_AND_RODATA=1 we define a region for each section
+ * otherwise one region is defined containing both.
+ */
 #if SEPARATE_CODE_AND_RODATA
-#define ARM_MAP_BL_CODE                        MAP_REGION_FLAT(                        \
+#define ARM_MAP_BL_RO                  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(                        \
+                                               MT_CODE | MT_SECURE),           \
+                                       MAP_REGION_FLAT(                        \
                                                BL_RO_DATA_BASE,                \
                                                BL_RO_DATA_END                  \
                                                        - BL_RO_DATA_BASE,      \
                                                MT_RO_DATA | MT_SECURE)
+#else
+#define ARM_MAP_BL_RO                  MAP_REGION_FLAT(                        \
+                                               BL_CODE_BASE,                   \
+                                               BL_CODE_END - BL_CODE_BASE,     \
+                                               MT_CODE | MT_SECURE)
 #endif
 #if USE_COHERENT_MEM
 #define ARM_MAP_BL_COHERENT_RAM                MAP_REGION_FLAT(                        \
 #endif
 
 /*
- * The number of regions like RO(code), coherent and data required by
+ * The max number of regions like RO(code), coherent and data required by
  * different BL stages which need to be mapped in the MMU.
  */
-#if USE_COHERENT_MEM
 # define ARM_BL_REGIONS                        4
-#else
-# define ARM_BL_REGIONS                        3
-#endif
 
 #define MAX_MMAP_REGIONS               (PLAT_ARM_MMAP_ENTRIES +        \
                                         ARM_BL_REGIONS)
index 94839767dbe88b46dc6153add4041b87076f6780..a192a063501a207ebfcf2b61c2905ce6e68127e0 100644 (file)
                                        bl1_tzram_layout.total_base,    \
                                        bl1_tzram_layout.total_size,    \
                                        MT_MEMORY | MT_RW | MT_SECURE)
-#define MAP_BL1_CODE           MAP_REGION_FLAT(                        \
+/*
+ * If SEPARATE_CODE_AND_RODATA=1 we define a region for each section
+ * otherwise one region is defined containing both
+ */
+#if SEPARATE_CODE_AND_RODATA
+#define MAP_BL1_RO             MAP_REGION_FLAT(                        \
                                        BL_CODE_BASE,                   \
                                        BL1_CODE_END - BL_CODE_BASE,    \
-                                       MT_CODE | MT_SECURE)
-#define MAP_BL1_RO_DATA                MAP_REGION_FLAT(                        \
+                                       MT_CODE | MT_SECURE),           \
+                               MAP_REGION_FLAT(                        \
                                        BL1_RO_DATA_BASE,               \
                                        BL1_RO_DATA_END                 \
                                                - BL_RO_DATA_BASE,      \
                                        MT_RO_DATA | MT_SECURE)
+#else
+#define MAP_BL1_RO             MAP_REGION_FLAT(                        \
+                                       BL_CODE_BASE,                   \
+                                       BL1_CODE_END - BL_CODE_BASE,    \
+                                       MT_CODE | MT_SECURE)
+#endif
 
 /* Data structure which holds the extents of the trusted SRAM for BL1*/
 static meminfo_t bl1_tzram_layout;
@@ -105,8 +116,7 @@ void arm_bl1_plat_arch_setup(void)
 
        const mmap_region_t bl_regions[] = {
                MAP_BL1_TOTAL,
-               MAP_BL1_CODE,
-               MAP_BL1_RO_DATA,
+               MAP_BL1_RO,
                {0}
        };
 
index 1d602bb1e7efc6a5f5fa4e739ef055502eb963a1..1c93214eb2032b393e31756c77db1672ccc0f876 100644 (file)
@@ -75,8 +75,7 @@ void arm_bl2_el3_plat_arch_setup(void)
 
        const mmap_region_t bl_regions[] = {
                MAP_BL2_EL3_TOTAL,
-               ARM_MAP_BL_CODE,
-               ARM_MAP_BL_RO_DATA,
+               ARM_MAP_BL_RO,
                {0}
        };
 
index 88c0bc9239ba6c2b954ebb9d4473424504124f8b..39aceb3b9764e262264af8ffe8bd98d1bb9afabe 100644 (file)
@@ -245,8 +245,7 @@ void arm_bl2_plat_arch_setup(void)
 
        const mmap_region_t bl_regions[] = {
                MAP_BL2_TOTAL,
-               ARM_MAP_BL_CODE,
-               ARM_MAP_BL_RO_DATA,
+               ARM_MAP_BL_RO,
                {0}
        };
 
index 2bf8a936e5ef913810c4ec4c0a0972647a260f63..a626830231ffad00d7faba8d83360fbbfdcebec3 100644 (file)
@@ -72,8 +72,7 @@ void arm_bl2u_plat_arch_setup(void)
 
        const mmap_region_t bl_regions[] = {
                MAP_BL2U_TOTAL,
-               ARM_MAP_BL_CODE,
-               ARM_MAP_BL_RO_DATA,
+               ARM_MAP_BL_RO,
                {0}
        };
 
index 557854c52e916ede70eb48367c696ff458c1df3d..0b648049faf0fb28bd542ec5d52839018447eead 100644 (file)
@@ -287,8 +287,7 @@ void arm_bl31_plat_arch_setup(void)
 
        const mmap_region_t bl_regions[] = {
                MAP_BL31_TOTAL,
-               ARM_MAP_BL_CODE,
-               ARM_MAP_BL_RO_DATA,
+               ARM_MAP_BL_RO,
 #if USE_COHERENT_MEM
                ARM_MAP_BL_COHERENT_RAM,
 #endif
index c7f317c59f033b82b04dadd72c397a8fb0d34f67..935290ed6c34edd8cc27dead60bbc6c8f91d84c2 100644 (file)
@@ -203,8 +203,7 @@ void sp_min_plat_arch_setup(void)
 {
        const mmap_region_t bl_regions[] = {
                MAP_BL_SP_MIN_TOTAL,
-               ARM_MAP_BL_CODE,
-               ARM_MAP_BL_RO_DATA,
+               ARM_MAP_BL_RO,
 #if USE_COHERENT_MEM
                ARM_MAP_BL_COHERENT_RAM,
 #endif
index 491705dface6bc758bfe56c244d07219a7f79ff0..2d42d8e00be77b57c6492798e8a93a08f4e1469b 100644 (file)
@@ -81,8 +81,7 @@ void tsp_plat_arch_setup(void)
 
        const mmap_region_t bl_regions[] = {
                MAP_BL_TSP_TOTAL,
-               ARM_MAP_BL_CODE,
-               ARM_MAP_BL_RO_DATA,
+               ARM_MAP_BL_RO,
                {0}
        };