1 /*
2  * Copyright (c) 2021, ARM Limited. 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 #include <lib/fconf/fconf.h>
12 #include <lib/fconf/fconf_dyn_cfg_getter.h>
13 
14 #include <plat/arm/common/plat_arm.h>
15 
16 /*******************************************************************************
17  * This function returns the list of executable images
18  ******************************************************************************/
plat_get_next_bl_params(void)19 struct bl_params *plat_get_next_bl_params(void)
20 {
21 	struct bl_params *arm_bl_params = arm_get_next_bl_params();
22 
23 	const struct dyn_cfg_dtb_info_t *fw_config_info;
24 	bl_mem_params_node_t *param_node;
25 	uintptr_t fw_config_base = 0U;
26 	entry_point_info_t *ep_info;
27 
28 	/* Get BL31 image node */
29 	param_node = get_bl_mem_params_node(BL31_IMAGE_ID);
30 	assert(param_node != NULL);
31 
32 	/* Get fw_config load address */
33 	fw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, FW_CONFIG_ID);
34 	assert(fw_config_info != NULL);
35 
36 	fw_config_base = fw_config_info->config_addr;
37 	assert(fw_config_base != 0U);
38 
39 	/*
40 	 * Get the entry point info of BL31 image and override
41 	 * arg1 of entry point info with fw_config base address
42 	 */
43 	ep_info = &param_node->ep_info;
44 	ep_info->args.arg1 = (uint32_t)fw_config_base;
45 
46 	return arm_bl_params;
47 }
48