[PATCH v4 6/9] arm: Get bloblist from boot arguments
Raymond Mao
raymond.mao at linaro.org
Tue Jan 2 23:12:31 CET 2024
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.
Add bloblist related options into qemu-arm default config.
Signed-off-by: Raymond Mao <raymond.mao at linaro.org>
---
Changes in v2
- Remove low level code for copying boot arguments.
- Refactor board_fdt_blob_setup() and remove direct access of gd->bloblist.
Changes in v3
- Optimize board_bloblist_from_boot_arg().
Changes in v4
- Move the function as an Arm-arch library instead of a board-specific one.
arch/arm/lib/xferlist.c | 38 ++++++++++++++++++++++++++++++++++++
configs/qemu_arm64_defconfig | 3 +++
3 files changed, 45 insertions(+)
create mode 100644 arch/arm/lib/xferlist.c
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index b1bcd37466..0023c55d0d 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -85,6 +85,10 @@ obj-y += psci-dt.o
obj-$(CONFIG_DEBUG_LL) += debug.o
+ifdef CONFIG_BLOBLIST
+obj-$(CONFIG_OF_BOARD) += xferlist.o
+endif
+
# 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
index 0000000000..163d20c11c
--- /dev/null
+++ b/arch/arm/lib/xferlist.c
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2023 Linaro Limited
+ * Author: Raymond Mao <raymond.mao at linaro.org>
+ */
+#include <linux/types.h>
+#include <errno.h>
+#include <bloblist.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[];
+
+int xferlist_from_boot_arg(ulong addr, ulong size)
+{
+ int ret = -ENOENT;
+
+ if (!IS_ENABLED(CONFIG_OF_BOARD) || !IS_ENABLED(CONFIG_BLOBLIST))
+ return -ENOENT;
+
+ ret = bloblist_check(saved_args[3], size);
+ if (ret)
+ return ret;
+
+ /* Check the register conventions */
+ ret = bloblist_check_reg_conv(saved_args[0], saved_args[2],
+ saved_args[1]);
+ if (!ret)
+ /* Relocate the bloblist to the fixed address */
+ ret = bloblist_reloc((void *)addr, size);
+
+ return ret;
+}
diff --git a/configs/qemu_arm64_defconfig b/configs/qemu_arm64_defconfig
index c010c25a92..418f48001c 100644
--- a/configs/qemu_arm64_defconfig
+++ b/configs/qemu_arm64_defconfig
@@ -69,3 +69,6 @@ CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_PCI=y
CONFIG_SEMIHOSTING=y
CONFIG_TPM=y
+CONFIG_BLOBLIST=y
+CONFIG_BLOBLIST_ADDR=0x40004000
+CONFIG_BLOBLIST_SIZE=0x4000
--
2.25.1
More information about the U-Boot
mailing list