summaryrefslogtreecommitdiff
path: root/bl2/bl2_main.c
diff options
context:
space:
mode:
authorAchin Gupta <achin.gupta@arm.com>2014-02-19 17:52:35 +0000
committerDan Handley <dan.handley@arm.com>2014-02-20 19:06:34 +0000
commita3050ed521ec1fd6d34d7d8ba5105ac8bc024992 (patch)
tree0cd32ed1093a11a53f7635e0668a7afd5155513c /bl2/bl2_main.c
parente4d084ea9629703166e59d116d4aefbd6f2be531 (diff)
Add support for BL3-2 in BL2
This patch adds support for loading a BL3-2 image in BL2. In case a BL3-2 image is found, it also passes information to BL3-1 about where it is located and the extents of memory available to it. Information about memory extents is populated by platform specific code. The documentation has also been updated to reflect the above changes. Change-Id: I526b2efb80babebab1318f2b02e319a86d6758b0 Co-authored-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Diffstat (limited to 'bl2/bl2_main.c')
-rw-r--r--bl2/bl2_main.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/bl2/bl2_main.c b/bl2/bl2_main.c
index a3e0cdfd..74952daf 100644
--- a/bl2/bl2_main.c
+++ b/bl2/bl2_main.c
@@ -49,7 +49,7 @@ void bl2_main(void)
{
meminfo *bl2_tzram_layout;
bl31_args *bl2_to_bl31_args;
- unsigned long bl31_base, bl33_base, el_status;
+ unsigned long bl31_base, bl32_base = 0, bl33_base, el_status;
unsigned int bl2_load, bl31_load, mode;
/* Perform remaining generic architectural setup in S-El1 */
@@ -90,6 +90,20 @@ void bl2_main(void)
bl2_to_bl31_args = bl2_get_bl31_args_ptr();
/*
+ * Load the BL32 image if there's one. It is upto to platform
+ * to specify where BL32 should be loaded if it exists. It
+ * could create space in the secure sram or point to a
+ * completely different memory. A zero size indicates that the
+ * platform does not want to load a BL32 image.
+ */
+ if (bl2_to_bl31_args->bl32_meminfo.total_size)
+ bl32_base = load_image(&bl2_to_bl31_args->bl32_meminfo,
+ BL32_IMAGE_NAME,
+ bl2_to_bl31_args->bl32_meminfo.attr &
+ LOAD_MASK,
+ BL32_BASE);
+
+ /*
* Create a new layout of memory for BL31 as seen by BL2. This
* will gobble up all the BL2 memory.
*/
@@ -132,6 +146,18 @@ void bl2_main(void)
make_spsr(mode, MODE_SP_ELX, MODE_RW_64);
bl2_to_bl31_args->bl33_image_info.security_state = NON_SECURE;
+ if (bl32_base) {
+ /* Fill BL32 image info */
+ bl2_to_bl31_args->bl32_image_info.entrypoint = bl32_base;
+ bl2_to_bl31_args->bl32_image_info.security_state = SECURE;
+
+ /*
+ * The Secure Payload Dispatcher service is responsible for
+ * setting the SPSR prior to entry into the BL32 image.
+ */
+ bl2_to_bl31_args->bl32_image_info.spsr = 0;
+ }
+
/* Flush the entire BL31 args buffer */
flush_dcache_range((unsigned long) bl2_to_bl31_args,
sizeof(*bl2_to_bl31_args));