• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /*
12  * FIXME: This address should come from firmware before TF-A runs
13  * Having this to make sure the transfer list functionality works
14  */
15 #define FW_HANDOFF_BASE		U(0x1200000)
16 #define FW_HANDOFF_SIZE		U(0x600000)
17 
18 static struct transfer_list_header *tl_hdr;
19 
transfer_list_populate_ep_info(entry_point_info_t * bl32,entry_point_info_t * bl33)20 int32_t transfer_list_populate_ep_info(entry_point_info_t *bl32,
21 				       entry_point_info_t *bl33)
22 {
23 	struct transfer_list_entry *te = NULL;
24 	struct entry_point_info *ep;
25 	int32_t ret;
26 
27 	tl_hdr = (struct transfer_list_header *)FW_HANDOFF_BASE;
28 	ret = transfer_list_check_header(tl_hdr);
29 	if ((ret == TL_OPS_ALL) || (ret == TL_OPS_RO)) {
30 		transfer_list_dump(tl_hdr);
31 		while ((te = transfer_list_next(tl_hdr, te)) != NULL) {
32 			ep = transfer_list_entry_data(te);
33 			if (te->tag_id == TL_TAG_EXEC_EP_INFO64) {
34 				switch (GET_SECURITY_STATE(ep->h.attr)) {
35 				case NON_SECURE:
36 					*bl33 = *ep;
37 					continue;
38 				case SECURE:
39 					*bl32 = *ep;
40 					continue;
41 				default:
42 					ERROR("Unrecognized Image Security State %lu\n",
43 					      GET_SECURITY_STATE(ep->h.attr));
44 					ret = TL_OPS_NON;
45 				}
46 			}
47 		}
48 	}
49 	return ret;
50 }
51