summaryrefslogtreecommitdiff
path: root/bl2/bl2_main.c
diff options
context:
space:
mode:
authorHarry Liebel <Harry.Liebel@arm.com>2014-02-14 14:42:48 +0000
committerDan Handley <dan.handley@arm.com>2014-02-17 18:51:44 +0000
commit561cd33eceaff56a1c6cabe5a3e6e03e21e9dc9a (patch)
tree838cc81a5f823db5344f3581cf7f77e72efd636c /bl2/bl2_main.c
parentf58ad36f2f51798b093d282b56a3a311fdc78ca9 (diff)
Add Firmware Image Package (FIP) driver
The Firmware Image Package (FIP) driver allows for data to be loaded from a FIP on platform storage. The FVP supports loading bootloader images from a FIP located in NOR FLASH. The implemented FVP policy states that bootloader images will be loaded from a FIP in NOR FLASH if available and fall back to loading individual images from semi-hosting. NOTE: - BL3-3(e.g. UEFI) is loaded into DRAM and needs to be configured to run from the BL33_BASE address. This is currently set to DRAM_BASE+128MB for the FVP. Change-Id: I2e4821748e3376b5f9e467cf3ec09509e43579a0
Diffstat (limited to 'bl2/bl2_main.c')
-rw-r--r--bl2/bl2_main.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/bl2/bl2_main.c b/bl2/bl2_main.c
index 018a21fd..4745881e 100644
--- a/bl2/bl2_main.c
+++ b/bl2/bl2_main.c
@@ -37,6 +37,7 @@
#include <semihosting.h>
#include <bl_common.h>
#include <bl2.h>
+#include "debug.h"
/*******************************************************************************
* The only thing to do in BL2 is to load further images and pass control to
@@ -48,8 +49,9 @@ void bl2_main(void)
{
meminfo *bl2_tzram_layout;
meminfo *bl31_tzram_layout;
+ meminfo *bl33_ns_layout;
el_change_info *ns_image_info;
- unsigned long bl31_base, el_status;
+ unsigned long bl31_base, bl33_base, el_status;
unsigned int bl2_load, bl31_load, mode;
/* Perform remaining generic architectural setup in S-El1 */
@@ -87,18 +89,23 @@ void bl2_main(void)
bl31_tzram_layout = (meminfo *) get_el_change_mem_ptr();
init_bl31_mem_layout(bl2_tzram_layout, bl31_tzram_layout, bl31_load);
+ /* Find out where the BL3-3 normal world firmware should go. */
+ bl33_ns_layout = bl2_get_ns_mem_layout();
+ bl33_base = load_image(bl33_ns_layout, BL33_IMAGE_NAME,
+ BOT_LOAD, plat_get_ns_image_entrypoint());
+ /* Halt if failed to load normal world firmware. */
+ if (bl33_base == 0) {
+ ERROR("Failed to load BL3-3.\n");
+ panic();
+ }
+
/*
* BL2 also needs to tell BL31 where the non-trusted software image
* has been loaded. Place this info right after the BL31 memory layout
*/
ns_image_info = (el_change_info *) ((unsigned char *) bl31_tzram_layout
+ sizeof(meminfo));
-
- /*
- * Assume that the non-secure bootloader has already been
- * loaded to its platform-specific location.
- */
- ns_image_info->entrypoint = plat_get_ns_image_entrypoint();
+ ns_image_info->entrypoint = bl33_base;
/* Figure out what mode we enter the non-secure world in */
el_status = read_id_aa64pfr0_el1() >> ID_AA64PFR0_EL2_SHIFT;