U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Leo Liang <ycliang@andestech.com>
To: Yao Zi <ziyao@disroot.org>
Cc: Rick Chen <rick@andestech.com>, Tom Rini <trini@konsulko.com>,
	Bin Meng <bmeng.cn@gmail.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	Anup Patel <anup@brainfault.org>,
	Atish Patra <atishp@atishpatra.org>,
	Green Wan <green.wan@sifive.com>,
	Minda Chen <minda.chen@starfivetech.com>,
	Simon Glass <sjg@chromium.org>,
	"Angelo Dureghello" <angelo@kernel-space.org>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>, <u-boot@lists.denx.de>
Subject: Re: [PATCH v2 1/4] riscv: lib: Add a default implementation of board_fdt_blob_setup
Date: Tue, 25 Mar 2025 18:08:59 +0800	[thread overview]
Message-ID: <Z-KAu-8n7_mkA7vB@swlinux02> (raw)
In-Reply-To: <20250307131344.43762-2-ziyao@disroot.org>

Hi Yao,

On Fri, Mar 07, 2025 at 01:13:41PM +0000, Yao Zi wrote:
> It's common for S-Mode proper U-Boot to retrieve a FDT blob along with
> taking control from SBI firmware. Add a weak version of
> board_fdt_blob_setup to make use of it by default, avoiding copy-pasting
> similar functions among boards.
> 
> Signed-off-by: Yao Zi <ziyao@disroot.org>
> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
> ---
>  arch/riscv/lib/Makefile |  1 +
>  arch/riscv/lib/board.c  | 19 +++++++++++++++++++
>  2 files changed, 20 insertions(+)
>  create mode 100644 arch/riscv/lib/board.c
> 
> diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile
> index 268116f3757..b33f9c646dd 100644
> --- a/arch/riscv/lib/Makefile
> +++ b/arch/riscv/lib/Makefile
> @@ -27,6 +27,7 @@ obj-$(CONFIG_$(XPL_)SMP) += smp.o
>  obj-$(CONFIG_XPL_BUILD)	+= spl.o
>  obj-y   += fdt_fixup.o
>  obj-$(CONFIG_$(SPL)CMD_BDI) += bdinfo.o
> +obj-$(CONFIG_OF_BOARD) += board.o
>  
>  # For building EFI apps
>  CFLAGS_NON_EFI := -fstack-protector-strong
> diff --git a/arch/riscv/lib/board.c b/arch/riscv/lib/board.c
> new file mode 100644
> index 00000000000..1630355b2b1
> --- /dev/null
> +++ b/arch/riscv/lib/board.c
> @@ -0,0 +1,19 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * RISC-V-specific handling of firmware FDT
> + */
> +
> +#include <asm/global_data.h>
> +#include <linux/errno.h>
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +__weak int board_fdt_blob_setup(void **fdtp)
> +{
> +	if (IS_ENABLED(CONFIG_XPL_BUILD) || !gd->arch.firmware_fdt_addr)
> +		return -EEXIST;

We don't need this check "CONFIG_XPL_BUILD", do we?
We do need this setup function for SPL and adding this would fail CI test.

> +
> +	*fdtp = (void *)gd->arch.firmware_fdt_addr;

We should add proper casting to suppress compile warning for 32 bit.

Best regards,
Leo
> +
> +	return 0;
> +}

  parent reply	other threads:[~2025-03-25 10:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07 13:13 [PATCH v2 0/4] Simplify retrieving FDT from SBI in S-Mode Yao Zi
2025-03-07 13:13 ` [PATCH v2 1/4] riscv: lib: Add a default implementation of board_fdt_blob_setup Yao Zi
2025-03-25  3:43   ` Leo Liang
2025-03-25 10:08   ` Leo Liang [this message]
2025-04-25  8:19   ` Leo Liang
2025-03-07 13:13 ` [PATCH v2 2/4] board: qemu: riscv: Remove duplicated board_fdt_blob_setup Yao Zi
2025-03-07 13:13 ` [PATCH v2 3/4] board: starfive: " Yao Zi
2025-03-07 13:13 ` [PATCH v2 4/4] board: sifive: Remove dead board_fdt_blob_setup Yao Zi

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=Z-KAu-8n7_mkA7vB@swlinux02 \
    --to=ycliang@andestech.com \
    --cc=angelo@kernel-space.org \
    --cc=anup@brainfault.org \
    --cc=atishp@atishpatra.org \
    --cc=bmeng.cn@gmail.com \
    --cc=green.wan@sifive.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=minda.chen@starfivetech.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=rick@andestech.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    --cc=ziyao@disroot.org \
    /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