1 /*
2  * Copyright (c) 2016-2022, 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 	/* Fill FW_CONFIG related information if it exists */
23 	{
24 		.image_id = FW_CONFIG_ID,
25 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
26 				      VERSION_2, entry_point_info_t,
27 				      SECURE | NON_EXECUTABLE),
28 		SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
29 				      VERSION_2, image_info_t,
30 				      IMAGE_ATTRIB_PLAT_SETUP),
31 
32 		.image_info.image_base = STM32MP_FW_CONFIG_BASE,
33 		.image_info.image_max_size = STM32MP_FW_CONFIG_MAX_SIZE,
34 
35 		.next_handoff_image_id = INVALID_IMAGE_ID,
36 	},
37 
38 	/* Fill BL32 related information */
39 	{
40 		.image_id = BL32_IMAGE_ID,
41 
42 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
43 				      VERSION_2, entry_point_info_t,
44 				      SECURE | EXECUTABLE | EP_FIRST_EXE),
45 
46 		.ep_info.spsr = SPSR_MODE32(MODE32_svc, SPSR_T_ARM,
47 					    SPSR_E_LITTLE,
48 					    DISABLE_ALL_EXCEPTIONS),
49 
50 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
51 				      VERSION_2, image_info_t,
52 				      IMAGE_ATTRIB_SKIP_LOADING),
53 
54 		.next_handoff_image_id = BL33_IMAGE_ID,
55 	},
56 
57 	/* Fill BL32 external 1 image related information */
58 	{
59 		.image_id = BL32_EXTRA1_IMAGE_ID,
60 
61 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
62 				      VERSION_2, entry_point_info_t,
63 				      SECURE | NON_EXECUTABLE),
64 
65 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
66 				      VERSION_2, image_info_t,
67 				      IMAGE_ATTRIB_SKIP_LOADING),
68 
69 		.next_handoff_image_id = INVALID_IMAGE_ID,
70 	},
71 #if STM32MP15
72 	/* Fill BL32 external 2 image related information */
73 	{
74 		.image_id = BL32_EXTRA2_IMAGE_ID,
75 
76 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
77 				      VERSION_2, entry_point_info_t,
78 				      SECURE | NON_EXECUTABLE),
79 
80 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
81 				      VERSION_2, image_info_t,
82 				      IMAGE_ATTRIB_SKIP_LOADING),
83 
84 		.next_handoff_image_id = INVALID_IMAGE_ID,
85 	},
86 #endif
87 
88 	/* Fill HW_CONFIG related information if it exists */
89 	{
90 		.image_id = HW_CONFIG_ID,
91 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
92 				      VERSION_2, entry_point_info_t,
93 				      NON_SECURE | NON_EXECUTABLE),
94 		SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
95 				      VERSION_2, image_info_t,
96 				      IMAGE_ATTRIB_SKIP_LOADING),
97 
98 		.next_handoff_image_id = INVALID_IMAGE_ID,
99 	},
100 
101 	/* Fill TOS_FW_CONFIG related information if it exists */
102 	{
103 		.image_id = TOS_FW_CONFIG_ID,
104 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
105 				      VERSION_2, entry_point_info_t,
106 				      SECURE | NON_EXECUTABLE),
107 		SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
108 				      VERSION_2, image_info_t,
109 				      IMAGE_ATTRIB_SKIP_LOADING),
110 
111 		.next_handoff_image_id = INVALID_IMAGE_ID,
112 	},
113 
114 	/* Fill BL33 related information */
115 	{
116 		.image_id = BL33_IMAGE_ID,
117 
118 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
119 				      VERSION_2, entry_point_info_t,
120 				      NON_SECURE | EXECUTABLE),
121 
122 		.ep_info.spsr = SPSR_MODE32(MODE32_svc, SPSR_T_ARM,
123 					    SPSR_E_LITTLE,
124 					    DISABLE_ALL_EXCEPTIONS),
125 
126 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
127 				      VERSION_2, image_info_t,
128 				      IMAGE_ATTRIB_SKIP_LOADING),
129 
130 		.next_handoff_image_id = INVALID_IMAGE_ID,
131 	}
132 };
133 
134 REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs)
135