bl2_plat_mem_params_desc.c 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /*
  2. * Copyright (c) 2016-2017, 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, 0),
  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 = POPLAR_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 = POPLAR_OPTEE_PAGEABLE_LOAD_BASE,
  111. .image_info.image_max_size = POPLAR_OPTEE_PAGEABLE_LOAD_SIZE,
  112. #endif
  113. .next_handoff_image_id = INVALID_IMAGE_ID,
  114. },
  115. # endif /* BL32_BASE */
  116. /* Fill BL33 related information */
  117. {
  118. .image_id = BL33_IMAGE_ID,
  119. SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
  120. VERSION_2, entry_point_info_t, NON_SECURE | EXECUTABLE),
  121. # ifdef PRELOADED_BL33_BASE
  122. .ep_info.pc = PRELOADED_BL33_BASE,
  123. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  124. VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING),
  125. # else
  126. .ep_info.pc = PLAT_POPLAR_NS_IMAGE_OFFSET,
  127. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  128. VERSION_2, image_info_t, 0),
  129. .image_info.image_base = PLAT_POPLAR_NS_IMAGE_OFFSET,
  130. .image_info.image_max_size = DDR_BASE + DDR_SIZE -
  131. PLAT_POPLAR_NS_IMAGE_OFFSET,
  132. # endif /* PRELOADED_BL33_BASE */
  133. .next_handoff_image_id = INVALID_IMAGE_ID,
  134. }
  135. #endif /* EL3_PAYLOAD_BASE */
  136. };
  137. REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs)