aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandrine Bailleux <sandrine.bailleux@arm.com>2014-05-27 14:44:57 +0100
committerSandrine Bailleux <sandrine.bailleux@arm.com>2014-06-05 17:39:40 +0100
commit8cbc9b29c931a6714030049c980447032e594e24 (patch)
treef79f4f40012e8130a15405ad22840b8db190a9c7
parent6257e9d39f386a76aff9ac29ef36f2aaa6fc3f1f (diff)
downloadtrusted-firmware-a-8cbc9b29c931a6714030049c980447032e594e24.tar.gz
juno: Fix bl30_image() function
The interface to load an image has changed so load_bl30() function needs to be modified accordingly. Change-Id: I7ff3f808579f6dcd4ddab7aa17f18932152ea33f
-rw-r--r--plat/juno/bl2_plat_setup.c51
1 files changed, 32 insertions, 19 deletions
diff --git a/plat/juno/bl2_plat_setup.c b/plat/juno/bl2_plat_setup.c
index 5e98f1d775..35683e8968 100644
--- a/plat/juno/bl2_plat_setup.c
+++ b/plat/juno/bl2_plat_setup.c
@@ -177,42 +177,55 @@ void bl2_early_platform_setup(meminfo_t *mem_layout)
* the image into. When this function exits, the RAM layout remains untouched
* so the BL2 can load BL3-1 as normal.
******************************************************************************/
-/*
- * Juno TODO: revisit, it won't compile.
- */
static int load_bl30(void)
{
meminfo_t *bl2_tzram_layout;
- meminfo_t tzram_layout;
- meminfo_t *tmp_tzram_layout = &tzram_layout;
- unsigned long bl30_base;
- unsigned int image_len;
+ meminfo_t tmp_tzram_layout;
+ uintptr_t bl30_base;
+ uint32_t bl30_size;
unsigned int bl2_load, bl30_load;
- int ret = -1;
+ int ret;
+ int e;
+ image_info_t bl30_image_info;
+ entry_point_info_t bl30_ep;
/* Find out how much free trusted ram remains after BL2 load */
bl2_tzram_layout = bl2_plat_sec_mem_layout();
/* copy the TZRAM layout and use it */
- memcpy(tmp_tzram_layout, bl2_tzram_layout, sizeof(meminfo_t));
+ memcpy(&tmp_tzram_layout, bl2_tzram_layout, sizeof(meminfo_t));
/* Work out where to load BL3-0 before transferring to SCP */
- bl2_load = tmp_tzram_layout->attr & LOAD_MASK;
+ bl2_load = tmp_tzram_layout.attr & LOAD_MASK;
assert((bl2_load == TOP_LOAD) || (bl2_load == BOT_LOAD));
bl30_load = (bl2_load == TOP_LOAD) ? BOT_LOAD : TOP_LOAD;
+ SET_PARAM_HEAD(&bl30_image_info, PARAM_IMAGE_BINARY, VERSION_1, 0);
+
/* Load the BL3-0 image */
- bl30_base = load_image(tmp_tzram_layout, BL30_IMAGE_NAME,
- bl30_load, BL30_BASE);
-
- if (bl30_base != 0) {
- image_len = image_size(BL30_IMAGE_NAME);
- INFO("BL2: BL3-0 loaded at 0x%lx, len=%d (0x%x)\n\r", bl30_base,
- image_len, image_len);
- flush_dcache_range(bl30_base, image_len);
- ret = scp_bootloader_transfer((void *)bl30_base, image_len);
+ e = load_image(&tmp_tzram_layout,
+ BL30_IMAGE_NAME,
+ bl30_load,
+ BL30_BASE,
+ &bl30_image_info,
+ &bl30_ep);
+
+ /* Panic if it has not been possible to load BL3-0 */
+ if (e) {
+ ERROR("Failed to load BL3-0 image.\n");
+ panic();
}
+ bl30_base = bl30_image_info.image_base;
+ bl30_size = bl30_image_info.image_size;
+ assert(bl30_base != 0);
+ assert(bl30_size != 0);
+
+ INFO("BL2: BL3-0 loaded at 0x%lx, len=%d (0x%x)\n\r", bl30_base,
+ bl30_size, bl30_size);
+ flush_dcache_range(bl30_base, bl30_size);
+ ret = scp_bootloader_transfer((void *)bl30_base, bl30_size);
+
if (ret == 0)
INFO("BL2: BL3-0 loaded and transferred to SCP\n\r");
else