plat_xfer_list.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) 2023-2024, Advanced Micro Devices, Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <stddef.h>
  7. #include <arch_helpers.h>
  8. #include <common/debug.h>
  9. #include <lib/transfer_list.h>
  10. /*
  11. * FIXME: This address should come from firmware before TF-A runs
  12. * Having this to make sure the transfer list functionality works
  13. */
  14. #define FW_HANDOFF_BASE U(0x1200000)
  15. #define FW_HANDOFF_SIZE U(0x600000)
  16. static struct transfer_list_header *tl_hdr;
  17. int32_t transfer_list_populate_ep_info(entry_point_info_t *bl32,
  18. entry_point_info_t *bl33)
  19. {
  20. struct transfer_list_entry *te = NULL;
  21. struct entry_point_info *ep;
  22. int32_t ret;
  23. tl_hdr = (struct transfer_list_header *)FW_HANDOFF_BASE;
  24. ret = transfer_list_check_header(tl_hdr);
  25. if ((ret == TL_OPS_ALL) || (ret == TL_OPS_RO)) {
  26. transfer_list_dump(tl_hdr);
  27. while ((te = transfer_list_next(tl_hdr, te)) != NULL) {
  28. ep = transfer_list_entry_data(te);
  29. if (te->tag_id == TL_TAG_EXEC_EP_INFO64) {
  30. switch (GET_SECURITY_STATE(ep->h.attr)) {
  31. case NON_SECURE:
  32. *bl33 = *ep;
  33. continue;
  34. case SECURE:
  35. *bl32 = *ep;
  36. continue;
  37. default:
  38. ERROR("Unrecognized Image Security State %lu\n",
  39. GET_SECURITY_STATE(ep->h.attr));
  40. ret = TL_OPS_NON;
  41. }
  42. }
  43. }
  44. }
  45. return ret;
  46. }