1 /*
2  * Copyright (c) 2019-2020, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <common/bl_common.h>
8 #include <common/desc_image_load.h>
9 #include <plat/common/platform.h>
10 
11 #include <platform_def.h>
12 
13 /*******************************************************************************
14  * Following descriptor provides BL image/ep information that gets used
15  * by BL2 to load the images and also subset of this information is
16  * passed to next BL image. The image loading sequence is managed by
17  * populating the images in required loading order. The image execution
18  * sequence is managed by populating the `next_handoff_image_id` with
19  * the next executable image id.
20  ******************************************************************************/
21 static bl_mem_params_node_t bl2_mem_params_descs[] = {
22 #ifdef SCP_BL2_BASE
23 	/* Fill SCP_BL2 related information if it exists */
24 	{
25 	    .image_id = SCP_BL2_IMAGE_ID,
26 
27 	    SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
28 		    VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE),
29 
30 	    SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
31 		    VERSION_2, image_info_t, 0),
32 	    .image_info.image_base = SCP_BL2_BASE,
33 	    .image_info.image_max_size = PLAT_MAX_SCP_BL2_SIZE,
34 
35 	    .next_handoff_image_id = INVALID_IMAGE_ID,
36 	},
37 #endif /* SCP_BL2_BASE */
38 
39 	/* Fill BL31 related information */
40 	{
41 	    .image_id = BL31_IMAGE_ID,
42 
43 	    SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
44 		    VERSION_2, entry_point_info_t,
45 		    SECURE | EXECUTABLE | EP_FIRST_EXE),
46 	    .ep_info.pc = BL31_BASE,
47 	    .ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX,
48 		    DISABLE_ALL_EXCEPTIONS),
49 #if DEBUG
50 	    .ep_info.args.arg3 = BRCM_BL31_PLAT_PARAM_VAL,
51 #endif
52 
53 	    SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
54 		    VERSION_2, image_info_t, IMAGE_ATTRIB_PLAT_SETUP),
55 	    .image_info.image_base = BL31_BASE,
56 	    .image_info.image_max_size = BL31_LIMIT - BL31_BASE,
57 
58 #ifdef BL32_BASE
59 	    .next_handoff_image_id = BL32_IMAGE_ID,
60 #else
61 	    .next_handoff_image_id = BL33_IMAGE_ID,
62 #endif
63 	},
64 
65 #ifdef BL32_BASE
66 	/* Fill BL32 related information */
67 	{
68 	    .image_id = BL32_IMAGE_ID,
69 
70 	    SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
71 		    VERSION_2, entry_point_info_t, SECURE | EXECUTABLE),
72 	    .ep_info.pc = BL32_BASE,
73 
74 	    SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
75 		    VERSION_2, image_info_t, 0),
76 	    .image_info.image_base = BL32_BASE,
77 	    .image_info.image_max_size = BL32_LIMIT - BL32_BASE,
78 
79 	    .next_handoff_image_id = BL33_IMAGE_ID,
80 	},
81 #endif /* BL32_BASE */
82 
83 	/* Fill BL33 related information */
84 	{
85 	    .image_id = BL33_IMAGE_ID,
86 	    SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
87 		    VERSION_2, entry_point_info_t, NON_SECURE | EXECUTABLE),
88 #ifdef PRELOADED_BL33_BASE
89 	    .ep_info.pc = PRELOADED_BL33_BASE,
90 
91 	    SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
92 		    VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING),
93 #else
94 	    .ep_info.pc = PLAT_BRCM_NS_IMAGE_OFFSET,
95 
96 	    SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
97 		    VERSION_2, image_info_t, 0),
98 	    .image_info.image_base = PLAT_BRCM_NS_IMAGE_OFFSET,
99 	    .image_info.image_max_size = BRCM_DRAM1_SIZE,
100 #endif /* PRELOADED_BL33_BASE */
101 
102 	    .next_handoff_image_id = INVALID_IMAGE_ID,
103 	}
104 };
105 
106 REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs)
107