blob: 09ad4683f09d4f29e41e7fdafafcc2e27c5c4e8e [file] [log] [blame]
Yatharth Kochar9003fa02015-10-14 15:27:24 +01001/*
Antonio Nino Diaz0b326282017-02-16 16:17:19 +00002 * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
Yatharth Kochar9003fa02015-10-14 15:27:24 +01003 *
dp-arm82cb2c12017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Yatharth Kochar9003fa02015-10-14 15:27:24 +01005 */
6
7#include <arch.h>
8#include <arch_helpers.h>
9#include <assert.h>
10#include <auth_mod.h>
Yatharth Kochar9003fa02015-10-14 15:27:24 +010011#include <bl1.h>
Isla Mitchell2a4b4b72017-07-11 14:54:08 +010012#include <bl_common.h>
Antonio Nino Diaz0b326282017-02-16 16:17:19 +000013#include <console.h>
Yatharth Kochar9003fa02015-10-14 15:27:24 +010014#include <debug.h>
15#include <platform.h>
16#include <platform_def.h>
17#include <stdint.h>
18
19/*******************************************************************************
20 * This function is responsible to:
21 * Load SCP_BL2U if platform has defined SCP_BL2U_BASE
22 * Perform platform setup.
23 * Go back to EL3.
24 ******************************************************************************/
25void bl2u_main(void)
26{
27 NOTICE("BL2U: %s\n", version_string);
28 NOTICE("BL2U: %s\n", build_message);
29
30#if SCP_BL2U_BASE
31 int rc;
32 /* Load the subsequent bootloader images */
33 rc = bl2u_plat_handle_scp_bl2u();
34 if (rc) {
35 ERROR("Failed to load SCP_BL2U (%i)\n", rc);
36 panic();
37 }
38#endif
39
40 /* Perform platform setup in BL2U after loading SCP_BL2U */
41 bl2u_platform_setup();
42
Antonio Nino Diaz0b326282017-02-16 16:17:19 +000043 console_flush();
44
Yatharth Kochar1bd61d02016-11-22 11:06:03 +000045#ifdef AARCH32
46 /*
47 * For AArch32 state BL1 and BL2U share the MMU setup.
48 * Given that BL2U does not map BL1 regions, MMU needs
49 * to be disabled in order to go back to BL1.
50 */
51 disable_mmu_icache_secure();
52#endif /* AARCH32 */
53
Yatharth Kochar9003fa02015-10-14 15:27:24 +010054 /*
55 * Indicate that BL2U is done and resume back to
56 * normal world via an SMC to BL1.
57 * x1 could be passed to Normal world,
58 * so DO NOT pass any secret information.
59 */
60 smc(FWU_SMC_SEC_IMAGE_DONE, 0, 0, 0, 0, 0, 0, 0);
61 wfi();
62}