14f6ad66aSAchin Gupta /* 20b32628eSAntonio Nino Diaz * Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved. 34f6ad66aSAchin Gupta * 4*82cb2c1aSdp-arm * SPDX-License-Identifier: BSD-3-Clause 54f6ad66aSAchin Gupta */ 64f6ad66aSAchin Gupta 74f6ad66aSAchin Gupta #include <arch_helpers.h> 81779ba6bSJuan Castillo #include <auth_mod.h> 948bfb88eSYatharth Kochar #include <bl1.h> 104f6ad66aSAchin Gupta #include <bl_common.h> 110b32628eSAntonio Nino Diaz #include <console.h> 1235e98e55SDan Handley #include <debug.h> 1397043ac9SDan Handley #include <platform.h> 145b827a8fSDan Handley #include "bl2_private.h" 154f6ad66aSAchin Gupta 1693d81d64SSandrine Bailleux 1793d81d64SSandrine Bailleux /******************************************************************************* 1893d81d64SSandrine Bailleux * The only thing to do in BL2 is to load further images and pass control to 1942019bf4SYatharth Kochar * next BL. The memory occupied by BL2 will be reclaimed by BL3x stages. BL2 2042019bf4SYatharth Kochar * runs entirely in S-EL1. 2193d81d64SSandrine Bailleux ******************************************************************************/ 2293d81d64SSandrine Bailleux void bl2_main(void) 2393d81d64SSandrine Bailleux { 2442019bf4SYatharth Kochar entry_point_info_t *next_bl_ep_info; 2593d81d64SSandrine Bailleux 266ad2e461SDan Handley NOTICE("BL2: %s\n", version_string); 276ad2e461SDan Handley NOTICE("BL2: %s\n", build_message); 286ad2e461SDan Handley 2993d81d64SSandrine Bailleux /* Perform remaining generic architectural setup in S-EL1 */ 3093d81d64SSandrine Bailleux bl2_arch_setup(); 3193d81d64SSandrine Bailleux 32dec840afSJuan Castillo #if TRUSTED_BOARD_BOOT 33dec840afSJuan Castillo /* Initialize authentication module */ 341779ba6bSJuan Castillo auth_mod_init(); 35dec840afSJuan Castillo #endif /* TRUSTED_BOARD_BOOT */ 36dec840afSJuan Castillo 3742019bf4SYatharth Kochar /* Load the subsequent bootloader images. */ 3842019bf4SYatharth Kochar next_bl_ep_info = bl2_load_images(); 39ef538c6fSJuan Castillo 40d48c12e9SYatharth Kochar #ifdef AARCH32 41d48c12e9SYatharth Kochar /* 42d48c12e9SYatharth Kochar * For AArch32 state BL1 and BL2 share the MMU setup. 43d48c12e9SYatharth Kochar * Given that BL2 does not map BL1 regions, MMU needs 44d48c12e9SYatharth Kochar * to be disabled in order to go back to BL1. 45d48c12e9SYatharth Kochar */ 46d48c12e9SYatharth Kochar disable_mmu_icache_secure(); 47d48c12e9SYatharth Kochar #endif /* AARCH32 */ 48d48c12e9SYatharth Kochar 490b32628eSAntonio Nino Diaz console_flush(); 500b32628eSAntonio Nino Diaz 5193d81d64SSandrine Bailleux /* 5242019bf4SYatharth Kochar * Run next BL image via an SMC to BL1. Information on how to pass 5342019bf4SYatharth Kochar * control to the BL32 (if present) and BL33 software images will 5442019bf4SYatharth Kochar * be passed to next BL image as an argument. 5593d81d64SSandrine Bailleux */ 5642019bf4SYatharth Kochar smc(BL1_SMC_RUN_IMAGE, (unsigned long)next_bl_ep_info, 0, 0, 0, 0, 0, 0); 574f6ad66aSAchin Gupta } 58