feat(arm): add ep_info handoff args setter

Add support for project specific APIs and re-introduce API for setting
TF-A `entry_point_info` arguments following the Arm register convention.

Change-Id: Ic40ef6d34771fe54b152312779620f22bc106640
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
diff --git a/src/arm/ep_info.c b/src/arm/ep_info.c
new file mode 100644
index 0000000..f6b26be
--- /dev/null
+++ b/src/arm/ep_info.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright The Transfer List Library Contributors
+ *
+ * SPDX-License-Identifier: MIT OR GPL-2.0-or-later
+ */
+
+#include <ep_info.h>
+#include <stddef.h>
+#include <transfer_list.h>
+
+/**
+ * Set handoff arguments in the entry point info structure.
+ *
+ * This function populates the provided entry point info structure with data
+ * from the transfer list.
+ *
+ * @param[in] tl        Pointer to the transfer list.
+ * @param[out] ep_info  Pointer to the entry point info structure to populate.
+ *
+ * @return Pointer to the populated entry point info structure.
+ */
+struct entry_point_info *
+transfer_list_set_handoff_args(struct transfer_list_header *tl,
+			       struct entry_point_info *ep_info)
+{
+	struct transfer_list_entry *te = NULL;
+	void *dt = NULL;
+
+	if (!ep_info || !tl || transfer_list_check_header(tl) == TL_OPS_NON) {
+		return NULL;
+	}
+
+	te = transfer_list_find(tl, TL_TAG_FDT);
+	dt = transfer_list_entry_data(te);
+
+#ifdef __aarch64__
+	if (GET_SPSR_RW(ep_info->spsr) == 0U) {
+		ep_info->args.arg0 = (uintptr_t)dt;
+		ep_info->args.arg1 = TRANSFER_LIST_HANDOFF_X1_VALUE(
+			REGISTER_CONVENTION_VERSION);
+		ep_info->args.arg2 = 0;
+	} else
+#endif
+	{
+		ep_info->args.arg0 = 0;
+		ep_info->args.arg1 = TRANSFER_LIST_HANDOFF_R1_VALUE(
+			REGISTER_CONVENTION_VERSION);
+		ep_info->args.arg2 = (uintptr_t)dt;
+	}
+
+	ep_info->args.arg3 = (uintptr_t)tl;
+
+	return ep_info;
+}
diff --git a/src/transfer_list.c b/src/generic/transfer_list.c
similarity index 99%
rename from src/transfer_list.c
rename to src/generic/transfer_list.c
index 2aa584c..2e681dc 100644
--- a/src/transfer_list.c
+++ b/src/generic/transfer_list.c
@@ -47,7 +47,7 @@
 		printf("hdr_size   0x%x\n", te->hdr_size);
 		printf("data_size  0x%x\n", te->data_size);
 		printf("data_addr  0x%lx\n",
-		     (unsigned long)transfer_list_entry_data(te));
+		       (unsigned long)transfer_list_entry_data(te));
 	}
 }