bl2_plat_mem_params_desc.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * Copyright (c) 2019, ARM Limited and Contributors. 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 <platform_def.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. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  58. VERSION_2, image_info_t, IMAGE_ATTRIB_PLAT_SETUP),
  59. .image_info.image_base = BL31_BASE,
  60. .image_info.image_max_size = BL31_LIMIT - BL31_BASE,
  61. .next_handoff_image_id = BL33_IMAGE_ID,
  62. },
  63. #endif /* EL3_PAYLOAD_BASE */
  64. {
  65. .image_id = BL33_IMAGE_ID,
  66. SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
  67. VERSION_2, entry_point_info_t, NON_SECURE | EXECUTABLE),
  68. .ep_info.pc = PLAT_NS_IMAGE_OFFSET,
  69. SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
  70. VERSION_2, image_info_t, 0),
  71. .image_info.image_base = PLAT_NS_IMAGE_OFFSET,
  72. .image_info.image_max_size =
  73. 0x0 + 0x40000000 - PLAT_NS_IMAGE_OFFSET,
  74. # if ARM_LINUX_KERNEL_AS_BL33 != 0
  75. .next_handoff_image_id = NT_FW_CONFIG_ID,
  76. },
  77. {
  78. .image_id = NT_FW_CONFIG_ID,
  79. SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
  80. VERSION_2, entry_point_info_t,
  81. NON_SECURE | NON_EXECUTABLE),
  82. SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
  83. VERSION_2, image_info_t, 0),
  84. .image_info.image_base = ARM_PRELOADED_DTB_BASE,
  85. .image_info.image_max_size =
  86. 0x0 + 0x40000000 - ARM_PRELOADED_DTB_BASE,
  87. .next_handoff_image_id = INVALID_IMAGE_ID,
  88. },
  89. #else
  90. .next_handoff_image_id = INVALID_IMAGE_ID,
  91. },
  92. # endif
  93. };
  94. REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs)