Commit 8cbc9b29 authored by Sandrine Bailleux's avatar Sandrine Bailleux
Browse files

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
parent 6257e9d3
...@@ -177,42 +177,55 @@ void bl2_early_platform_setup(meminfo_t *mem_layout) ...@@ -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 * the image into. When this function exits, the RAM layout remains untouched
* so the BL2 can load BL3-1 as normal. * so the BL2 can load BL3-1 as normal.
******************************************************************************/ ******************************************************************************/
/*
* Juno TODO: revisit, it won't compile.
*/
static int load_bl30(void) static int load_bl30(void)
{ {
meminfo_t *bl2_tzram_layout; meminfo_t *bl2_tzram_layout;
meminfo_t tzram_layout; meminfo_t tmp_tzram_layout;
meminfo_t *tmp_tzram_layout = &tzram_layout; uintptr_t bl30_base;
unsigned long bl30_base; uint32_t bl30_size;
unsigned int image_len;
unsigned int bl2_load, bl30_load; 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 */ /* Find out how much free trusted ram remains after BL2 load */
bl2_tzram_layout = bl2_plat_sec_mem_layout(); bl2_tzram_layout = bl2_plat_sec_mem_layout();
/* copy the TZRAM layout and use it */ /* 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 */ /* 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)); assert((bl2_load == TOP_LOAD) || (bl2_load == BOT_LOAD));
bl30_load = (bl2_load == TOP_LOAD) ? BOT_LOAD : TOP_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 */ /* Load the BL3-0 image */
bl30_base = load_image(tmp_tzram_layout, BL30_IMAGE_NAME, e = load_image(&tmp_tzram_layout,
bl30_load, BL30_BASE); BL30_IMAGE_NAME,
bl30_load,
if (bl30_base != 0) { BL30_BASE,
image_len = image_size(BL30_IMAGE_NAME); &bl30_image_info,
INFO("BL2: BL3-0 loaded at 0x%lx, len=%d (0x%x)\n\r", bl30_base, &bl30_ep);
image_len, image_len);
flush_dcache_range(bl30_base, image_len); /* Panic if it has not been possible to load BL3-0 */
ret = scp_bootloader_transfer((void *)bl30_base, image_len); 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) if (ret == 0)
INFO("BL2: BL3-0 loaded and transferred to SCP\n\r"); INFO("BL2: BL3-0 loaded and transferred to SCP\n\r");
else else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment