Hi Raymond, On Fri, Dec 22, 2023 at 9:32 PM Raymond Mao <raymond....@linaro.org> wrote: > > 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....@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(). > > board/emulation/qemu-arm/qemu-arm.c | 30 +++++++++++++++++++++++++++++ > configs/qemu_arm64_defconfig | 3 +++ > 2 files changed, 33 insertions(+) > > diff --git a/board/emulation/qemu-arm/qemu-arm.c > b/board/emulation/qemu-arm/qemu-arm.c > index 942f1fff57..e225011bf0 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,15 @@ static struct mm_region qemu_arm64_mem_map[] = { > struct mm_region *mem_map = qemu_arm64_mem_map; > #endif > > +/* > + * 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 board_init(void) > { > return 0; > @@ -144,6 +154,26 @@ 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; > + > + if (!IS_ENABLED(CONFIG_OF_BOARD) || !IS_ENABLED(CONFIG_BLOBLIST)) > + return -ENOENT; > + > + ret = bloblist_check(saved_args[3], size); > + if (ret) > + return ret;
What about saved_args[1] ? > + > + /* Check the register conventions */ > + ret = bloblist_check_reg_conv(saved_args[0], saved_args[2]); > + if (!ret) > + /* Relocate the bloblist to the fixed address */ > + ret = bloblist_reloc((void *)addr, CONFIG_BLOBLIST_SIZE); > + > + return ret; > +} > + This should be a generic function, e.g. in arch/arm > 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 > Regards, Simon