Yatharth Kochar | f9a0f16 | 2016-09-13 17:07:57 +0100 | [diff] [blame] | 1 | /* |
Soby Mathew | 96a1c6b | 2018-01-15 14:45:33 +0000 | [diff] [blame] | 2 | * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved. |
Yatharth Kochar | f9a0f16 | 2016-09-13 17:07:57 +0100 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Yatharth Kochar | f9a0f16 | 2016-09-13 17:07:57 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
Yatharth Kochar | f9a0f16 | 2016-09-13 17:07:57 +0100 | [diff] [blame] | 7 | #include <platform_def.h> |
| 8 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 9 | #include <common/bl_common.h> |
| 10 | #include <common/desc_image_load.h> |
| 11 | #include <plat/common/platform.h> |
Yatharth Kochar | f9a0f16 | 2016-09-13 17:07:57 +0100 | [diff] [blame] | 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_CSS_MAX_SCP_BL2_SIZE, |
| 34 | |
| 35 | .next_handoff_image_id = INVALID_IMAGE_ID, |
| 36 | }, |
| 37 | #endif /* SCP_BL2_BASE */ |
| 38 | |
| 39 | #ifdef EL3_PAYLOAD_BASE |
| 40 | /* Fill EL3 payload related information (BL31 is EL3 payload)*/ |
| 41 | { |
| 42 | .image_id = BL31_IMAGE_ID, |
| 43 | |
| 44 | SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, |
| 45 | VERSION_2, entry_point_info_t, |
| 46 | SECURE | EXECUTABLE | EP_FIRST_EXE), |
| 47 | .ep_info.pc = EL3_PAYLOAD_BASE, |
| 48 | .ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX, |
| 49 | DISABLE_ALL_EXCEPTIONS), |
| 50 | |
| 51 | SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, |
| 52 | VERSION_2, image_info_t, |
| 53 | IMAGE_ATTRIB_PLAT_SETUP | IMAGE_ATTRIB_SKIP_LOADING), |
| 54 | |
| 55 | .next_handoff_image_id = INVALID_IMAGE_ID, |
| 56 | }, |
| 57 | |
| 58 | #else /* EL3_PAYLOAD_BASE */ |
| 59 | |
| 60 | /* Fill BL31 related information */ |
| 61 | { |
| 62 | .image_id = BL31_IMAGE_ID, |
| 63 | |
| 64 | SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, |
| 65 | VERSION_2, entry_point_info_t, |
| 66 | SECURE | EXECUTABLE | EP_FIRST_EXE), |
| 67 | .ep_info.pc = BL31_BASE, |
| 68 | .ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX, |
| 69 | DISABLE_ALL_EXCEPTIONS), |
| 70 | #if DEBUG |
Soby Mathew | 7d5a2e7 | 2018-01-10 15:59:31 +0000 | [diff] [blame] | 71 | .ep_info.args.arg3 = ARM_BL31_PLAT_PARAM_VAL, |
Yatharth Kochar | f9a0f16 | 2016-09-13 17:07:57 +0100 | [diff] [blame] | 72 | #endif |
| 73 | |
| 74 | SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, |
| 75 | VERSION_2, image_info_t, IMAGE_ATTRIB_PLAT_SETUP), |
| 76 | .image_info.image_base = BL31_BASE, |
| 77 | .image_info.image_max_size = BL31_LIMIT - BL31_BASE, |
| 78 | |
| 79 | # ifdef BL32_BASE |
| 80 | .next_handoff_image_id = BL32_IMAGE_ID, |
| 81 | # else |
| 82 | .next_handoff_image_id = BL33_IMAGE_ID, |
| 83 | # endif |
| 84 | }, |
Soby Mathew | 96a1c6b | 2018-01-15 14:45:33 +0000 | [diff] [blame] | 85 | /* Fill HW_CONFIG related information */ |
| 86 | { |
| 87 | .image_id = HW_CONFIG_ID, |
| 88 | SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY, |
| 89 | VERSION_2, entry_point_info_t, NON_SECURE | NON_EXECUTABLE), |
| 90 | SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY, |
| 91 | VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING), |
| 92 | .next_handoff_image_id = INVALID_IMAGE_ID, |
| 93 | }, |
Soby Mathew | b681484 | 2018-04-04 09:40:32 +0100 | [diff] [blame] | 94 | /* Fill SOC_FW_CONFIG related information */ |
| 95 | { |
| 96 | .image_id = SOC_FW_CONFIG_ID, |
| 97 | SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY, |
| 98 | VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE), |
| 99 | SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY, |
| 100 | VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING), |
| 101 | .next_handoff_image_id = INVALID_IMAGE_ID, |
| 102 | }, |
Yatharth Kochar | f9a0f16 | 2016-09-13 17:07:57 +0100 | [diff] [blame] | 103 | # ifdef BL32_BASE |
| 104 | /* Fill BL32 related information */ |
| 105 | { |
| 106 | .image_id = BL32_IMAGE_ID, |
| 107 | |
| 108 | SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, |
| 109 | VERSION_2, entry_point_info_t, SECURE | EXECUTABLE), |
| 110 | .ep_info.pc = BL32_BASE, |
| 111 | |
| 112 | SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, |
| 113 | VERSION_2, image_info_t, 0), |
| 114 | .image_info.image_base = BL32_BASE, |
| 115 | .image_info.image_max_size = BL32_LIMIT - BL32_BASE, |
| 116 | |
| 117 | .next_handoff_image_id = BL33_IMAGE_ID, |
| 118 | }, |
Summer Qin | 9db8f2e | 2017-04-24 16:49:28 +0100 | [diff] [blame] | 119 | |
| 120 | /* |
| 121 | * Fill BL32 external 1 related information. |
| 122 | * A typical use for extra1 image is with OP-TEE where it is the pager image. |
| 123 | */ |
| 124 | { |
| 125 | .image_id = BL32_EXTRA1_IMAGE_ID, |
| 126 | |
| 127 | SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, |
| 128 | VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE), |
| 129 | |
| 130 | SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, |
| 131 | VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING), |
| 132 | .image_info.image_base = BL32_BASE, |
| 133 | .image_info.image_max_size = BL32_LIMIT - BL32_BASE, |
| 134 | |
| 135 | .next_handoff_image_id = INVALID_IMAGE_ID, |
| 136 | }, |
| 137 | |
| 138 | /* |
| 139 | * Fill BL32 external 2 related information. |
| 140 | * A typical use for extra2 image is with OP-TEE where it is the paged image. |
| 141 | */ |
| 142 | { |
| 143 | .image_id = BL32_EXTRA2_IMAGE_ID, |
| 144 | |
| 145 | SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, |
| 146 | VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE), |
| 147 | |
| 148 | SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, |
| 149 | VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING), |
| 150 | #ifdef SPD_opteed |
| 151 | .image_info.image_base = ARM_OPTEE_PAGEABLE_LOAD_BASE, |
| 152 | .image_info.image_max_size = ARM_OPTEE_PAGEABLE_LOAD_SIZE, |
| 153 | #endif |
| 154 | .next_handoff_image_id = INVALID_IMAGE_ID, |
| 155 | }, |
Soby Mathew | b681484 | 2018-04-04 09:40:32 +0100 | [diff] [blame] | 156 | |
| 157 | /* Fill TOS_FW_CONFIG related information */ |
| 158 | { |
| 159 | .image_id = TOS_FW_CONFIG_ID, |
| 160 | SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY, |
| 161 | VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE), |
| 162 | SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY, |
| 163 | VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING), |
| 164 | .next_handoff_image_id = INVALID_IMAGE_ID, |
| 165 | }, |
Yatharth Kochar | f9a0f16 | 2016-09-13 17:07:57 +0100 | [diff] [blame] | 166 | # endif /* BL32_BASE */ |
| 167 | |
| 168 | /* Fill BL33 related information */ |
| 169 | { |
| 170 | .image_id = BL33_IMAGE_ID, |
| 171 | SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP, |
| 172 | VERSION_2, entry_point_info_t, NON_SECURE | EXECUTABLE), |
| 173 | # ifdef PRELOADED_BL33_BASE |
| 174 | .ep_info.pc = PRELOADED_BL33_BASE, |
| 175 | |
| 176 | SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, |
| 177 | VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING), |
| 178 | # else |
Sandrine Bailleux | afa91db | 2019-01-31 15:01:32 +0100 | [diff] [blame^] | 179 | .ep_info.pc = PLAT_ARM_NS_IMAGE_BASE, |
Yatharth Kochar | f9a0f16 | 2016-09-13 17:07:57 +0100 | [diff] [blame] | 180 | |
| 181 | SET_STATIC_PARAM_HEAD(image_info, PARAM_EP, |
| 182 | VERSION_2, image_info_t, 0), |
Sandrine Bailleux | afa91db | 2019-01-31 15:01:32 +0100 | [diff] [blame^] | 183 | .image_info.image_base = PLAT_ARM_NS_IMAGE_BASE, |
Yatharth Kochar | f9a0f16 | 2016-09-13 17:07:57 +0100 | [diff] [blame] | 184 | .image_info.image_max_size = ARM_DRAM1_SIZE, |
| 185 | # endif /* PRELOADED_BL33_BASE */ |
| 186 | |
| 187 | .next_handoff_image_id = INVALID_IMAGE_ID, |
Soby Mathew | b681484 | 2018-04-04 09:40:32 +0100 | [diff] [blame] | 188 | }, |
| 189 | /* Fill NT_FW_CONFIG related information */ |
| 190 | { |
| 191 | .image_id = NT_FW_CONFIG_ID, |
| 192 | SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY, |
| 193 | VERSION_2, entry_point_info_t, NON_SECURE | NON_EXECUTABLE), |
| 194 | SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY, |
| 195 | VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING), |
| 196 | .next_handoff_image_id = INVALID_IMAGE_ID, |
Yatharth Kochar | f9a0f16 | 2016-09-13 17:07:57 +0100 | [diff] [blame] | 197 | } |
| 198 | #endif /* EL3_PAYLOAD_BASE */ |
| 199 | }; |
| 200 | |
| 201 | REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs) |