public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 1/1] riscv: add RISC-V fields to bdinfo command
@ 2024-06-07  8:41 Heinrich Schuchardt
  2024-07-08 11:56 ` Leo Liang
  0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2024-06-07  8:41 UTC (permalink / raw)
  To: Rick Chen, Leo; +Cc: u-boot, Heinrich Schuchardt

The firmware invoking main U-Boot uses

* a0 to pass the boot hart
* a1 to pass a device-tree

Let the bdinfo command print this information, e.g.

    boot hart   = 0x000000000000001b
    firmware fdt= 0x0000000087e00000

The firmware fdt field will only be printed if it is non-zero.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 arch/riscv/lib/Makefile |  1 +
 arch/riscv/lib/bdinfo.c | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 arch/riscv/lib/bdinfo.c

diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile
index 9a05b662fd6..65dc49f6fa5 100644
--- a/arch/riscv/lib/Makefile
+++ b/arch/riscv/lib/Makefile
@@ -26,6 +26,7 @@ obj-y   += setjmp.o
 obj-$(CONFIG_$(SPL_)SMP) += smp.o
 obj-$(CONFIG_SPL_BUILD)	+= spl.o
 obj-y   += fdt_fixup.o
+obj-$(CONFIG_$(SPL)CMD_BDI) += bdinfo.o
 
 # For building EFI apps
 CFLAGS_NON_EFI := -fstack-protector-strong
diff --git a/arch/riscv/lib/bdinfo.c b/arch/riscv/lib/bdinfo.c
new file mode 100644
index 00000000000..7734e51d670
--- /dev/null
+++ b/arch/riscv/lib/bdinfo.c
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * RISC-V-specific information for the 'bdinfo' command
+ */
+
+#include <init.h>
+#include <asm/global_data.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void arch_print_bdinfo(void)
+{
+	bdinfo_print_num_l("boot hart", gd->arch.boot_hart);
+
+	if (gd->arch.firmware_fdt_addr)
+		bdinfo_print_num_ll("firmware fdt",
+				    (long long)gd->arch.firmware_fdt_addr);
+}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] riscv: add RISC-V fields to bdinfo command
  2024-06-07  8:41 [PATCH 1/1] riscv: add RISC-V fields to bdinfo command Heinrich Schuchardt
@ 2024-07-08 11:56 ` Leo Liang
  0 siblings, 0 replies; 2+ messages in thread
From: Leo Liang @ 2024-07-08 11:56 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: Rick Chen, u-boot

On Fri, Jun 07, 2024 at 10:41:17AM +0200, Heinrich Schuchardt wrote:
> The firmware invoking main U-Boot uses
> 
> * a0 to pass the boot hart
> * a1 to pass a device-tree
> 
> Let the bdinfo command print this information, e.g.
> 
>     boot hart   = 0x000000000000001b
>     firmware fdt= 0x0000000087e00000
> 
> The firmware fdt field will only be printed if it is non-zero.
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  arch/riscv/lib/Makefile |  1 +
>  arch/riscv/lib/bdinfo.c | 18 ++++++++++++++++++
>  2 files changed, 19 insertions(+)
>  create mode 100644 arch/riscv/lib/bdinfo.c

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-08 11:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-07  8:41 [PATCH 1/1] riscv: add RISC-V fields to bdinfo command Heinrich Schuchardt
2024-07-08 11:56 ` Leo Liang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox