3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * SPDX-License-Identifier: GPL-2.0+
13 #include <linux/compiler.h>
15 DECLARE_GLOBAL_DATA_PTR
;
18 static void print_num(const char *name
, ulong value
)
20 printf("%-12s= 0x%08lX\n", name
, value
);
24 static void print_eth(int idx
)
28 sprintf(name
, "eth%iaddr", idx
);
30 strcpy(name
, "ethaddr");
34 printf("%-12s= %s\n", name
, val
);
39 static void print_eths(void)
41 struct eth_device
*dev
;
45 dev
= eth_get_dev_by_index(i
);
47 printf("eth%dname = %s\n", i
, dev
->name
);
53 printf("current eth = %s\n", eth_get_name());
54 printf("ip_addr = %s\n", getenv("ipaddr"));
59 static void print_lnum(const char *name
, unsigned long long value
)
61 printf("%-12s= 0x%.8llX\n", name
, value
);
65 static void print_mhz(const char *name
, unsigned long hz
)
69 printf("%-12s= %6s MHz\n", name
, strmhz(buf
, hz
));
72 #if defined(CONFIG_PPC)
73 void __weak
board_detail(void)
75 /* Please define boot_detail() for your platform */
78 int do_bdinfo(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
83 print_num("bd address", (ulong
)bd
);
85 print_num("memstart", bd
->bi_memstart
);
86 print_lnum("memsize", bd
->bi_memsize
);
87 print_num("flashstart", bd
->bi_flashstart
);
88 print_num("flashsize", bd
->bi_flashsize
);
89 print_num("flashoffset", bd
->bi_flashoffset
);
90 print_num("sramstart", bd
->bi_sramstart
);
91 print_num("sramsize", bd
->bi_sramsize
);
92 #if defined(CONFIG_5xx) || defined(CONFIG_8xx) || \
93 defined(CONFIG_MPC8260) || defined(CONFIG_E500)
94 print_num("immr_base", bd
->bi_immr_base
);
96 print_num("bootflags", bd
->bi_bootflags
);
97 #if defined(CONFIG_405EP) || \
98 defined(CONFIG_405GP) || \
99 defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
100 defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \
101 defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \
102 defined(CONFIG_XILINX_405)
103 print_mhz("procfreq", bd
->bi_procfreq
);
104 print_mhz("plb_busfreq", bd
->bi_plb_busfreq
);
105 #if defined(CONFIG_405EP) || defined(CONFIG_405GP) || \
106 defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
107 defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \
108 defined(CONFIG_440SPE) || defined(CONFIG_XILINX_405)
109 print_mhz("pci_busfreq", bd
->bi_pci_busfreq
);
111 #else /* ! CONFIG_405GP, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
112 #if defined(CONFIG_CPM2)
113 print_mhz("vco", bd
->bi_vco
);
114 print_mhz("sccfreq", bd
->bi_sccfreq
);
115 print_mhz("brgfreq", bd
->bi_brgfreq
);
117 print_mhz("intfreq", bd
->bi_intfreq
);
118 #if defined(CONFIG_CPM2)
119 print_mhz("cpmfreq", bd
->bi_cpmfreq
);
121 print_mhz("busfreq", bd
->bi_busfreq
);
122 #endif /* CONFIG_405GP, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
124 #ifdef CONFIG_ENABLE_36BIT_PHYS
125 #ifdef CONFIG_PHYS_64BIT
126 puts("addressing = 36-bit\n");
128 puts("addressing = 32-bit\n");
133 #if defined(CONFIG_HAS_ETH1)
136 #if defined(CONFIG_HAS_ETH2)
139 #if defined(CONFIG_HAS_ETH3)
142 #if defined(CONFIG_HAS_ETH4)
145 #if defined(CONFIG_HAS_ETH5)
149 printf("IP addr = %s\n", getenv("ipaddr"));
150 printf("baudrate = %6u bps\n", gd
->baudrate
);
151 print_num("relocaddr", gd
->relocaddr
);
156 #elif defined(CONFIG_NIOS2)
158 int do_bdinfo(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
163 for (i
= 0; i
< CONFIG_NR_DRAM_BANKS
; ++i
) {
164 print_num("DRAM bank", i
);
165 print_num("-> start", bd
->bi_dram
[i
].start
);
166 print_num("-> size", bd
->bi_dram
[i
].size
);
169 print_num("flash start", (ulong
)bd
->bi_flashstart
);
170 print_num("flash size", (ulong
)bd
->bi_flashsize
);
171 print_num("flash offset", (ulong
)bd
->bi_flashoffset
);
173 #if defined(CONFIG_SYS_SRAM_BASE)
174 print_num ("sram start", (ulong
)bd
->bi_sramstart
);
175 print_num ("sram size", (ulong
)bd
->bi_sramsize
);
178 #if defined(CONFIG_CMD_NET)
180 printf("ip_addr = %s\n", getenv("ipaddr"));
183 printf("baudrate = %u bps\n", gd
->baudrate
);
188 #elif defined(CONFIG_MICROBLAZE)
190 int do_bdinfo(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
195 for (i
= 0; i
< CONFIG_NR_DRAM_BANKS
; ++i
) {
196 print_num("DRAM bank", i
);
197 print_num("-> start", bd
->bi_dram
[i
].start
);
198 print_num("-> size", bd
->bi_dram
[i
].size
);
201 print_num("flash start ", (ulong
)bd
->bi_flashstart
);
202 print_num("flash size ", (ulong
)bd
->bi_flashsize
);
203 print_num("flash offset ", (ulong
)bd
->bi_flashoffset
);
204 #if defined(CONFIG_SYS_SRAM_BASE)
205 print_num("sram start ", (ulong
)bd
->bi_sramstart
);
206 print_num("sram size ", (ulong
)bd
->bi_sramsize
);
208 #if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
211 printf("baudrate = %u bps\n", gd
->baudrate
);
212 print_num("relocaddr", gd
->relocaddr
);
213 print_num("reloc off", gd
->reloc_off
);
214 print_num("fdt_blob", (ulong
)gd
->fdt_blob
);
215 print_num("new_fdt", (ulong
)gd
->new_fdt
);
216 print_num("fdt_size", (ulong
)gd
->fdt_size
);
221 #elif defined(CONFIG_SPARC)
223 int do_bdinfo(cmd_tbl_t
* cmdtp
, int flag
, int argc
, char * const argv
[])
228 print_num("bd address ", (ulong
) bd
);
230 print_num("memstart ", bd
->bi_memstart
);
231 print_lnum("memsize ", bd
->bi_memsize
);
232 print_num("flashstart ", bd
->bi_flashstart
);
233 print_num("CONFIG_SYS_MONITOR_BASE ", CONFIG_SYS_MONITOR_BASE
);
234 print_num("CONFIG_ENV_ADDR ", CONFIG_ENV_ADDR
);
235 printf("CONFIG_SYS_RELOC_MONITOR_BASE = 0x%x (%d)\n", CONFIG_SYS_RELOC_MONITOR_BASE
,
236 CONFIG_SYS_MONITOR_LEN
);
237 printf("CONFIG_SYS_MALLOC_BASE = 0x%x (%d)\n", CONFIG_SYS_MALLOC_BASE
,
238 CONFIG_SYS_MALLOC_LEN
);
239 printf("CONFIG_SYS_INIT_SP_OFFSET = 0x%x (%d)\n", CONFIG_SYS_INIT_SP_OFFSET
,
240 CONFIG_SYS_STACK_SIZE
);
241 printf("CONFIG_SYS_PROM_OFFSET = 0x%x (%d)\n", CONFIG_SYS_PROM_OFFSET
,
242 CONFIG_SYS_PROM_SIZE
);
243 printf("CONFIG_SYS_GBL_DATA_OFFSET = 0x%x (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET
,
244 GENERATED_GBL_DATA_SIZE
);
246 #if defined(CONFIG_CMD_NET)
248 printf("ip_addr = %s\n", getenv("ipaddr"));
250 printf("baudrate = %6u bps\n", gd
->baudrate
);
254 #elif defined(CONFIG_M68K)
256 int do_bdinfo(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
260 print_num("memstart", (ulong
)bd
->bi_memstart
);
261 print_lnum("memsize", (u64
)bd
->bi_memsize
);
262 print_num("flashstart", (ulong
)bd
->bi_flashstart
);
263 print_num("flashsize", (ulong
)bd
->bi_flashsize
);
264 print_num("flashoffset", (ulong
)bd
->bi_flashoffset
);
265 #if defined(CONFIG_SYS_INIT_RAM_ADDR)
266 print_num("sramstart", (ulong
)bd
->bi_sramstart
);
267 print_num("sramsize", (ulong
)bd
->bi_sramsize
);
269 #if defined(CONFIG_SYS_MBAR)
270 print_num("mbar", bd
->bi_mbar_base
);
272 print_mhz("cpufreq", bd
->bi_intfreq
);
273 print_mhz("busfreq", bd
->bi_busfreq
);
275 print_mhz("pcifreq", bd
->bi_pcifreq
);
277 #ifdef CONFIG_EXTRA_CLOCK
278 print_mhz("flbfreq", bd
->bi_flbfreq
);
279 print_mhz("inpfreq", bd
->bi_inpfreq
);
280 print_mhz("vcofreq", bd
->bi_vcofreq
);
282 #if defined(CONFIG_CMD_NET)
284 #if defined(CONFIG_HAS_ETH1)
287 #if defined(CONFIG_HAS_ETH2)
290 #if defined(CONFIG_HAS_ETH3)
294 printf("ip_addr = %s\n", getenv("ipaddr"));
296 printf("baudrate = %u bps\n", gd
->baudrate
);
301 #elif defined(CONFIG_BLACKFIN)
303 int do_bdinfo(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
307 printf("U-Boot = %s\n", bd
->bi_r_version
);
308 printf("CPU = %s\n", bd
->bi_cpu
);
309 printf("Board = %s\n", bd
->bi_board_name
);
310 print_mhz("VCO", bd
->bi_vco
);
311 print_mhz("CCLK", bd
->bi_cclk
);
312 print_mhz("SCLK", bd
->bi_sclk
);
314 print_num("boot_params", (ulong
)bd
->bi_boot_params
);
315 print_num("memstart", (ulong
)bd
->bi_memstart
);
316 print_lnum("memsize", (u64
)bd
->bi_memsize
);
317 print_num("flashstart", (ulong
)bd
->bi_flashstart
);
318 print_num("flashsize", (ulong
)bd
->bi_flashsize
);
319 print_num("flashoffset", (ulong
)bd
->bi_flashoffset
);
322 printf("ip_addr = %s\n", getenv("ipaddr"));
323 printf("baudrate = %u bps\n", gd
->baudrate
);
328 #elif defined(CONFIG_MIPS)
330 int do_bdinfo(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
334 print_num("boot_params", (ulong
)bd
->bi_boot_params
);
335 print_num("memstart", (ulong
)bd
->bi_memstart
);
336 print_lnum("memsize", (u64
)bd
->bi_memsize
);
337 print_num("flashstart", (ulong
)bd
->bi_flashstart
);
338 print_num("flashsize", (ulong
)bd
->bi_flashsize
);
339 print_num("flashoffset", (ulong
)bd
->bi_flashoffset
);
342 printf("ip_addr = %s\n", getenv("ipaddr"));
343 printf("baudrate = %u bps\n", gd
->baudrate
);
348 #elif defined(CONFIG_AVR32)
350 int do_bdinfo(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
354 print_num("boot_params", (ulong
)bd
->bi_boot_params
);
355 print_num("memstart", (ulong
)bd
->bi_dram
[0].start
);
356 print_lnum("memsize", (u64
)bd
->bi_dram
[0].size
);
357 print_num("flashstart", (ulong
)bd
->bi_flashstart
);
358 print_num("flashsize", (ulong
)bd
->bi_flashsize
);
359 print_num("flashoffset", (ulong
)bd
->bi_flashoffset
);
362 printf("ip_addr = %s\n", getenv("ipaddr"));
363 printf("baudrate = %u bps\n", gd
->baudrate
);
368 #elif defined(CONFIG_ARM)
370 static int do_bdinfo(cmd_tbl_t
*cmdtp
, int flag
, int argc
,
376 print_num("arch_number", bd
->bi_arch_number
);
377 print_num("boot_params", (ulong
)bd
->bi_boot_params
);
379 for (i
= 0; i
< CONFIG_NR_DRAM_BANKS
; ++i
) {
380 print_num("DRAM bank", i
);
381 print_num("-> start", bd
->bi_dram
[i
].start
);
382 print_num("-> size", bd
->bi_dram
[i
].size
);
385 #ifdef CONFIG_SYS_MEM_RESERVE_SECURE
386 if (gd
->secure_ram
& MEM_RESERVE_SECURE_SECURED
) {
387 print_num("Secure ram",
388 gd
->secure_ram
& MEM_RESERVE_SECURE_ADDR_MASK
);
391 #if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
394 printf("baudrate = %u bps\n", gd
->baudrate
);
395 #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
396 print_num("TLB addr", gd
->arch
.tlb_addr
);
398 print_num("relocaddr", gd
->relocaddr
);
399 print_num("reloc off", gd
->reloc_off
);
400 print_num("irq_sp", gd
->irq_sp
); /* irq stack pointer */
401 print_num("sp start ", gd
->start_addr_sp
);
402 #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
403 print_num("FB base ", gd
->fb_base
);
406 * TODO: Currently only support for davinci SOC's is added.
407 * Remove this check once all the board implement this.
410 printf("ARM frequency = %ld MHz\n", gd
->bd
->bi_arm_freq
);
411 printf("DSP frequency = %ld MHz\n", gd
->bd
->bi_dsp_freq
);
412 printf("DDR frequency = %ld MHz\n", gd
->bd
->bi_ddr_freq
);
414 #ifdef CONFIG_BOARD_TYPES
415 printf("Board Type = %ld\n", gd
->board_type
);
420 #elif defined(CONFIG_SH)
422 int do_bdinfo(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
425 print_num("mem start ", (ulong
)bd
->bi_memstart
);
426 print_lnum("mem size ", (u64
)bd
->bi_memsize
);
427 print_num("flash start ", (ulong
)bd
->bi_flashstart
);
428 print_num("flash size ", (ulong
)bd
->bi_flashsize
);
429 print_num("flash offset ", (ulong
)bd
->bi_flashoffset
);
431 #if defined(CONFIG_CMD_NET)
433 printf("ip_addr = %s\n", getenv("ipaddr"));
435 printf("baudrate = %u bps\n", gd
->baudrate
);
439 #elif defined(CONFIG_X86)
441 int do_bdinfo(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
446 print_num("boot_params", (ulong
)bd
->bi_boot_params
);
447 print_num("bi_memstart", bd
->bi_memstart
);
448 print_num("bi_memsize", bd
->bi_memsize
);
449 print_num("bi_flashstart", bd
->bi_flashstart
);
450 print_num("bi_flashsize", bd
->bi_flashsize
);
451 print_num("bi_flashoffset", bd
->bi_flashoffset
);
452 print_num("bi_sramstart", bd
->bi_sramstart
);
453 print_num("bi_sramsize", bd
->bi_sramsize
);
454 print_num("bi_bootflags", bd
->bi_bootflags
);
455 print_mhz("cpufreq", bd
->bi_intfreq
);
456 print_mhz("busfreq", bd
->bi_busfreq
);
458 for (i
= 0; i
< CONFIG_NR_DRAM_BANKS
; ++i
) {
459 print_num("DRAM bank", i
);
460 print_num("-> start", bd
->bi_dram
[i
].start
);
461 print_num("-> size", bd
->bi_dram
[i
].size
);
464 #if defined(CONFIG_CMD_NET)
466 printf("ip_addr = %s\n", getenv("ipaddr"));
467 print_mhz("ethspeed", bd
->bi_ethspeed
);
469 printf("baudrate = %u bps\n", gd
->baudrate
);
474 #elif defined(CONFIG_SANDBOX)
476 int do_bdinfo(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
481 print_num("boot_params", (ulong
)bd
->bi_boot_params
);
483 for (i
= 0; i
< CONFIG_NR_DRAM_BANKS
; ++i
) {
484 print_num("DRAM bank", i
);
485 print_num("-> start", bd
->bi_dram
[i
].start
);
486 print_num("-> size", bd
->bi_dram
[i
].size
);
489 #if defined(CONFIG_CMD_NET)
491 printf("ip_addr = %s\n", getenv("ipaddr"));
493 #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
494 print_num("FB base ", gd
->fb_base
);
499 #elif defined(CONFIG_NDS32)
501 int do_bdinfo(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
506 print_num("arch_number", bd
->bi_arch_number
);
507 print_num("boot_params", (ulong
)bd
->bi_boot_params
);
509 for (i
= 0; i
< CONFIG_NR_DRAM_BANKS
; ++i
) {
510 print_num("DRAM bank", i
);
511 print_num("-> start", bd
->bi_dram
[i
].start
);
512 print_num("-> size", bd
->bi_dram
[i
].size
);
515 #if defined(CONFIG_CMD_NET)
517 printf("ip_addr = %s\n", getenv("ipaddr"));
519 printf("baudrate = %u bps\n", gd
->baudrate
);
524 #elif defined(CONFIG_OPENRISC)
526 int do_bdinfo(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
530 print_num("mem start", (ulong
)bd
->bi_memstart
);
531 print_lnum("mem size", (u64
)bd
->bi_memsize
);
532 print_num("flash start", (ulong
)bd
->bi_flashstart
);
533 print_num("flash size", (ulong
)bd
->bi_flashsize
);
534 print_num("flash offset", (ulong
)bd
->bi_flashoffset
);
536 #if defined(CONFIG_CMD_NET)
538 printf("ip_addr = %s\n", getenv("ipaddr"));
541 printf("baudrate = %u bps\n", gd
->baudrate
);
546 #elif defined(CONFIG_ARC)
548 int do_bdinfo(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
552 print_num("mem start", bd
->bi_memstart
);
553 print_lnum("mem size", bd
->bi_memsize
);
555 #if defined(CONFIG_CMD_NET)
557 printf("ip_addr = %s\n", getenv("ipaddr"));
559 printf("baudrate = %d bps\n", gd
->baudrate
);
565 #error "a case for this architecture does not exist!"
568 /* -------------------------------------------------------------------- */
571 bdinfo
, 1, 1, do_bdinfo
,
572 "print Board Info structure",