blob: 97e1b871dfcd1b874b478488c2ac32cbc2fdc85f [file] [log] [blame]
Harrison Mutaie0bc2c82025-05-08 15:36:08 +00001/*
2 * Copyright The Transfer List Library Contributors
3 *
4 * SPDX-License-Identifier: MIT OR GPL-2.0-or-later
5 */
6
7#include <ep_info.h>
8#include <stddef.h>
9#include <transfer_list.h>
10
Harrison Mutaie0bc2c82025-05-08 15:36:08 +000011struct entry_point_info *
12transfer_list_set_handoff_args(struct transfer_list_header *tl,
13 struct entry_point_info *ep_info)
14{
15 struct transfer_list_entry *te = NULL;
16 void *dt = NULL;
17
18 if (!ep_info || !tl || transfer_list_check_header(tl) == TL_OPS_NON) {
19 return NULL;
20 }
21
22 te = transfer_list_find(tl, TL_TAG_FDT);
23 dt = transfer_list_entry_data(te);
24
25#ifdef __aarch64__
26 if (GET_SPSR_RW(ep_info->spsr) == 0U) {
27 ep_info->args.arg0 = (uintptr_t)dt;
28 ep_info->args.arg1 = TRANSFER_LIST_HANDOFF_X1_VALUE(
29 REGISTER_CONVENTION_VERSION);
30 ep_info->args.arg2 = 0;
31 } else
32#endif
33 {
34 ep_info->args.arg0 = 0;
35 ep_info->args.arg1 = TRANSFER_LIST_HANDOFF_R1_VALUE(
36 REGISTER_CONVENTION_VERSION);
37 ep_info->args.arg2 = (uintptr_t)dt;
38 }
39
40 ep_info->args.arg3 = (uintptr_t)tl;
41
42 return ep_info;
43}