]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: Get bloblist from boot arguments
authorRaymond Mao <raymond.mao@linaro.org>
Sat, 3 Feb 2024 16:36:25 +0000 (08:36 -0800)
committerTom Rini <trini@konsulko.com>
Thu, 29 Feb 2024 14:24:22 +0000 (09:24 -0500)
Add arch custom function to get bloblist from boot arguments.
Check whether boot arguments aligns with the register conventions
defined in FW Handoff spec v0.9.

Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
arch/arm/lib/Makefile
arch/arm/lib/xferlist.c [new file with mode: 0644]
arch/arm/lib/xferlist.h [new file with mode: 0644]

index b1bcd3746625a53b66c41ff98fec3c41e4027244..67275fba616e3ab7116745387b9be4ae954a8bf1 100644 (file)
@@ -85,6 +85,8 @@ obj-y += psci-dt.o
 
 obj-$(CONFIG_DEBUG_LL) += debug.o
 
+obj-$(CONFIG_BLOBLIST)  += xferlist.o
+
 # For EABI conformant tool chains, provide eabi_compat()
 ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
 extra-y        += eabi_compat.o
diff --git a/arch/arm/lib/xferlist.c b/arch/arm/lib/xferlist.c
new file mode 100644 (file)
index 0000000..f9c5d88
--- /dev/null
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2023 Linaro Limited
+ * Author: Raymond Mao <raymond.mao@linaro.org>
+ */
+#include <linux/types.h>
+#include <errno.h>
+#include <bloblist.h>
+#include "xferlist.h"
+
+int xferlist_from_boot_arg(ulong addr, ulong size)
+{
+       int ret;
+
+       ret = bloblist_check(saved_args[3], size);
+       if (ret)
+               return ret;
+
+       ret = bloblist_check_reg_conv(saved_args[0], saved_args[2],
+                                     saved_args[1]);
+       if (ret)
+               return ret;
+
+       return bloblist_reloc((void *)addr, size);
+}
diff --git a/arch/arm/lib/xferlist.h b/arch/arm/lib/xferlist.h
new file mode 100644 (file)
index 0000000..60d79c1
--- /dev/null
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0+ BSD-3-Clause */
+/*
+ * Copyright (C) 2023 Linaro Limited
+ * Author: Raymond Mao <raymond.mao@linaro.org>
+ */
+
+#ifndef _XFERLIST_H_
+#define _XFERLIST_H_
+
+/*
+ * Boot parameters saved from start.S
+ * saved_args[0]: FDT base address
+ * saved_args[1]: Bloblist signature
+ * saved_args[2]: must be 0
+ * saved_args[3]: Bloblist base address
+ */
+extern unsigned long saved_args[];
+
+#endif /* _XFERLIST_H_ */