@@ -21,3 +21,26 @@ int xferlist_from_boot_arg(ulong *addr)
return 0;
}
+
+int xferlist_to_boot_arg(ulong *args)
+{
+ ulong fdt, sig, xlist;
+ int ret;
+
+ ret = bloblist_get_reg_conv(&fdt, &sig, &xlist);
+ if (ret)
+ return ret;
+
+ if (IS_ENABLED(CONFIG_ARM64)) {
+ args[0] = fdt;
+ args[1] = sig;
+ args[2] = 0;
+ } else {
+ args[0] = 0;
+ args[1] = sig;
+ args[2] = fdt;
+ }
+ args[3] = xlist;
+
+ return 0;
+}
@@ -578,6 +578,14 @@ int __weak xferlist_from_boot_arg(ulong __always_unused *addr)
return -ENOENT;
}
+/*
+ * Weak default function for passing the bloblist in the boot args.
+ */
+int __weak xferlist_to_boot_arg(ulong __always_unused *args)
+{
+ return -ENOSYS;
+}
+
bool bloblist_exists(void)
{
int ret;
@@ -560,4 +560,15 @@ int bloblist_get_reg_conv(ulong *rfdt, ulong *rsig, ulong *xlist);
*/
int xferlist_from_boot_arg(ulong *addr);
+/**
+ * xferlist_to_boot_arg() - Get the boot args for passing on the bloblist
+ *
+ * Fills in the arguments for the first four registers of the next stage
+ * according to the register conventions of the Firmware Handoff spec.
+ *
+ * @args: Returns the four register values, in register order
+ * Return: 0 if OK, -ENOSYS if not supported, else on error
+ */
+int xferlist_to_boot_arg(ulong *args);
+
#endif /* __BLOBLIST_H */
Add xferlist_to_boot_arg() to fill in the arguments for the first four registers of the next stage, so that the bloblist can be passed on with the register conventions of the Firmware Handoff spec. It is the counterpart of xferlist_from_boot_arg(). Add a weak default in common/bloblist.c, which returns -ENOSYS, and the ARM version in arch/arm/lib/xferlist.c, so that other architectures can add their own later. The ARM version uses the AArch64 or AArch32 register layout from the spec. Signed-off-by: David Lechner <dlechner@baylibre.com> --- arch/arm/lib/xferlist.c | 23 +++++++++++++++++++++++ common/bloblist.c | 8 ++++++++ include/bloblist.h | 11 +++++++++++ 3 files changed, 42 insertions(+)