1
2
3
4
5
6
7
8
9
10
11#include <common.h>
12#include <command.h>
13#include <linux/compiler.h>
14
15DECLARE_GLOBAL_DATA_PTR;
16
17__maybe_unused
18static void print_num(const char *name, ulong value)
19{
20 printf("%-12s= 0x%08lX\n", name, value);
21}
22
23__maybe_unused
24static void print_eth(int idx)
25{
26 char name[10], *val;
27 if (idx)
28 sprintf(name, "eth%iaddr", idx);
29 else
30 strcpy(name, "ethaddr");
31 val = getenv(name);
32 if (!val)
33 val = "(not set)";
34 printf("%-12s= %s\n", name, val);
35}
36
37#ifndef CONFIG_DM_ETH
38__maybe_unused
39static void print_eths(void)
40{
41 struct eth_device *dev;
42 int i = 0;
43
44 do {
45 dev = eth_get_dev_by_index(i);
46 if (dev) {
47 printf("eth%dname = %s\n", i, dev->name);
48 print_eth(i);
49 i++;
50 }
51 } while (dev);
52
53 printf("current eth = %s\n", eth_get_name());
54 printf("ip_addr = %s\n", getenv("ipaddr"));
55}
56#endif
57
58__maybe_unused
59static void print_lnum(const char *name, unsigned long long value)
60{
61 printf("%-12s= 0x%.8llX\n", name, value);
62}
63
64__maybe_unused
65static void print_mhz(const char *name, unsigned long hz)
66{
67 char buf[32];
68
69 printf("%-12s= %6s MHz\n", name, strmhz(buf, hz));
70}
71
72#if defined(CONFIG_PPC)
73void __weak board_detail(void)
74{
75
76}
77
78int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
79{
80 bd_t *bd = gd->bd;
81
82#ifdef DEBUG
83 print_num("bd address", (ulong)bd);
84#endif
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);
95#endif
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);
110#endif
111#else
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);
116#endif
117 print_mhz("intfreq", bd->bi_intfreq);
118#if defined(CONFIG_CPM2)
119 print_mhz("cpmfreq", bd->bi_cpmfreq);
120#endif
121 print_mhz("busfreq", bd->bi_busfreq);
122#endif
123
124#ifdef CONFIG_ENABLE_36BIT_PHYS
125#ifdef CONFIG_PHYS_64BIT
126 puts("addressing = 36-bit\n");
127#else
128 puts("addressing = 32-bit\n");
129#endif
130#endif
131
132 print_eth(0);
133#if defined(CONFIG_HAS_ETH1)
134 print_eth(1);
135#endif
136#if defined(CONFIG_HAS_ETH2)
137 print_eth(2);
138#endif
139#if defined(CONFIG_HAS_ETH3)
140 print_eth(3);
141#endif
142#if defined(CONFIG_HAS_ETH4)
143 print_eth(4);
144#endif
145#if defined(CONFIG_HAS_ETH5)
146 print_eth(5);
147#endif
148
149 printf("IP addr = %s\n", getenv("ipaddr"));
150 printf("baudrate = %6u bps\n", gd->baudrate);
151 print_num("relocaddr", gd->relocaddr);
152 board_detail();
153 return 0;
154}
155
156#elif defined(CONFIG_NIOS2)
157
158int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
159{
160 bd_t *bd = gd->bd;
161
162 print_num("mem start", (ulong)bd->bi_memstart);
163 print_lnum("mem size", (u64)bd->bi_memsize);
164 print_num("flash start", (ulong)bd->bi_flashstart);
165 print_num("flash size", (ulong)bd->bi_flashsize);
166 print_num("flash offset", (ulong)bd->bi_flashoffset);
167
168#if defined(CONFIG_SYS_SRAM_BASE)
169 print_num ("sram start", (ulong)bd->bi_sramstart);
170 print_num ("sram size", (ulong)bd->bi_sramsize);
171#endif
172
173#if defined(CONFIG_CMD_NET)
174 print_eth(0);
175 printf("ip_addr = %s\n", getenv("ipaddr"));
176#endif
177
178 printf("baudrate = %u bps\n", gd->baudrate);
179
180 return 0;
181}
182
183#elif defined(CONFIG_MICROBLAZE)
184
185int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
186{
187 bd_t *bd = gd->bd;
188 int i;
189
190 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
191 print_num("DRAM bank", i);
192 print_num("-> start", bd->bi_dram[i].start);
193 print_num("-> size", bd->bi_dram[i].size);
194 }
195
196 print_num("flash start ", (ulong)bd->bi_flashstart);
197 print_num("flash size ", (ulong)bd->bi_flashsize);
198 print_num("flash offset ", (ulong)bd->bi_flashoffset);
199#if defined(CONFIG_SYS_SRAM_BASE)
200 print_num("sram start ", (ulong)bd->bi_sramstart);
201 print_num("sram size ", (ulong)bd->bi_sramsize);
202#endif
203#if defined(CONFIG_CMD_NET)
204 print_eths();
205#endif
206 printf("baudrate = %u bps\n", gd->baudrate);
207 print_num("relocaddr", gd->relocaddr);
208 print_num("reloc off", gd->reloc_off);
209 print_num("fdt_blob", (ulong)gd->fdt_blob);
210 print_num("new_fdt", (ulong)gd->new_fdt);
211 print_num("fdt_size", (ulong)gd->fdt_size);
212
213 return 0;
214}
215
216#elif defined(CONFIG_SPARC)
217
218int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
219{
220 bd_t *bd = gd->bd;
221
222#ifdef DEBUG
223 print_num("bd address ", (ulong) bd);
224#endif
225 print_num("memstart ", bd->bi_memstart);
226 print_lnum("memsize ", bd->bi_memsize);
227 print_num("flashstart ", bd->bi_flashstart);
228 print_num("CONFIG_SYS_MONITOR_BASE ", CONFIG_SYS_MONITOR_BASE);
229 print_num("CONFIG_ENV_ADDR ", CONFIG_ENV_ADDR);
230 printf("CONFIG_SYS_RELOC_MONITOR_BASE = 0x%x (%d)\n", CONFIG_SYS_RELOC_MONITOR_BASE,
231 CONFIG_SYS_MONITOR_LEN);
232 printf("CONFIG_SYS_MALLOC_BASE = 0x%x (%d)\n", CONFIG_SYS_MALLOC_BASE,
233 CONFIG_SYS_MALLOC_LEN);
234 printf("CONFIG_SYS_INIT_SP_OFFSET = 0x%x (%d)\n", CONFIG_SYS_INIT_SP_OFFSET,
235 CONFIG_SYS_STACK_SIZE);
236 printf("CONFIG_SYS_PROM_OFFSET = 0x%x (%d)\n", CONFIG_SYS_PROM_OFFSET,
237 CONFIG_SYS_PROM_SIZE);
238 printf("CONFIG_SYS_GBL_DATA_OFFSET = 0x%x (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET,
239 GENERATED_GBL_DATA_SIZE);
240
241#if defined(CONFIG_CMD_NET)
242 print_eth(0);
243 printf("ip_addr = %s\n", getenv("ipaddr"));
244#endif
245 printf("baudrate = %6u bps\n", gd->baudrate);
246 return 0;
247}
248
249#elif defined(CONFIG_M68K)
250
251int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
252{
253 bd_t *bd = gd->bd;
254
255 print_num("memstart", (ulong)bd->bi_memstart);
256 print_lnum("memsize", (u64)bd->bi_memsize);
257 print_num("flashstart", (ulong)bd->bi_flashstart);
258 print_num("flashsize", (ulong)bd->bi_flashsize);
259 print_num("flashoffset", (ulong)bd->bi_flashoffset);
260#if defined(CONFIG_SYS_INIT_RAM_ADDR)
261 print_num("sramstart", (ulong)bd->bi_sramstart);
262 print_num("sramsize", (ulong)bd->bi_sramsize);
263#endif
264#if defined(CONFIG_SYS_MBAR)
265 print_num("mbar", bd->bi_mbar_base);
266#endif
267 print_mhz("cpufreq", bd->bi_intfreq);
268 print_mhz("busfreq", bd->bi_busfreq);
269#ifdef CONFIG_PCI
270 print_mhz("pcifreq", bd->bi_pcifreq);
271#endif
272#ifdef CONFIG_EXTRA_CLOCK
273 print_mhz("flbfreq", bd->bi_flbfreq);
274 print_mhz("inpfreq", bd->bi_inpfreq);
275 print_mhz("vcofreq", bd->bi_vcofreq);
276#endif
277#if defined(CONFIG_CMD_NET)
278 print_eth(0);
279#if defined(CONFIG_HAS_ETH1)
280 print_eth(1);
281#endif
282#if defined(CONFIG_HAS_ETH2)
283 print_eth(2);
284#endif
285#if defined(CONFIG_HAS_ETH3)
286 print_eth(3);
287#endif
288
289 printf("ip_addr = %s\n", getenv("ipaddr"));
290#endif
291 printf("baudrate = %u bps\n", gd->baudrate);
292
293 return 0;
294}
295
296#elif defined(CONFIG_BLACKFIN)
297
298int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
299{
300 bd_t *bd = gd->bd;
301
302 printf("U-Boot = %s\n", bd->bi_r_version);
303 printf("CPU = %s\n", bd->bi_cpu);
304 printf("Board = %s\n", bd->bi_board_name);
305 print_mhz("VCO", bd->bi_vco);
306 print_mhz("CCLK", bd->bi_cclk);
307 print_mhz("SCLK", bd->bi_sclk);
308
309 print_num("boot_params", (ulong)bd->bi_boot_params);
310 print_num("memstart", (ulong)bd->bi_memstart);
311 print_lnum("memsize", (u64)bd->bi_memsize);
312 print_num("flashstart", (ulong)bd->bi_flashstart);
313 print_num("flashsize", (ulong)bd->bi_flashsize);
314 print_num("flashoffset", (ulong)bd->bi_flashoffset);
315
316 print_eth(0);
317 printf("ip_addr = %s\n", getenv("ipaddr"));
318 printf("baudrate = %u bps\n", gd->baudrate);
319
320 return 0;
321}
322
323#elif defined(CONFIG_MIPS)
324
325int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
326{
327 bd_t *bd = gd->bd;
328
329 print_num("boot_params", (ulong)bd->bi_boot_params);
330 print_num("memstart", (ulong)bd->bi_memstart);
331 print_lnum("memsize", (u64)bd->bi_memsize);
332 print_num("flashstart", (ulong)bd->bi_flashstart);
333 print_num("flashsize", (ulong)bd->bi_flashsize);
334 print_num("flashoffset", (ulong)bd->bi_flashoffset);
335
336 print_eth(0);
337 printf("ip_addr = %s\n", getenv("ipaddr"));
338 printf("baudrate = %u bps\n", gd->baudrate);
339
340 return 0;
341}
342
343#elif defined(CONFIG_AVR32)
344
345int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
346{
347 bd_t *bd = gd->bd;
348
349 print_num("boot_params", (ulong)bd->bi_boot_params);
350 print_num("memstart", (ulong)bd->bi_dram[0].start);
351 print_lnum("memsize", (u64)bd->bi_dram[0].size);
352 print_num("flashstart", (ulong)bd->bi_flashstart);
353 print_num("flashsize", (ulong)bd->bi_flashsize);
354 print_num("flashoffset", (ulong)bd->bi_flashoffset);
355
356 print_eth(0);
357 printf("ip_addr = %s\n", getenv("ipaddr"));
358 printf("baudrate = %u bps\n", gd->baudrate);
359
360 return 0;
361}
362
363#elif defined(CONFIG_ARM)
364
365static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
366 char * const argv[])
367{
368 int i;
369 bd_t *bd = gd->bd;
370
371 print_num("arch_number", bd->bi_arch_number);
372 print_num("boot_params", (ulong)bd->bi_boot_params);
373
374 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
375 print_num("DRAM bank", i);
376 print_num("-> start", bd->bi_dram[i].start);
377 print_num("-> size", bd->bi_dram[i].size);
378 }
379
380#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
381 print_eths();
382#endif
383 printf("baudrate = %u bps\n", gd->baudrate);
384#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
385 print_num("TLB addr", gd->arch.tlb_addr);
386#endif
387 print_num("relocaddr", gd->relocaddr);
388 print_num("reloc off", gd->reloc_off);
389 print_num("irq_sp", gd->irq_sp);
390 print_num("sp start ", gd->start_addr_sp);
391#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
392 print_num("FB base ", gd->fb_base);
393#endif
394
395
396
397
398#ifdef CONFIG_CLOCKS
399 printf("ARM frequency = %ld MHz\n", gd->bd->bi_arm_freq);
400 printf("DSP frequency = %ld MHz\n", gd->bd->bi_dsp_freq);
401 printf("DDR frequency = %ld MHz\n", gd->bd->bi_ddr_freq);
402#endif
403#ifdef CONFIG_BOARD_TYPES
404 printf("Board Type = %ld\n", gd->board_type);
405#endif
406 return 0;
407}
408
409#elif defined(CONFIG_SH)
410
411int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
412{
413 bd_t *bd = gd->bd;
414 print_num("mem start ", (ulong)bd->bi_memstart);
415 print_lnum("mem size ", (u64)bd->bi_memsize);
416 print_num("flash start ", (ulong)bd->bi_flashstart);
417 print_num("flash size ", (ulong)bd->bi_flashsize);
418 print_num("flash offset ", (ulong)bd->bi_flashoffset);
419
420#if defined(CONFIG_CMD_NET)
421 print_eth(0);
422 printf("ip_addr = %s\n", getenv("ipaddr"));
423#endif
424 printf("baudrate = %u bps\n", gd->baudrate);
425 return 0;
426}
427
428#elif defined(CONFIG_X86)
429
430int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
431{
432 int i;
433 bd_t *bd = gd->bd;
434
435 print_num("boot_params", (ulong)bd->bi_boot_params);
436 print_num("bi_memstart", bd->bi_memstart);
437 print_num("bi_memsize", bd->bi_memsize);
438 print_num("bi_flashstart", bd->bi_flashstart);
439 print_num("bi_flashsize", bd->bi_flashsize);
440 print_num("bi_flashoffset", bd->bi_flashoffset);
441 print_num("bi_sramstart", bd->bi_sramstart);
442 print_num("bi_sramsize", bd->bi_sramsize);
443 print_num("bi_bootflags", bd->bi_bootflags);
444 print_mhz("cpufreq", bd->bi_intfreq);
445 print_mhz("busfreq", bd->bi_busfreq);
446
447 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
448 print_num("DRAM bank", i);
449 print_num("-> start", bd->bi_dram[i].start);
450 print_num("-> size", bd->bi_dram[i].size);
451 }
452
453#if defined(CONFIG_CMD_NET)
454 print_eth(0);
455 printf("ip_addr = %s\n", getenv("ipaddr"));
456 print_mhz("ethspeed", bd->bi_ethspeed);
457#endif
458 printf("baudrate = %u bps\n", gd->baudrate);
459
460 return 0;
461}
462
463#elif defined(CONFIG_SANDBOX)
464
465int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
466{
467 int i;
468 bd_t *bd = gd->bd;
469
470 print_num("boot_params", (ulong)bd->bi_boot_params);
471
472 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
473 print_num("DRAM bank", i);
474 print_num("-> start", bd->bi_dram[i].start);
475 print_num("-> size", bd->bi_dram[i].size);
476 }
477
478#if defined(CONFIG_CMD_NET)
479 print_eth(0);
480 printf("ip_addr = %s\n", getenv("ipaddr"));
481#endif
482#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
483 print_num("FB base ", gd->fb_base);
484#endif
485 return 0;
486}
487
488#elif defined(CONFIG_NDS32)
489
490int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
491{
492 int i;
493 bd_t *bd = gd->bd;
494
495 print_num("arch_number", bd->bi_arch_number);
496 print_num("boot_params", (ulong)bd->bi_boot_params);
497
498 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
499 print_num("DRAM bank", i);
500 print_num("-> start", bd->bi_dram[i].start);
501 print_num("-> size", bd->bi_dram[i].size);
502 }
503
504#if defined(CONFIG_CMD_NET)
505 print_eth(0);
506 printf("ip_addr = %s\n", getenv("ipaddr"));
507#endif
508 printf("baudrate = %u bps\n", gd->baudrate);
509
510 return 0;
511}
512
513#elif defined(CONFIG_OPENRISC)
514
515int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
516{
517 bd_t *bd = gd->bd;
518
519 print_num("mem start", (ulong)bd->bi_memstart);
520 print_lnum("mem size", (u64)bd->bi_memsize);
521 print_num("flash start", (ulong)bd->bi_flashstart);
522 print_num("flash size", (ulong)bd->bi_flashsize);
523 print_num("flash offset", (ulong)bd->bi_flashoffset);
524
525#if defined(CONFIG_CMD_NET)
526 print_eth(0);
527 printf("ip_addr = %s\n", getenv("ipaddr"));
528#endif
529
530 printf("baudrate = %u bps\n", gd->baudrate);
531
532 return 0;
533}
534
535#elif defined(CONFIG_ARC)
536
537int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
538{
539 bd_t *bd = gd->bd;
540
541 print_num("mem start", bd->bi_memstart);
542 print_lnum("mem size", bd->bi_memsize);
543
544#if defined(CONFIG_CMD_NET)
545 print_eth(0);
546 printf("ip_addr = %s\n", getenv("ipaddr"));
547#endif
548 printf("baudrate = %d bps\n", gd->baudrate);
549
550 return 0;
551}
552
553#else
554 #error "a case for this architecture does not exist!"
555#endif
556
557
558
559U_BOOT_CMD(
560 bdinfo, 1, 1, do_bdinfo,
561 "print Board Info structure",
562 ""
563);
564