blob: 849acd6c98944e9c0b04340034554eb968626484 [file] [log] [blame]
Yatharth Kocharede39cb2016-11-14 12:01:04 +00001/*
Mikael Olsson0232da22021-02-12 17:30:16 +01002 * Copyright (c) 2016-2017,2021, ARM Limited and Contributors. All rights reserved.
Yatharth Kocharede39cb2016-11-14 12:01:04 +00003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Yatharth Kocharede39cb2016-11-14 12:01:04 +00005 */
6
7#include <assert.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00008
9#include <common/bl_common.h>
10#include <common/desc_image_load.h>
Mikael Olsson0232da22021-02-12 17:30:16 +010011#include <lib/fconf/fconf.h>
12#include <lib/fconf/fconf_dyn_cfg_getter.h>
13
Antonio Nino Diazbd7b7402019-01-25 14:30:04 +000014#include <plat/arm/common/plat_arm.h>
Yatharth Kocharede39cb2016-11-14 12:01:04 +000015
16#if JUNO_AARCH32_EL3_RUNTIME
17/*******************************************************************************
18 * This function changes the spsr for BL32 image to bypass
19 * the check in BL1 AArch64 exception handler. This is needed in the aarch32
20 * boot flow as the core comes up in aarch64 and to enter the BL32 image a warm
21 * reset in aarch32 state is required.
22 ******************************************************************************/
Daniel Boulby07d26872018-06-27 16:45:48 +010023int arm_bl2_plat_handle_post_image_load(unsigned int image_id)
Yatharth Kocharede39cb2016-11-14 12:01:04 +000024{
25 int err = arm_bl2_handle_post_image_load(image_id);
26
27 if (!err && (image_id == BL32_IMAGE_ID)) {
28 bl_mem_params_node_t *bl_mem_params = get_bl_mem_params_node(image_id);
29 assert(bl_mem_params);
30 bl_mem_params->ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX,
31 DISABLE_ALL_EXCEPTIONS);
32 }
33
34 return err;
35}
Mikael Olsson0232da22021-02-12 17:30:16 +010036
37#else
38
39/*******************************************************************************
40 * This function returns the list of executable images
41 ******************************************************************************/
42struct bl_params *plat_get_next_bl_params(void)
43{
44 struct bl_params *arm_bl_params = arm_get_next_bl_params();
45
46#if __aarch64__
47 const struct dyn_cfg_dtb_info_t *fw_config_info;
48 bl_mem_params_node_t *param_node;
49 uintptr_t fw_config_base = 0U;
50 entry_point_info_t *ep_info;
51
52 /* Get BL31 image node */
53 param_node = get_bl_mem_params_node(BL31_IMAGE_ID);
54 assert(param_node != NULL);
55
56 /* Get fw_config load address */
57 fw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, FW_CONFIG_ID);
58 assert(fw_config_info != NULL);
59
60 fw_config_base = fw_config_info->config_addr;
61 assert(fw_config_base != 0U);
62
63 /*
64 * Get the entry point info of BL31 image and override
65 * arg1 of entry point info with fw_config base address
66 */
67 ep_info = &param_node->ep_info;
68 ep_info->args.arg1 = (uint32_t)fw_config_base;
69#endif /* __aarch64__ */
70
71 return arm_bl_params;
72}
Yatharth Kocharede39cb2016-11-14 12:01:04 +000073#endif /* JUNO_AARCH32_EL3_RUNTIME */