arm_transfer_list.c 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <plat/arm/common/plat_arm.h>
  7. #include <platform_def.h>
  8. void arm_transfer_list_dyn_cfg_init(struct transfer_list_header *secure_tl)
  9. {
  10. struct transfer_list_entry *te;
  11. bl_mem_params_node_t *next_param_node =
  12. get_bl_mem_params_node(HW_CONFIG_ID);
  13. assert(next_param_node != NULL);
  14. /*
  15. * The HW_CONFIG needs to be authenticated via the normal loading
  16. * mechanism. Pre-allocate a TE for the configuration and update the
  17. * load information so the configuration is loaded directly into the TE.
  18. */
  19. te = transfer_list_add(secure_tl, TL_TAG_FDT, PLAT_ARM_HW_CONFIG_SIZE,
  20. NULL);
  21. assert(te != NULL);
  22. next_param_node->image_info.h.attr &= ~IMAGE_ATTRIB_SKIP_LOADING;
  23. next_param_node->image_info.image_max_size = PLAT_ARM_HW_CONFIG_SIZE;
  24. next_param_node->image_info.image_base =
  25. (uintptr_t)transfer_list_entry_data(te);
  26. }
  27. void arm_transfer_list_populate_ep_info(bl_mem_params_node_t *next_param_node,
  28. struct transfer_list_header *secure_tl)
  29. {
  30. uint32_t next_exe_img_id;
  31. entry_point_info_t *ep;
  32. struct transfer_list_entry *te;
  33. assert(next_param_node != NULL);
  34. while ((next_exe_img_id = next_param_node->next_handoff_image_id) !=
  35. INVALID_IMAGE_ID) {
  36. next_param_node =
  37. &bl_mem_params_desc_ptr[get_bl_params_node_index(
  38. next_exe_img_id)];
  39. assert(next_param_node != NULL);
  40. te = transfer_list_add(secure_tl, TL_TAG_EXEC_EP_INFO64,
  41. sizeof(entry_point_info_t),
  42. &next_param_node->ep_info);
  43. assert(te != NULL);
  44. ep = transfer_list_entry_data(te);
  45. if ((next_exe_img_id == BL32_IMAGE_ID) && SPMC_AT_EL3) {
  46. /*
  47. * Populate the BL32 image base, size and max limit in
  48. * the entry point information, since there is no
  49. * platform function to retrieve them in generic
  50. * code. We choose arg2, arg3 and arg4 since the generic
  51. * code uses arg1 for stashing the SP manifest size. The
  52. * SPMC setup uses these arguments to update SP manifest
  53. * with actual SP's base address and it size.
  54. */
  55. ep->args.arg2 = next_param_node->image_info.image_base;
  56. ep->args.arg3 = next_param_node->image_info.image_size;
  57. ep->args.arg4 =
  58. next_param_node->image_info.image_base +
  59. next_param_node->image_info.image_max_size;
  60. }
  61. next_exe_img_id = next_param_node->next_handoff_image_id;
  62. }
  63. flush_dcache_range((uintptr_t)secure_tl, secure_tl->size);
  64. }