rpi3_bl2_mem_params_desc.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. /* Fill BL31 related information */
  20. {
  21. .image_id = BL31_IMAGE_ID,
  22. SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
  23. VERSION_2, entry_point_info_t,
  24. SECURE | EXECUTABLE | EP_FIRST_EXE),
  25. .ep_info.pc = BL31_BASE,
  26. .ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX,
  27. DISABLE_ALL_EXCEPTIONS),
  28. #if DEBUG
  29. .ep_info.args.arg1 = RPI3_BL31_PLAT_PARAM_VAL,
  30. #endif
  31. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  32. VERSION_2, image_info_t,
  33. IMAGE_ATTRIB_PLAT_SETUP),
  34. .image_info.image_base = BL31_BASE,
  35. .image_info.image_max_size = BL31_LIMIT - BL31_BASE,
  36. # ifdef BL32_BASE
  37. .next_handoff_image_id = BL32_IMAGE_ID,
  38. # else
  39. .next_handoff_image_id = BL33_IMAGE_ID,
  40. # endif
  41. },
  42. # ifdef BL32_BASE
  43. /* Fill BL32 related information */
  44. {
  45. .image_id = BL32_IMAGE_ID,
  46. SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
  47. VERSION_2, entry_point_info_t,
  48. SECURE | EXECUTABLE),
  49. .ep_info.pc = BL32_BASE,
  50. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  51. VERSION_2, image_info_t, 0),
  52. .image_info.image_base = BL32_BASE,
  53. .image_info.image_max_size = BL32_LIMIT - BL32_BASE,
  54. .next_handoff_image_id = BL33_IMAGE_ID,
  55. },
  56. /*
  57. * Fill BL32 external 1 related information.
  58. * A typical use for extra1 image is with OP-TEE where it is the pager
  59. * image.
  60. */
  61. {
  62. .image_id = BL32_EXTRA1_IMAGE_ID,
  63. SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
  64. VERSION_2, entry_point_info_t,
  65. SECURE | NON_EXECUTABLE),
  66. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  67. VERSION_2, image_info_t,
  68. IMAGE_ATTRIB_SKIP_LOADING),
  69. .image_info.image_base = BL32_BASE,
  70. .image_info.image_max_size = BL32_LIMIT - BL32_BASE,
  71. .next_handoff_image_id = INVALID_IMAGE_ID,
  72. },
  73. /*
  74. * Fill BL32 external 2 related information.
  75. * A typical use for extra2 image is with OP-TEE where it is the paged
  76. * image.
  77. */
  78. {
  79. .image_id = BL32_EXTRA2_IMAGE_ID,
  80. SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
  81. VERSION_2, entry_point_info_t,
  82. SECURE | NON_EXECUTABLE),
  83. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  84. VERSION_2, image_info_t,
  85. IMAGE_ATTRIB_SKIP_LOADING),
  86. #ifdef SPD_opteed
  87. .image_info.image_base = RPI3_OPTEE_PAGEABLE_LOAD_BASE,
  88. .image_info.image_max_size = RPI3_OPTEE_PAGEABLE_LOAD_SIZE,
  89. #endif
  90. .next_handoff_image_id = INVALID_IMAGE_ID,
  91. },
  92. # endif /* BL32_BASE */
  93. /* Fill BL33 related information */
  94. {
  95. .image_id = BL33_IMAGE_ID,
  96. SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
  97. VERSION_2, entry_point_info_t,
  98. NON_SECURE | EXECUTABLE),
  99. # ifdef PRELOADED_BL33_BASE
  100. .ep_info.pc = PRELOADED_BL33_BASE,
  101. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  102. VERSION_2, image_info_t,
  103. IMAGE_ATTRIB_SKIP_LOADING),
  104. # else
  105. .ep_info.pc = PLAT_RPI3_NS_IMAGE_OFFSET,
  106. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  107. VERSION_2, image_info_t, 0),
  108. .image_info.image_base = PLAT_RPI3_NS_IMAGE_OFFSET,
  109. .image_info.image_max_size = PLAT_RPI3_NS_IMAGE_MAX_SIZE,
  110. # endif /* PRELOADED_BL33_BASE */
  111. .next_handoff_image_id = INVALID_IMAGE_ID,
  112. }
  113. };
  114. REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs)