1 /* 2 * Copyright (c) 2016-2023, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <platform_def.h> 8 9 #include <common/bl_common.h> 10 #include <common/desc_image_load.h> 11 12 /******************************************************************************* 13 * Following descriptor provides BL image/ep information that gets used 14 * by BL2 to load the images and also subset of this information is 15 * passed to next BL image. The image loading sequence is managed by 16 * populating the images in required loading order. The image execution 17 * sequence is managed by populating the `next_handoff_image_id` with 18 * the next executable image id. 19 ******************************************************************************/ 20 static bl_mem_params_node_t bl2_mem_params_descs[] = { 21 #ifdef SCP_BL2_BASE 22 /* Fill SCP_BL2 related information if it exists */ 23 { 24 .image_id = SCP_BL2_IMAGE_ID, 25 26 SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY, 27 VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE), 28 29 SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY, 30 VERSION_2, image_info_t, 0), 31 .image_info.image_base = SCP_BL2_BASE, 32 .image_info.image_max_size = PLAT_CSS_MAX_SCP_BL2_SIZE, 33 34 .next_handoff_image_id = INVALID_IMAGE_ID, 35 }, 36 #endif /* SCP_BL2_BASE */ 37 38 #ifdef EL3_PAYLOAD_BASE 39 /* Fill EL3 payload related information (BL31 is EL3 payload)*/ 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 = EL3_PAYLOAD_BASE, 47 .ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX, 48 DISABLE_ALL_EXCEPTIONS), 49 50 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, 51 VERSION_2, image_info_t, 52 IMAGE_ATTRIB_PLAT_SETUP | IMAGE_ATTRIB_SKIP_LOADING), 53 54 .next_handoff_image_id = INVALID_IMAGE_ID, 55 }, 56 57 #else /* EL3_PAYLOAD_BASE */ 58 59 /* Fill BL31 related information */ 60 { 61 .image_id = BL31_IMAGE_ID, 62 63 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, 64 VERSION_2, entry_point_info_t, 65 SECURE | EXECUTABLE | EP_FIRST_EXE), 66 .ep_info.pc = BL31_BASE, 67 .ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX, 68 DISABLE_ALL_EXCEPTIONS), 69 #if DEBUG 70 .ep_info.args.arg3 = ARM_BL31_PLAT_PARAM_VAL, 71 #endif 72 73 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, 74 VERSION_2, image_info_t, IMAGE_ATTRIB_PLAT_SETUP), 75 .image_info.image_base = BL31_BASE, 76 .image_info.image_max_size = BL31_LIMIT - BL31_BASE, 77 78 # if defined(BL32_BASE) 79 .next_handoff_image_id = BL32_IMAGE_ID, 80 # elif ENABLE_RME 81 .next_handoff_image_id = RMM_IMAGE_ID, 82 # else 83 .next_handoff_image_id = BL33_IMAGE_ID, 84 # endif 85 }, 86 /* Fill HW_CONFIG related information */ 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, IMAGE_ATTRIB_SKIP_LOADING), 94 .next_handoff_image_id = INVALID_IMAGE_ID, 95 }, 96 /* Fill SOC_FW_CONFIG related information */ 97 { 98 .image_id = SOC_FW_CONFIG_ID, 99 SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY, 100 VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE), 101 SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY, 102 VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING), 103 .next_handoff_image_id = INVALID_IMAGE_ID, 104 }, 105 106 # if ENABLE_RME 107 /* Fill RMM related information */ 108 { 109 .image_id = RMM_IMAGE_ID, 110 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, 111 VERSION_2, entry_point_info_t, EP_REALM | EXECUTABLE), 112 .ep_info.pc = RMM_BASE, 113 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, 114 VERSION_2, image_info_t, 0), 115 .image_info.image_base = RMM_BASE, 116 .image_info.image_max_size = RMM_LIMIT - RMM_BASE, 117 .next_handoff_image_id = BL33_IMAGE_ID, 118 }, 119 # endif 120 121 # ifdef BL32_BASE 122 /* Fill BL32 related information */ 123 { 124 .image_id = BL32_IMAGE_ID, 125 126 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, 127 VERSION_2, entry_point_info_t, SECURE | EXECUTABLE), 128 .ep_info.pc = BL32_BASE, 129 130 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, 131 VERSION_2, image_info_t, 0), 132 .image_info.image_base = BL32_BASE, 133 .image_info.image_max_size = BL32_LIMIT - BL32_BASE, 134 135 # if ENABLE_RME 136 .next_handoff_image_id = RMM_IMAGE_ID, 137 # else 138 .next_handoff_image_id = BL33_IMAGE_ID, 139 # endif 140 }, 141 142 /* 143 * Fill BL32 external 1 related information. 144 * A typical use for extra1 image is with OP-TEE where it is the pager 145 * image. 146 */ 147 { 148 .image_id = BL32_EXTRA1_IMAGE_ID, 149 150 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, 151 VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE), 152 153 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, 154 VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING), 155 .image_info.image_base = BL32_BASE, 156 .image_info.image_max_size = BL32_LIMIT - BL32_BASE, 157 158 .next_handoff_image_id = INVALID_IMAGE_ID, 159 }, 160 161 /* 162 * Fill BL32 external 2 related information. 163 * A typical use for extra2 image is with OP-TEE where it is the paged 164 * image. 165 */ 166 { 167 .image_id = BL32_EXTRA2_IMAGE_ID, 168 169 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, 170 VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE), 171 172 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, 173 VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING), 174 #ifdef SPD_opteed 175 .image_info.image_base = ARM_OPTEE_PAGEABLE_LOAD_BASE, 176 .image_info.image_max_size = ARM_OPTEE_PAGEABLE_LOAD_SIZE, 177 #endif 178 .next_handoff_image_id = INVALID_IMAGE_ID, 179 }, 180 181 /* Fill TOS_FW_CONFIG related information */ 182 { 183 .image_id = TOS_FW_CONFIG_ID, 184 SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY, 185 VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE), 186 SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY, 187 VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING), 188 .next_handoff_image_id = INVALID_IMAGE_ID, 189 }, 190 # endif /* BL32_BASE */ 191 192 /* Fill BL33 related information */ 193 { 194 .image_id = BL33_IMAGE_ID, 195 SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, 196 VERSION_2, entry_point_info_t, NON_SECURE | EXECUTABLE), 197 # ifdef PRELOADED_BL33_BASE 198 .ep_info.pc = PRELOADED_BL33_BASE, 199 200 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, 201 VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING), 202 # else 203 .ep_info.pc = PLAT_ARM_NS_IMAGE_BASE, 204 205 SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, 206 VERSION_2, image_info_t, 0), 207 .image_info.image_base = PLAT_ARM_NS_IMAGE_BASE, 208 .image_info.image_max_size = ARM_DRAM1_BASE + ARM_DRAM1_SIZE 209 - PLAT_ARM_NS_IMAGE_BASE, 210 # endif /* PRELOADED_BL33_BASE */ 211 212 .next_handoff_image_id = INVALID_IMAGE_ID, 213 }, 214 /* Fill NT_FW_CONFIG related information */ 215 { 216 .image_id = NT_FW_CONFIG_ID, 217 SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY, 218 VERSION_2, entry_point_info_t, 219 NON_SECURE | NON_EXECUTABLE), 220 SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY, 221 VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING), 222 .next_handoff_image_id = INVALID_IMAGE_ID, 223 }, 224 #endif /* EL3_PAYLOAD_BASE */ 225 226 # if ETHOSN_NPU_TZMP1 227 { 228 .image_id = ETHOSN_NPU_FW_IMAGE_ID, 229 SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY, 230 VERSION_2, image_info_t, 0), 231 .image_info.image_base = ETHOSN_NPU_FW_IMAGE_BASE, 232 .image_info.image_max_size = ETHOSN_NPU_FW_IMAGE_LIMIT - 233 ETHOSN_NPU_FW_IMAGE_BASE, 234 .next_handoff_image_id = INVALID_IMAGE_ID, 235 }, 236 #endif /* ETHOSN_NPU_TZMP1 */ 237 }; 238 239 REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs) 240