xref: /rk3399_ARM-atf/plat/arm/board/tc/tc_bl2_setup.c (revision 1727d690d29ef604f1fcf183e35c06d33d974e63)
1 /*
2  * Copyright (c) 2021-2025, 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  ******************************************************************************/
19 struct bl_params *plat_get_next_bl_params(void)
20 {
21 	struct bl_params *arm_bl_params;
22 	bl_mem_params_node_t *param_node;
23 	const struct dyn_cfg_dtb_info_t *fw_config_info __maybe_unused;
24 	uintptr_t fw_config_base __maybe_unused;
25 	entry_point_info_t *ep_info __maybe_unused;
26 
27 	arm_bl_params = arm_get_next_bl_params();
28 
29 	/* Get BL31 image node */
30 	param_node = get_bl_mem_params_node(BL31_IMAGE_ID);
31 	assert(param_node != NULL);
32 #if TRANSFER_LIST
33 	assert(arm_bl_params != NULL);
34 
35 	arm_bl_params->head = &param_node->params_node_mem;
36 	arm_bl_params->head->ep_info = &param_node->ep_info;
37 	arm_bl_params->head->image_id = param_node->image_id;
38 
39 	arm_bl2_setup_next_ep_info(param_node);
40 #else
41 	/* Get fw_config load address */
42 	fw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, FW_CONFIG_ID);
43 	assert(fw_config_info != NULL);
44 
45 	fw_config_base = fw_config_info->config_addr;
46 	assert(fw_config_base != 0U);
47 
48 	/*
49 	 * Get the entry point info of BL31 image and override
50 	 * arg1 of entry point info with fw_config base address
51 	 */
52 	ep_info = &param_node->ep_info;
53 	ep_info->args.arg1 = (uint32_t)fw_config_base;
54 #endif /* TRANSFER_LIST */
55 
56 	return arm_bl_params;
57 }
58