Yatharth Kochar | b1c2fe0 | 2015-10-14 15:27:24 +0100 | [diff] [blame] | 1 | /* |
Roberto Vargas | 0571270 | 2018-02-12 12:36:17 +0000 | [diff] [blame] | 2 | * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. |
Yatharth Kochar | b1c2fe0 | 2015-10-14 15:27:24 +0100 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Yatharth Kochar | b1c2fe0 | 2015-10-14 15:27:24 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <arch.h> |
| 8 | #include <arch_helpers.h> |
| 9 | #include <assert.h> |
| 10 | #include <auth_mod.h> |
Yatharth Kochar | b1c2fe0 | 2015-10-14 15:27:24 +0100 | [diff] [blame] | 11 | #include <bl1.h> |
Roberto Vargas | 0571270 | 2018-02-12 12:36:17 +0000 | [diff] [blame] | 12 | #include <bl2u.h> |
Isla Mitchell | 9930501 | 2017-07-11 14:54:08 +0100 | [diff] [blame] | 13 | #include <bl_common.h> |
Antonio Nino Diaz | e3962d0 | 2017-02-16 16:17:19 +0000 | [diff] [blame] | 14 | #include <console.h> |
Yatharth Kochar | b1c2fe0 | 2015-10-14 15:27:24 +0100 | [diff] [blame] | 15 | #include <debug.h> |
| 16 | #include <platform.h> |
| 17 | #include <platform_def.h> |
| 18 | #include <stdint.h> |
| 19 | |
Roberto Vargas | 64d4de0 | 2018-05-24 13:34:53 +0100 | [diff] [blame] | 20 | |
Yatharth Kochar | b1c2fe0 | 2015-10-14 15:27:24 +0100 | [diff] [blame] | 21 | /******************************************************************************* |
| 22 | * This function is responsible to: |
| 23 | * Load SCP_BL2U if platform has defined SCP_BL2U_BASE |
| 24 | * Perform platform setup. |
| 25 | * Go back to EL3. |
| 26 | ******************************************************************************/ |
| 27 | void bl2u_main(void) |
| 28 | { |
| 29 | NOTICE("BL2U: %s\n", version_string); |
| 30 | NOTICE("BL2U: %s\n", build_message); |
| 31 | |
| 32 | #if SCP_BL2U_BASE |
| 33 | int rc; |
| 34 | /* Load the subsequent bootloader images */ |
| 35 | rc = bl2u_plat_handle_scp_bl2u(); |
| 36 | if (rc) { |
| 37 | ERROR("Failed to load SCP_BL2U (%i)\n", rc); |
| 38 | panic(); |
| 39 | } |
| 40 | #endif |
| 41 | |
| 42 | /* Perform platform setup in BL2U after loading SCP_BL2U */ |
| 43 | bl2u_platform_setup(); |
| 44 | |
Antonio Nino Diaz | e3962d0 | 2017-02-16 16:17:19 +0000 | [diff] [blame] | 45 | console_flush(); |
| 46 | |
Yatharth Kochar | 18dfb30 | 2016-11-22 11:06:03 +0000 | [diff] [blame] | 47 | #ifdef AARCH32 |
| 48 | /* |
| 49 | * For AArch32 state BL1 and BL2U share the MMU setup. |
| 50 | * Given that BL2U does not map BL1 regions, MMU needs |
| 51 | * to be disabled in order to go back to BL1. |
| 52 | */ |
| 53 | disable_mmu_icache_secure(); |
| 54 | #endif /* AARCH32 */ |
| 55 | |
Yatharth Kochar | b1c2fe0 | 2015-10-14 15:27:24 +0100 | [diff] [blame] | 56 | /* |
| 57 | * Indicate that BL2U is done and resume back to |
| 58 | * normal world via an SMC to BL1. |
| 59 | * x1 could be passed to Normal world, |
| 60 | * so DO NOT pass any secret information. |
| 61 | */ |
| 62 | smc(FWU_SMC_SEC_IMAGE_DONE, 0, 0, 0, 0, 0, 0, 0); |
| 63 | wfi(); |
| 64 | } |