U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Raymond Mao <raymond.mao@linaro.org>
Cc: u-boot@lists.denx.de, sjg@chromium.org, jwerner@chromium.org,
	Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>,
	Nikhil M Jain <n-jain1@ti.com>, Bin Meng <bmeng.cn@gmail.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Baruch Siach <baruch@tkos.co.il>,
	Michal Simek <michal.simek@amd.com>,
	Sean Anderson <seanga2@gmail.com>, Qu Wenruo <wqu@suse.com>
Subject: Re: [PATCH 5/5] qemu-arm: get FDT from bloblist
Date: Wed, 20 Dec 2023 15:08:57 +0200	[thread overview]
Message-ID: <ZYLnaUhGuR-X56fx@hera> (raw)
In-Reply-To: <20231219211114.393193-6-raymond.mao@linaro.org>

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@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
>

      parent reply	other threads:[~2023-12-20 13:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19 21:11 [PATCH 0/5] Handoff bloblist from previous boot stage Raymond Mao
2023-12-19 21:11 ` [PATCH 1/5] bloblist: add API to check the register conventions Raymond Mao
2023-12-20 12:54   ` Ilias Apalodimas
2023-12-20 15:33     ` Raymond Mao
2023-12-19 21:11 ` [PATCH 2/5] qemu-arm: Get bloblist from boot arguments Raymond Mao
2023-12-20 11:03   ` Michal Simek
2023-12-20 15:36     ` Raymond Mao
2023-12-19 21:11 ` [PATCH 3/5] bloblist: Load the bloblist from the previous loader Raymond Mao
2023-12-20 10:57   ` Michal Simek
2023-12-20 14:53     ` Raymond Mao
2023-12-20 16:40       ` Michal Simek
2023-12-20 20:12         ` Raymond Mao
2023-12-19 21:11 ` [PATCH 4/5] fdt: update the document and Kconfig description Raymond Mao
2023-12-19 21:11 ` [PATCH 5/5] qemu-arm: get FDT from bloblist Raymond Mao
2023-12-20 10:55   ` Michal Simek
2023-12-20 13:08   ` Ilias Apalodimas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZYLnaUhGuR-X56fx@hera \
    --to=ilias.apalodimas@linaro.org \
    --cc=baruch@tkos.co.il \
    --cc=bmeng.cn@gmail.com \
    --cc=jwerner@chromium.org \
    --cc=michal.simek@amd.com \
    --cc=n-jain1@ti.com \
    --cc=raymond.mao@linaro.org \
    --cc=seanga2@gmail.com \
    --cc=sjg@chromium.org \
    --cc=tuomas.tynkkynen@iki.fi \
    --cc=u-boot@lists.denx.de \
    --cc=wqu@suse.com \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox