3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 #include <linux/compiler.h>
31 DECLARE_GLOBAL_DATA_PTR;
34 static void print_num(const char *name, ulong value)
36 printf("%-12s= 0x%08lX\n", name, value);
40 static void print_eth(int idx)
44 sprintf(name, "eth%iaddr", idx);
46 strcpy(name, "ethaddr");
50 printf("%-12s= %s\n", name, val);
54 static void print_eths(void)
56 struct eth_device *dev;
60 dev = eth_get_dev_by_index(i);
62 printf("eth%dname = %s\n", i, dev->name);
68 printf("current eth = %s\n", eth_get_name());
69 printf("ip_addr = %s\n", getenv("ipaddr"));
73 static void print_lnum(const char *name, unsigned long long value)
75 printf("%-12s= 0x%.8llX\n", name, value);
79 static void print_mhz(const char *name, unsigned long hz)
83 printf("%-12s= %6s MHz\n", name, strmhz(buf, hz));
86 #if defined(CONFIG_PPC)
88 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
93 print_num("bd address", (ulong)bd);
95 print_num("memstart", bd->bi_memstart);
96 print_lnum("memsize", bd->bi_memsize);
97 print_num("flashstart", bd->bi_flashstart);
98 print_num("flashsize", bd->bi_flashsize);
99 print_num("flashoffset", bd->bi_flashoffset);
100 print_num("sramstart", bd->bi_sramstart);
101 print_num("sramsize", bd->bi_sramsize);
102 #if defined(CONFIG_5xx) || defined(CONFIG_8xx) || \
103 defined(CONFIG_8260) || defined(CONFIG_E500)
104 print_num("immr_base", bd->bi_immr_base);
106 print_num("bootflags", bd->bi_bootflags);
107 #if defined(CONFIG_405CR) || defined(CONFIG_405EP) || \
108 defined(CONFIG_405GP) || \
109 defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
110 defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \
111 defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \
112 defined(CONFIG_XILINX_405)
113 print_mhz("procfreq", bd->bi_procfreq);
114 print_mhz("plb_busfreq", bd->bi_plb_busfreq);
115 #if defined(CONFIG_405EP) || defined(CONFIG_405GP) || \
116 defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
117 defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \
118 defined(CONFIG_440SPE) || defined(CONFIG_XILINX_405)
119 print_mhz("pci_busfreq", bd->bi_pci_busfreq);
121 #else /* ! CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
122 #if defined(CONFIG_CPM2)
123 print_mhz("vco", bd->bi_vco);
124 print_mhz("sccfreq", bd->bi_sccfreq);
125 print_mhz("brgfreq", bd->bi_brgfreq);
127 print_mhz("intfreq", bd->bi_intfreq);
128 #if defined(CONFIG_CPM2)
129 print_mhz("cpmfreq", bd->bi_cpmfreq);
131 print_mhz("busfreq", bd->bi_busfreq);
132 #endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
134 #ifdef CONFIG_ENABLE_36BIT_PHYS
135 #ifdef CONFIG_PHYS_64BIT
136 puts("addressing = 36-bit\n");
138 puts("addressing = 32-bit\n");
143 #if defined(CONFIG_HAS_ETH1)
146 #if defined(CONFIG_HAS_ETH2)
149 #if defined(CONFIG_HAS_ETH3)
152 #if defined(CONFIG_HAS_ETH4)
155 #if defined(CONFIG_HAS_ETH5)
160 print_mhz("ethspeed", bd->bi_ethspeed);
162 printf("IP addr = %s\n", getenv("ipaddr"));
163 printf("baudrate = %6u bps\n", bd->bi_baudrate);
164 print_num("relocaddr", gd->relocaddr);
168 #elif defined(CONFIG_NIOS2)
170 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
174 print_num("mem start", (ulong)bd->bi_memstart);
175 print_lnum("mem size", (u64)bd->bi_memsize);
176 print_num("flash start", (ulong)bd->bi_flashstart);
177 print_num("flash size", (ulong)bd->bi_flashsize);
178 print_num("flash offset", (ulong)bd->bi_flashoffset);
180 #if defined(CONFIG_SYS_SRAM_BASE)
181 print_num ("sram start", (ulong)bd->bi_sramstart);
182 print_num ("sram size", (ulong)bd->bi_sramsize);
185 #if defined(CONFIG_CMD_NET)
187 printf("ip_addr = %s\n", getenv("ipaddr"));
190 printf("baudrate = %u bps\n", bd->bi_baudrate);
195 #elif defined(CONFIG_MICROBLAZE)
197 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
200 print_num("mem start ", (ulong)bd->bi_memstart);
201 print_lnum("mem size ", (u64)bd->bi_memsize);
202 print_num("flash start ", (ulong)bd->bi_flashstart);
203 print_num("flash size ", (ulong)bd->bi_flashsize);
204 print_num("flash offset ", (ulong)bd->bi_flashoffset);
205 #if defined(CONFIG_SYS_SRAM_BASE)
206 print_num("sram start ", (ulong)bd->bi_sramstart);
207 print_num("sram size ", (ulong)bd->bi_sramsize);
209 #if defined(CONFIG_CMD_NET)
212 printf("baudrate = %u bps\n", bd->bi_baudrate);
216 #elif defined(CONFIG_SPARC)
218 int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
223 print_num("bd address ", (ulong) bd);
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);
241 #if defined(CONFIG_CMD_NET)
243 printf("ip_addr = %s\n", getenv("ipaddr"));
245 printf("baudrate = %6u bps\n", bd->bi_baudrate);
249 #elif defined(CONFIG_M68K)
251 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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);
264 #if defined(CONFIG_SYS_MBAR)
265 print_num("mbar", bd->bi_mbar_base);
267 print_mhz("cpufreq", bd->bi_intfreq);
268 print_mhz("busfreq", bd->bi_busfreq);
270 print_mhz("pcifreq", bd->bi_pcifreq);
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);
277 #if defined(CONFIG_CMD_NET)
279 #if defined(CONFIG_HAS_ETH1)
282 #if defined(CONFIG_HAS_ETH2)
285 #if defined(CONFIG_HAS_ETH3)
289 printf("ip_addr = %s\n", getenv("ipaddr"));
291 printf("baudrate = %u bps\n", bd->bi_baudrate);
296 #elif defined(CONFIG_BLACKFIN)
298 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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);
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);
317 printf("ip_addr = %s\n", getenv("ipaddr"));
318 printf("baudrate = %u bps\n", bd->bi_baudrate);
323 #elif defined(CONFIG_MIPS)
325 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
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);
337 printf("ip_addr = %s\n", getenv("ipaddr"));
338 printf("baudrate = %u bps\n", bd->bi_baudrate);
343 #elif defined(CONFIG_AVR32)
345 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
349 print_num("boot_params", (ulong)bd->bi_boot_params);
350 print_num("memstart", (ulong)bd->bi_memstart);
351 print_lnum("memsize", (u64)bd->bi_memsize);
352 print_num("flashstart", (ulong)bd->bi_flashstart);
353 print_num("flashsize", (ulong)bd->bi_flashsize);
354 print_num("flashoffset", (ulong)bd->bi_flashoffset);
357 printf("ip_addr = %s\n", getenv("ipaddr"));
358 printf("baudrate = %u bps\n", bd->bi_baudrate);
363 #elif defined(CONFIG_ARM)
365 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
370 print_num("arch_number", bd->bi_arch_number);
371 print_num("boot_params", (ulong)bd->bi_boot_params);
373 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
374 print_num("DRAM bank", i);
375 print_num("-> start", bd->bi_dram[i].start);
376 print_num("-> size", bd->bi_dram[i].size);
379 #if defined(CONFIG_CMD_NET)
382 printf("baudrate = %u bps\n", bd->bi_baudrate);
383 #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
384 print_num("TLB addr", gd->arch.tlb_addr);
386 print_num("relocaddr", gd->relocaddr);
387 print_num("reloc off", gd->reloc_off);
388 print_num("irq_sp", gd->irq_sp); /* irq stack pointer */
389 print_num("sp start ", gd->start_addr_sp);
390 #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
391 print_num("FB base ", gd->fb_base);
394 * TODO: Currently only support for davinci SOC's is added.
395 * Remove this check once all the board implement this.
398 printf("ARM frequency = %ld MHz\n", gd->bd->bi_arm_freq);
399 printf("DSP frequency = %ld MHz\n", gd->bd->bi_dsp_freq);
400 printf("DDR frequency = %ld MHz\n", gd->bd->bi_ddr_freq);
405 #elif defined(CONFIG_SH)
407 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
410 print_num("mem start ", (ulong)bd->bi_memstart);
411 print_lnum("mem size ", (u64)bd->bi_memsize);
412 print_num("flash start ", (ulong)bd->bi_flashstart);
413 print_num("flash size ", (ulong)bd->bi_flashsize);
414 print_num("flash offset ", (ulong)bd->bi_flashoffset);
416 #if defined(CONFIG_CMD_NET)
418 printf("ip_addr = %s\n", getenv("ipaddr"));
420 printf("baudrate = %u bps\n", bd->bi_baudrate);
424 #elif defined(CONFIG_X86)
426 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
431 print_num("boot_params", (ulong)bd->bi_boot_params);
432 print_num("bi_memstart", bd->bi_memstart);
433 print_num("bi_memsize", bd->bi_memsize);
434 print_num("bi_flashstart", bd->bi_flashstart);
435 print_num("bi_flashsize", bd->bi_flashsize);
436 print_num("bi_flashoffset", bd->bi_flashoffset);
437 print_num("bi_sramstart", bd->bi_sramstart);
438 print_num("bi_sramsize", bd->bi_sramsize);
439 print_num("bi_bootflags", bd->bi_bootflags);
440 print_mhz("cpufreq", bd->bi_intfreq);
441 print_mhz("busfreq", bd->bi_busfreq);
443 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
444 print_num("DRAM bank", i);
445 print_num("-> start", bd->bi_dram[i].start);
446 print_num("-> size", bd->bi_dram[i].size);
449 #if defined(CONFIG_CMD_NET)
451 printf("ip_addr = %s\n", getenv("ipaddr"));
452 print_mhz("ethspeed", bd->bi_ethspeed);
454 printf("baudrate = %u bps\n", bd->bi_baudrate);
459 #elif defined(CONFIG_SANDBOX)
461 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
466 print_num("boot_params", (ulong)bd->bi_boot_params);
468 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
469 print_num("DRAM bank", i);
470 print_num("-> start", bd->bi_dram[i].start);
471 print_num("-> size", bd->bi_dram[i].size);
474 #if defined(CONFIG_CMD_NET)
476 printf("ip_addr = %s\n", getenv("ipaddr"));
478 #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
479 print_num("FB base ", gd->fb_base);
484 #elif defined(CONFIG_NDS32)
486 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
491 print_num("arch_number", bd->bi_arch_number);
492 print_num("boot_params", (ulong)bd->bi_boot_params);
494 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
495 print_num("DRAM bank", i);
496 print_num("-> start", bd->bi_dram[i].start);
497 print_num("-> size", bd->bi_dram[i].size);
500 #if defined(CONFIG_CMD_NET)
502 printf("ip_addr = %s\n", getenv("ipaddr"));
504 printf("baudrate = %u bps\n", bd->bi_baudrate);
509 #elif defined(CONFIG_OPENRISC)
511 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
515 print_num("mem start", (ulong)bd->bi_memstart);
516 print_lnum("mem size", (u64)bd->bi_memsize);
517 print_num("flash start", (ulong)bd->bi_flashstart);
518 print_num("flash size", (ulong)bd->bi_flashsize);
519 print_num("flash offset", (ulong)bd->bi_flashoffset);
521 #if defined(CONFIG_CMD_NET)
523 printf("ip_addr = %s\n", getenv("ipaddr"));
526 printf("baudrate = %u bps\n", bd->bi_baudrate);
532 #error "a case for this architecture does not exist!"
535 /* -------------------------------------------------------------------- */
538 bdinfo, 1, 1, do_bdinfo,
539 "print Board Info structure",