plat_bl2_mem_params_desc.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*
  2. * Copyright (c) 2023-2024, STMicroelectronics - All Rights Reserved
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <common/bl_common.h>
  7. #include <common/desc_image_load.h>
  8. #include <plat/common/platform.h>
  9. #include <platform_def.h>
  10. #if STM32MP_BL33_EL1
  11. #define BL33_MODE MODE_EL1
  12. #else
  13. #define BL33_MODE MODE_EL2
  14. #endif
  15. /*******************************************************************************
  16. * Following descriptor provides BL image/ep information that gets used
  17. * by BL2 to load the images and also subset of this information is
  18. * passed to next BL image. The image loading sequence is managed by
  19. * populating the images in required loading order. The image execution
  20. * sequence is managed by populating the `next_handoff_image_id` with
  21. * the next executable image id.
  22. ******************************************************************************/
  23. static bl_mem_params_node_t bl2_mem_params_descs[] = {
  24. #if STM32MP_DDR_FIP_IO_STORAGE
  25. /* Fill FW_DDR related information if it exists */
  26. {
  27. .image_id = DDR_FW_ID,
  28. SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
  29. VERSION_2, entry_point_info_t,
  30. SECURE | NON_EXECUTABLE),
  31. SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
  32. VERSION_2, image_info_t,
  33. 0),
  34. .image_info.image_base = STM32MP_DDR_FW_BASE,
  35. .image_info.image_max_size = STM32MP_DDR_FW_MAX_SIZE,
  36. .next_handoff_image_id = INVALID_IMAGE_ID,
  37. },
  38. #endif
  39. /* Fill FW_CONFIG related information if it exists */
  40. {
  41. .image_id = FW_CONFIG_ID,
  42. SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
  43. VERSION_2, entry_point_info_t,
  44. SECURE | NON_EXECUTABLE),
  45. SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
  46. VERSION_2, image_info_t,
  47. IMAGE_ATTRIB_PLAT_SETUP),
  48. .image_info.image_base = STM32MP_FW_CONFIG_BASE,
  49. .image_info.image_max_size = STM32MP_FW_CONFIG_MAX_SIZE,
  50. .next_handoff_image_id = INVALID_IMAGE_ID,
  51. },
  52. /* Fill BL31 related information */
  53. {
  54. .image_id = BL31_IMAGE_ID,
  55. SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
  56. VERSION_2, entry_point_info_t,
  57. SECURE | EXECUTABLE | EP_FIRST_EXE),
  58. .ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS),
  59. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  60. VERSION_2, image_info_t,
  61. IMAGE_ATTRIB_SKIP_LOADING),
  62. .next_handoff_image_id = BL32_IMAGE_ID,
  63. },
  64. /* Fill SoC FW config related information */
  65. {
  66. .image_id = SOC_FW_CONFIG_ID,
  67. SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
  68. VERSION_2, entry_point_info_t,
  69. SECURE | NON_EXECUTABLE),
  70. SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
  71. VERSION_2, image_info_t,
  72. IMAGE_ATTRIB_SKIP_LOADING),
  73. .next_handoff_image_id = INVALID_IMAGE_ID,
  74. },
  75. /* Fill BL32 related information */
  76. {
  77. .image_id = BL32_IMAGE_ID,
  78. SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
  79. VERSION_2, entry_point_info_t,
  80. SECURE | EXECUTABLE),
  81. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  82. VERSION_2, image_info_t,
  83. IMAGE_ATTRIB_SKIP_LOADING),
  84. .next_handoff_image_id = BL33_IMAGE_ID,
  85. },
  86. /* Fill BL32 external 1 image related information */
  87. {
  88. .image_id = BL32_EXTRA1_IMAGE_ID,
  89. SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
  90. VERSION_2, entry_point_info_t,
  91. SECURE | NON_EXECUTABLE),
  92. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  93. VERSION_2, image_info_t,
  94. IMAGE_ATTRIB_SKIP_LOADING),
  95. .next_handoff_image_id = INVALID_IMAGE_ID,
  96. },
  97. /* Fill HW_CONFIG related information if it exists */
  98. {
  99. .image_id = HW_CONFIG_ID,
  100. SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
  101. VERSION_2, entry_point_info_t,
  102. NON_SECURE | NON_EXECUTABLE),
  103. SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
  104. VERSION_2, image_info_t,
  105. IMAGE_ATTRIB_SKIP_LOADING),
  106. .next_handoff_image_id = INVALID_IMAGE_ID,
  107. },
  108. /* Fill BL33 related information */
  109. {
  110. .image_id = BL33_IMAGE_ID,
  111. SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
  112. VERSION_2, entry_point_info_t,
  113. NON_SECURE | EXECUTABLE),
  114. .ep_info.spsr = SPSR_64(BL33_MODE, MODE_SP_ELX, DISABLE_ALL_EXCEPTIONS),
  115. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  116. VERSION_2, image_info_t,
  117. IMAGE_ATTRIB_SKIP_LOADING),
  118. .next_handoff_image_id = INVALID_IMAGE_ID,
  119. }
  120. };
  121. REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs)