]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
riscv: add RISC-V fields to bdinfo command
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fri, 7 Jun 2024 08:41:17 +0000 (10:41 +0200)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Mon, 22 Jul 2024 03:15:11 +0000 (11:15 +0800)
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>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
arch/riscv/lib/Makefile
arch/riscv/lib/bdinfo.c [new file with mode: 0644]

index 9a05b662fd632ebb6b99adad8127604ed6d5a9a8..65dc49f6fa5622e6f30365b5f7f73cf468e4399a 100644 (file)
@@ -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 (file)
index 0000000..7734e51
--- /dev/null
@@ -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);
+}