hikey960_bl2_mem_params_desc.c 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /*
  2. * Copyright (c) 2016-2022, 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. #include <plat/common/platform.h>
  10. /*******************************************************************************
  11. * Following descriptor provides BL image/ep information that gets used
  12. * by BL2 to load the images and also subset of this information is
  13. * passed to next BL image. The image loading sequence is managed by
  14. * populating the images in required loading order. The image execution
  15. * sequence is managed by populating the `next_handoff_image_id` with
  16. * the next executable image id.
  17. ******************************************************************************/
  18. static bl_mem_params_node_t bl2_mem_params_descs[] = {
  19. #ifdef SCP_BL2_BASE
  20. /* Fill SCP_BL2 related information if it exists */
  21. {
  22. .image_id = SCP_BL2_IMAGE_ID,
  23. SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
  24. VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE),
  25. SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
  26. VERSION_2, image_info_t, IMAGE_ATTRIB_PLAT_SETUP),
  27. .image_info.image_base = SCP_BL2_BASE,
  28. .image_info.image_max_size = SCP_BL2_SIZE,
  29. .next_handoff_image_id = INVALID_IMAGE_ID,
  30. },
  31. #endif /* SCP_BL2_BASE */
  32. #ifdef EL3_PAYLOAD_BASE
  33. /* Fill EL3 payload related information (BL31 is EL3 payload)*/
  34. {
  35. .image_id = BL31_IMAGE_ID,
  36. SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
  37. VERSION_2, entry_point_info_t,
  38. SECURE | EXECUTABLE | EP_FIRST_EXE),
  39. .ep_info.pc = EL3_PAYLOAD_BASE,
  40. .ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX,
  41. DISABLE_ALL_EXCEPTIONS),
  42. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  43. VERSION_2, image_info_t,
  44. IMAGE_ATTRIB_PLAT_SETUP | IMAGE_ATTRIB_SKIP_LOADING),
  45. .next_handoff_image_id = INVALID_IMAGE_ID,
  46. },
  47. #else /* EL3_PAYLOAD_BASE */
  48. /* Fill BL31 related information */
  49. {
  50. .image_id = BL31_IMAGE_ID,
  51. SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
  52. VERSION_2, entry_point_info_t,
  53. SECURE | EXECUTABLE | EP_FIRST_EXE),
  54. .ep_info.pc = BL31_BASE,
  55. .ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX,
  56. DISABLE_ALL_EXCEPTIONS),
  57. #if DEBUG
  58. .ep_info.args.arg1 = HIKEY960_BL31_PLAT_PARAM_VAL,
  59. #endif
  60. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  61. VERSION_2, image_info_t, IMAGE_ATTRIB_PLAT_SETUP),
  62. .image_info.image_base = BL31_BASE,
  63. .image_info.image_max_size = BL31_LIMIT - BL31_BASE,
  64. # ifdef BL32_BASE
  65. .next_handoff_image_id = BL32_IMAGE_ID,
  66. # else
  67. .next_handoff_image_id = BL33_IMAGE_ID,
  68. # endif
  69. },
  70. # ifdef BL32_BASE
  71. /* Fill BL32 related information */
  72. {
  73. .image_id = BL32_IMAGE_ID,
  74. SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
  75. VERSION_2, entry_point_info_t, SECURE | EXECUTABLE),
  76. .ep_info.pc = BL32_BASE,
  77. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  78. VERSION_2, image_info_t, 0),
  79. .image_info.image_base = BL32_BASE,
  80. .image_info.image_max_size = BL32_LIMIT - BL32_BASE,
  81. .next_handoff_image_id = BL33_IMAGE_ID,
  82. },
  83. /*
  84. * Fill BL32 external 1 related information.
  85. * A typical use for extra1 image is with OP-TEE where it is the pager
  86. * image.
  87. */
  88. {
  89. .image_id = BL32_EXTRA1_IMAGE_ID,
  90. SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
  91. VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE),
  92. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  93. VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING),
  94. .image_info.image_base = BL32_BASE,
  95. .image_info.image_max_size = BL32_LIMIT - BL32_BASE,
  96. .next_handoff_image_id = INVALID_IMAGE_ID,
  97. },
  98. /*
  99. * Fill BL32 external 2 related information.
  100. * A typical use for extra2 image is with OP-TEE where it is the paged
  101. * image.
  102. */
  103. {
  104. .image_id = BL32_EXTRA2_IMAGE_ID,
  105. SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
  106. VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE),
  107. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  108. VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING),
  109. #ifdef SPD_opteed
  110. .image_info.image_base = HIKEY960_OPTEE_PAGEABLE_LOAD_BASE,
  111. .image_info.image_max_size = HIKEY960_OPTEE_PAGEABLE_LOAD_SIZE,
  112. #endif
  113. .next_handoff_image_id = INVALID_IMAGE_ID,
  114. },
  115. #ifdef SPD_spmd
  116. /* Fill TOS_FW_CONFIG related information */
  117. {
  118. .image_id = TOS_FW_CONFIG_ID,
  119. SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
  120. VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE),
  121. SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
  122. VERSION_2, image_info_t, 0),
  123. .image_info.image_base = DDR_SEC_CONFIG_BASE,
  124. .image_info.image_max_size = DDR_SEC_CONFIG_SIZE,
  125. .next_handoff_image_id = INVALID_IMAGE_ID,
  126. },
  127. #endif
  128. # endif /* BL32_BASE */
  129. /* Fill BL33 related information */
  130. {
  131. .image_id = BL33_IMAGE_ID,
  132. SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
  133. VERSION_2, entry_point_info_t, NON_SECURE | EXECUTABLE),
  134. # ifdef PRELOADED_BL33_BASE
  135. .ep_info.pc = PRELOADED_BL33_BASE,
  136. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  137. VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING),
  138. # else
  139. .ep_info.pc = NS_BL1U_BASE,
  140. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  141. VERSION_2, image_info_t, 0),
  142. .image_info.image_base = NS_BL1U_BASE,
  143. .image_info.image_max_size = 0x200000 /* 2MB */,
  144. # endif /* PRELOADED_BL33_BASE */
  145. .next_handoff_image_id = INVALID_IMAGE_ID,
  146. }
  147. #endif /* EL3_PAYLOAD_BASE */
  148. };
  149. REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs)