[PATCH v2 6/9] qemu-arm: Get bloblist from boot arguments

Raymond Mao raymond.mao at linaro.org
Thu Dec 21 01:40:25 CET 2023


Add platform 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 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.

 board/emulation/qemu-arm/qemu-arm.c | 33 +++++++++++++++++++++++++++++
 configs/qemu_arm64_defconfig        |  3 +++
 2 files changed, 36 insertions(+)

diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
index 942f1fff57..20801d0750 100644
--- a/board/emulation/qemu-arm/qemu-arm.c
+++ b/board/emulation/qemu-arm/qemu-arm.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <bloblist.h>
 #include <cpu_func.h>
 #include <dm.h>
 #include <efi.h>
@@ -102,6 +103,9 @@ static struct mm_region qemu_arm64_mem_map[] = {
 struct mm_region *mem_map = qemu_arm64_mem_map;
 #endif
 
+/* Boot parameters saved from start.S */
+extern unsigned long saved_args[];
+
 int board_init(void)
 {
 	return 0;
@@ -144,6 +148,35 @@ void *board_fdt_blob_setup(int *err)
 	return (void *)CFG_SYS_SDRAM_BASE;
 }
 
+int board_bloblist_from_boot_arg(unsigned long addr, unsigned long size)
+{
+	int ret = -ENOENT;
+	unsigned long reg_fdt;
+	unsigned long reg_zero;
+
+	if (!IS_ENABLED(CONFIG_OF_BOARD) || !IS_ENABLED(CONFIG_BLOBLIST))
+		return -ENOENT;
+
+	ret = bloblist_check(saved_args[3], size);
+	if (ret)
+		return ret;
+
+	if (IS_ENABLED(CONFIG_ARM64)) {
+		reg_fdt = saved_args[0];
+		reg_zero = saved_args[2];
+	} else {
+		reg_fdt = saved_args[2];
+		reg_zero = saved_args[0];
+	}
+	/* Check the register conventions */
+	ret = bloblist_check_reg_conv(reg_fdt, reg_zero);
+	if (!ret)
+		/* Relocate the bloblist to the fixed address */
+		bloblist_reloc((void *)addr, 0);
+
+	return ret;
+}
+
 void enable_caches(void)
 {
 	 icache_enable();
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