Rework BL2 to BL3-1 hand over interface
This patch reworks BL2 to BL3-1 hand over interface by introducing a
composite structure (bl31_args) that holds the superset of information
that needs to be passed from BL2 to BL3-1.
- The extents of secure memory available to BL3-1
- The extents of memory available to BL3-2 (not yet implemented) and
BL3-3
- Information to execute BL3-2 (not yet implemented) and BL3-3 images
This patch also introduces a new platform API (bl2_get_bl31_args_ptr)
that needs to be implemented by the platform code to export reference to
bl31_args structure which has been allocated in platform-defined memory.
The platform will initialize the extents of memory available to BL3-3
during early platform setup in bl31_args structure. This obviates the
need for bl2_get_ns_mem_layout platform API.
BL2 calls the bl2_get_bl31_args_ptr function to get a reference to
bl31_args structure. It uses the 'bl33_meminfo' field of this structure
to load the BL3-3 image. It sets the entry point information for the
BL3-3 image in the 'bl33_image_info' field of this structure. The
reference to this structure is passed to the BL3-1 image.
Also fixes issue ARM-software/tf-issues#25
Change-Id: Ic36426196dd5ebf89e60ff42643bed01b3500517
diff --git a/plat/fvp/bl2_plat_setup.c b/plat/fvp/bl2_plat_setup.c
index f8c922e..2e367d7 100644
--- a/plat/fvp/bl2_plat_setup.c
+++ b/plat/fvp/bl2_plat_setup.c
@@ -70,19 +70,25 @@
static meminfo bl2_tzram_layout
__attribute__ ((aligned(PLATFORM_CACHE_LINE_SIZE),
section("tzfw_coherent_mem")));
-/* Data structure which holds the extents of the Non-Secure DRAM for BL33 */
-static meminfo bl33_dram_layout
-__attribute__ ((aligned(PLATFORM_CACHE_LINE_SIZE),
- section("tzfw_coherent_mem")));
+
+/*******************************************************************************
+ * Reference to structure which holds the arguments which need to be passed
+ * to BL31
+ ******************************************************************************/
+static bl31_args *bl2_to_bl31_args;
meminfo *bl2_plat_sec_mem_layout(void)
{
return &bl2_tzram_layout;
}
-meminfo *bl2_get_ns_mem_layout(void)
+/*******************************************************************************
+ * This function returns a pointer to the memory that the platform has kept
+ * aside to pass all the information that BL31 could need.
+ ******************************************************************************/
+bl31_args *bl2_get_bl31_args_ptr(void)
{
- return &bl33_dram_layout;
+ return bl2_to_bl31_args;
}
/*******************************************************************************
@@ -101,16 +107,6 @@
bl2_tzram_layout.attr = mem_layout->attr;
bl2_tzram_layout.next = 0;
- /* Setup the BL3-3 memory layout.
- * Normal World Firmware loaded into main DRAM.
- */
- bl33_dram_layout.total_base = DRAM_BASE;
- bl33_dram_layout.total_size = DRAM_SIZE;
- bl33_dram_layout.free_base = DRAM_BASE;
- bl33_dram_layout.free_size = DRAM_SIZE;
- bl33_dram_layout.attr = 0;
- bl33_dram_layout.next = 0;
-
/* Initialize the platform config for future decision making */
platform_config_setup();
@@ -127,7 +123,15 @@
io_setup();
/* Use the Trusted DRAM for passing args to BL31 */
- bl2_el_change_mem_ptr = (unsigned char **) TZDRAM_BASE;
+ bl2_to_bl31_args = (bl31_args *) TZDRAM_BASE;
+
+ /* Populate the extents of memory available for loading BL33 */
+ bl2_to_bl31_args->bl33_meminfo.total_base = DRAM_BASE;
+ bl2_to_bl31_args->bl33_meminfo.total_size = DRAM_SIZE;
+ bl2_to_bl31_args->bl33_meminfo.free_base = DRAM_BASE;
+ bl2_to_bl31_args->bl33_meminfo.free_size = DRAM_SIZE;
+ bl2_to_bl31_args->bl33_meminfo.attr = 0;
+ bl2_to_bl31_args->bl33_meminfo.next = 0;
}
/*******************************************************************************