xref: /rk3399_ARM-atf/plat/arm/board/juno/juno_bl2_setup.c (revision c948f77136c42a92d0bb660543a3600c36dcf7f1)
1 /*
2  * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <assert.h>
8 
9 #include <common/bl_common.h>
10 #include <common/desc_image_load.h>
11 
12 #include <plat_arm.h>
13 
14 #if JUNO_AARCH32_EL3_RUNTIME
15 /*******************************************************************************
16  * This function changes the spsr for BL32 image to bypass
17  * the check in BL1 AArch64 exception handler. This is needed in the aarch32
18  * boot flow as the core comes up in aarch64 and to enter the BL32 image a warm
19  * reset in aarch32 state is required.
20  ******************************************************************************/
21 int arm_bl2_plat_handle_post_image_load(unsigned int image_id)
22 {
23 	int err = arm_bl2_handle_post_image_load(image_id);
24 
25 	if (!err && (image_id == BL32_IMAGE_ID)) {
26 		bl_mem_params_node_t *bl_mem_params = get_bl_mem_params_node(image_id);
27 		assert(bl_mem_params);
28 		bl_mem_params->ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX,
29 			DISABLE_ALL_EXCEPTIONS);
30 	}
31 
32 	return err;
33 }
34 #endif /* JUNO_AARCH32_EL3_RUNTIME */
35