1 /*
2  * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <arch.h>
8 #include <arch_helpers.h>
9 #include "../bl1_private.h"
10 
11 /*******************************************************************************
12  * Function that does the first bit of architectural setup that affects
13  * execution in the non-secure address space.
14  ******************************************************************************/
bl1_arch_setup(void)15 void bl1_arch_setup(void)
16 {
17 	/* Set the next EL to be AArch64 */
18 	write_scr_el3(read_scr_el3() | SCR_RW_BIT);
19 }
20 
21 /*******************************************************************************
22  * Set the Secure EL1 required architectural state
23  ******************************************************************************/
bl1_arch_next_el_setup(void)24 void bl1_arch_next_el_setup(void)
25 {
26 	u_register_t next_sctlr;
27 
28 	/* Use the same endianness than the current BL */
29 	next_sctlr = (read_sctlr_el3() & SCTLR_EE_BIT);
30 
31 	/* Set SCTLR Secure EL1 */
32 	next_sctlr |= SCTLR_EL1_RES1;
33 
34 	write_sctlr_el1(next_sctlr);
35 }
36