1 // SPDX-License-Identifier: GPL-2.0+
3 * Implements the 'bd' command to show board information
6 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
14 #include <asm/cache.h>
16 DECLARE_GLOBAL_DATA_PTR;
18 void bdinfo_print_num(const char *name, ulong value)
20 printf("%-12s= 0x%0*lx\n", name, 2 * (int)sizeof(value), value);
23 static void print_eth(int idx)
27 sprintf(name, "eth%iaddr", idx);
29 strcpy(name, "ethaddr");
33 printf("%-12s= %s\n", name, val);
36 static void print_lnum(const char *name, unsigned long long value)
38 printf("%-12s= 0x%.8llX\n", name, value);
41 void bdinfo_print_mhz(const char *name, unsigned long hz)
45 printf("%-12s= %6s MHz\n", name, strmhz(buf, hz));
48 static void print_bi_dram(const struct bd_info *bd)
50 #ifdef CONFIG_NR_DRAM_BANKS
53 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
54 if (bd->bi_dram[i].size) {
55 bdinfo_print_num("DRAM bank", i);
56 bdinfo_print_num("-> start", bd->bi_dram[i].start);
57 bdinfo_print_num("-> size", bd->bi_dram[i].size);
63 __weak void arch_print_bdinfo(void)
67 int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
69 struct bd_info *bd = gd->bd;
72 bdinfo_print_num("bd address", (ulong)bd);
74 bdinfo_print_num("boot_params", (ulong)bd->bi_boot_params);
76 bdinfo_print_num("memstart", (ulong)bd->bi_memstart);
77 print_lnum("memsize", (u64)bd->bi_memsize);
78 bdinfo_print_num("flashstart", (ulong)bd->bi_flashstart);
79 bdinfo_print_num("flashsize", (ulong)bd->bi_flashsize);
80 bdinfo_print_num("flashoffset", (ulong)bd->bi_flashoffset);
81 printf("baudrate = %u bps\n", gd->baudrate);
82 bdinfo_print_num("relocaddr", gd->relocaddr);
83 bdinfo_print_num("reloc off", gd->reloc_off);
84 printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
85 if (IS_ENABLED(CONFIG_CMD_NET)) {
86 printf("current eth = %s\n", eth_get_name());
88 printf("IP addr = %s\n", env_get("ipaddr"));
90 bdinfo_print_num("fdt_blob", (ulong)gd->fdt_blob);
91 bdinfo_print_num("new_fdt", (ulong)gd->new_fdt);
92 bdinfo_print_num("fdt_size", (ulong)gd->fdt_size);
93 #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO)
94 bdinfo_print_num("FB base ", gd->fb_base);
96 #if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
97 bdinfo_print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit);
106 bdinfo, 1, 1, do_bdinfo,
107 "print Board Info structure",