[PATCH 5/5] qemu-arm: get FDT from bloblist

Ilias Apalodimas ilias.apalodimas at linaro.org
Wed Dec 20 14:08:57 CET 2023


On Tue, Dec 19, 2023 at 01:11:12PM -0800, Raymond Mao wrote:
> Get devicetree from a bloblist if it exists.
> If not, fallback to get FDT from the specified memory address.
>
> Signed-off-by: Raymond Mao <raymond.mao at linaro.org>
> ---
>  board/emulation/qemu-arm/qemu-arm.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
> index 72e0a97567..455c042a9a 100644
> --- a/board/emulation/qemu-arm/qemu-arm.c
> +++ b/board/emulation/qemu-arm/qemu-arm.c
> @@ -148,9 +148,20 @@ int dram_init_banksize(void)
>
>  void *board_fdt_blob_setup(int *err)
>  {
> +	void *fdt = NULL;
>  	*err = 0;
> -	/* QEMU loads a generated DTB for us at the start of RAM. */
> -	return (void *)CFG_SYS_SDRAM_BASE;
> +
> +	/* Check if a DTB exists in bloblist */
> +	if (IS_ENABLED(CONFIG_BLOBLIST)) {
> +		if (bloblist_maybe_init())
> +			return (void *)CFG_SYS_SDRAM_BASE;
> +		fdt = bloblist_find(BLOBLISTT_CONTROL_FDT, 0);

if (!bloblist_maybe_init())
    fdt = bloblist_find(BLOBLISTT_CONTROL_FDT, 0);

and you wont need the explicit return, since the code below will catch it

> +	}
> +	if (!fdt)
> +		/* QEMU loads a generated DTB for us at the start of RAM. */
> +		return (void *)CFG_SYS_SDRAM_BASE;
> +	else

and you dont need the else here either

Thanks
/Ilias
> +		return fdt;
>  }
>
>  int board_bloblist_from_boot_arg(unsigned long addr, unsigned long size)
> --
> 2.25.1
>


More information about the U-Boot mailing list