arm_bl2_mem_params_desc.c 7.1 KB

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