xref: /rk3399_ARM-atf/plat/arm/board/fvp/fvp_bl2_setup.c (revision 0aa9f3c0f2f2ff675c3c12ae5ac6ceb475d6a16f)
1 /*
2  * Copyright (c) 2013-2020, 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/desc_image_load.h>
10 #include <drivers/arm/sp804_delay_timer.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 #include <plat/common/platform.h>
16 #include <platform_def.h>
17 
18 #include "fvp_private.h"
19 
20 void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3)
21 {
22 	arm_bl2_early_platform_setup((uintptr_t)arg0, (meminfo_t *)arg1);
23 
24 	/* Initialize the platform config for future decision making */
25 	fvp_config_setup();
26 }
27 
28 void bl2_platform_setup(void)
29 {
30 	arm_bl2_platform_setup();
31 
32 	/* Initialize System level generic or SP804 timer */
33 	fvp_timer_init();
34 }
35 
36 /*******************************************************************************
37  * This function returns the list of executable images
38  ******************************************************************************/
39 struct bl_params *plat_get_next_bl_params(void)
40 {
41 	struct bl_params *arm_bl_params;
42 
43 	arm_bl_params = arm_get_next_bl_params();
44 
45 #if __aarch64__ && !BL2_AT_EL3
46 	const struct dyn_cfg_dtb_info_t *fw_config_info;
47 	bl_mem_params_node_t *param_node;
48 	uintptr_t fw_config_base = 0U;
49 	entry_point_info_t *ep_info;
50 
51 	/* Get BL31 image node */
52 	param_node = get_bl_mem_params_node(BL31_IMAGE_ID);
53 	assert(param_node != NULL);
54 
55 	/* get fw_config load address */
56 	fw_config_info = FCONF_GET_PROPERTY(dyn_cfg, dtb, FW_CONFIG_ID);
57 	assert(fw_config_info != NULL);
58 
59 	fw_config_base = fw_config_info->config_addr;
60 	assert(fw_config_base != 0U);
61 
62 	/*
63 	 * Get the entry point info of BL31 image and override
64 	 * arg1 of entry point info with fw_config base address
65 	 */
66 	ep_info = &param_node->ep_info;
67 	ep_info->args.arg1 = (uint32_t)fw_config_base;
68 #endif /* __aarch64__ && !BL2_AT_EL3 */
69 
70 	return arm_bl_params;
71 }
72