1 /*
2  * Copyright (c) 2016-2021, 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 	/* Fill BL32 external 2 image related information */
72 	{
73 		.image_id = BL32_EXTRA2_IMAGE_ID,
74 
75 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
76 				      VERSION_2, entry_point_info_t,
77 				      SECURE | NON_EXECUTABLE),
78 
79 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
80 				      VERSION_2, image_info_t,
81 				      IMAGE_ATTRIB_SKIP_LOADING),
82 
83 		.next_handoff_image_id = INVALID_IMAGE_ID,
84 	},
85 
86 	/* Fill HW_CONFIG related information if it exists */
87 	{
88 		.image_id = HW_CONFIG_ID,
89 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
90 				      VERSION_2, entry_point_info_t,
91 				      NON_SECURE | NON_EXECUTABLE),
92 		SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
93 				      VERSION_2, image_info_t,
94 				      IMAGE_ATTRIB_SKIP_LOADING),
95 
96 		.next_handoff_image_id = INVALID_IMAGE_ID,
97 	},
98 
99 	/* Fill TOS_FW_CONFIG related information if it exists */
100 	{
101 		.image_id = TOS_FW_CONFIG_ID,
102 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
103 				      VERSION_2, entry_point_info_t,
104 				      SECURE | NON_EXECUTABLE),
105 		SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
106 				      VERSION_2, image_info_t,
107 				      IMAGE_ATTRIB_SKIP_LOADING),
108 
109 		.next_handoff_image_id = INVALID_IMAGE_ID,
110 	},
111 
112 	/* Fill BL33 related information */
113 	{
114 		.image_id = BL33_IMAGE_ID,
115 
116 		SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
117 				      VERSION_2, entry_point_info_t,
118 				      NON_SECURE | EXECUTABLE),
119 
120 		.ep_info.spsr = SPSR_MODE32(MODE32_svc, SPSR_T_ARM,
121 					    SPSR_E_LITTLE,
122 					    DISABLE_ALL_EXCEPTIONS),
123 
124 		SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
125 				      VERSION_2, image_info_t,
126 				      IMAGE_ATTRIB_SKIP_LOADING),
127 
128 		.next_handoff_image_id = INVALID_IMAGE_ID,
129 	}
130 };
131 
132 REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs)
133