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)
87 void __weak board_detail(void)
89 /* Please define boot_detail() for your platform */
92 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
97 print_num("bd address", (ulong)bd);
99 print_num("memstart", bd->bi_memstart);
100 print_lnum("memsize", bd->bi_memsize);
101 print_num("flashstart", bd->bi_flashstart);
102 print_num("flashsize", bd->bi_flashsize);
103 print_num("flashoffset", bd->bi_flashoffset);
104 print_num("sramstart", bd->bi_sramstart);
105 print_num("sramsize", bd->bi_sramsize);
106 #if defined(CONFIG_5xx) || defined(CONFIG_8xx) || \
107 defined(CONFIG_8260) || defined(CONFIG_E500)
108 print_num("immr_base", bd->bi_immr_base);
110 print_num("bootflags", bd->bi_bootflags);
111 #if defined(CONFIG_405CR) || defined(CONFIG_405EP) || \
112 defined(CONFIG_405GP) || \
113 defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
114 defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \
115 defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \
116 defined(CONFIG_XILINX_405)
117 print_mhz("procfreq", bd->bi_procfreq);
118 print_mhz("plb_busfreq", bd->bi_plb_busfreq);
119 #if defined(CONFIG_405EP) || defined(CONFIG_405GP) || \
120 defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
121 defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \
122 defined(CONFIG_440SPE) || defined(CONFIG_XILINX_405)
123 print_mhz("pci_busfreq", bd->bi_pci_busfreq);
125 #else /* ! CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
126 #if defined(CONFIG_CPM2)
127 print_mhz("vco", bd->bi_vco);
128 print_mhz("sccfreq", bd->bi_sccfreq);
129 print_mhz("brgfreq", bd->bi_brgfreq);
131 print_mhz("intfreq", bd->bi_intfreq);
132 #if defined(CONFIG_CPM2)
133 print_mhz("cpmfreq", bd->bi_cpmfreq);
135 print_mhz("busfreq", bd->bi_busfreq);
136 #endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
138 #ifdef CONFIG_ENABLE_36BIT_PHYS
139 #ifdef CONFIG_PHYS_64BIT
140 puts("addressing = 36-bit\n");
142 puts("addressing = 32-bit\n");
147 #if defined(CONFIG_HAS_ETH1)
150 #if defined(CONFIG_HAS_ETH2)
153 #if defined(CONFIG_HAS_ETH3)
156 #if defined(CONFIG_HAS_ETH4)
159 #if defined(CONFIG_HAS_ETH5)
164 print_mhz("ethspeed", bd->bi_ethspeed);
166 printf("IP addr = %s\n", getenv("ipaddr"));
167 printf("baudrate = %6u bps\n", bd->bi_baudrate);
168 print_num("relocaddr", gd->relocaddr);
173 #elif defined(CONFIG_NIOS2)
175 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
179 print_num("mem start", (ulong)bd->bi_memstart);
180 print_lnum("mem size", (u64)bd->bi_memsize);
181 print_num("flash start", (ulong)bd->bi_flashstart);
182 print_num("flash size", (ulong)bd->bi_flashsize);
183 print_num("flash offset", (ulong)bd->bi_flashoffset);
185 #if defined(CONFIG_SYS_SRAM_BASE)
186 print_num ("sram start", (ulong)bd->bi_sramstart);
187 print_num ("sram size", (ulong)bd->bi_sramsize);
190 #if defined(CONFIG_CMD_NET)
192 printf("ip_addr = %s\n", getenv("ipaddr"));
195 printf("baudrate = %u bps\n", bd->bi_baudrate);
200 #elif defined(CONFIG_MICROBLAZE)
202 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
205 print_num("mem start ", (ulong)bd->bi_memstart);
206 print_lnum("mem size ", (u64)bd->bi_memsize);
207 print_num("flash start ", (ulong)bd->bi_flashstart);
208 print_num("flash size ", (ulong)bd->bi_flashsize);
209 print_num("flash offset ", (ulong)bd->bi_flashoffset);
210 #if defined(CONFIG_SYS_SRAM_BASE)
211 print_num("sram start ", (ulong)bd->bi_sramstart);
212 print_num("sram size ", (ulong)bd->bi_sramsize);
214 #if defined(CONFIG_CMD_NET)
217 printf("baudrate = %u bps\n", bd->bi_baudrate);
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", bd->bi_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", bd->bi_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", bd->bi_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", bd->bi_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_memstart);
356 print_lnum("memsize", (u64)bd->bi_memsize);
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", bd->bi_baudrate);
368 #elif defined(CONFIG_ARM)
370 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
375 print_num("arch_number", bd->bi_arch_number);
376 print_num("boot_params", (ulong)bd->bi_boot_params);
378 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
379 print_num("DRAM bank", i);
380 print_num("-> start", bd->bi_dram[i].start);
381 print_num("-> size", bd->bi_dram[i].size);
384 #if defined(CONFIG_CMD_NET)
387 printf("baudrate = %u bps\n", bd->bi_baudrate);
388 #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
389 print_num("TLB addr", gd->arch.tlb_addr);
391 print_num("relocaddr", gd->relocaddr);
392 print_num("reloc off", gd->reloc_off);
393 print_num("irq_sp", gd->irq_sp); /* irq stack pointer */
394 print_num("sp start ", gd->start_addr_sp);
395 #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
396 print_num("FB base ", gd->fb_base);
399 * TODO: Currently only support for davinci SOC's is added.
400 * Remove this check once all the board implement this.
403 printf("ARM frequency = %ld MHz\n", gd->bd->bi_arm_freq);
404 printf("DSP frequency = %ld MHz\n", gd->bd->bi_dsp_freq);
405 printf("DDR frequency = %ld MHz\n", gd->bd->bi_ddr_freq);
410 #elif defined(CONFIG_SH)
412 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
415 print_num("mem start ", (ulong)bd->bi_memstart);
416 print_lnum("mem size ", (u64)bd->bi_memsize);
417 print_num("flash start ", (ulong)bd->bi_flashstart);
418 print_num("flash size ", (ulong)bd->bi_flashsize);
419 print_num("flash offset ", (ulong)bd->bi_flashoffset);
421 #if defined(CONFIG_CMD_NET)
423 printf("ip_addr = %s\n", getenv("ipaddr"));
425 printf("baudrate = %u bps\n", bd->bi_baudrate);
429 #elif defined(CONFIG_X86)
431 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
436 print_num("boot_params", (ulong)bd->bi_boot_params);
437 print_num("bi_memstart", bd->bi_memstart);
438 print_num("bi_memsize", bd->bi_memsize);
439 print_num("bi_flashstart", bd->bi_flashstart);
440 print_num("bi_flashsize", bd->bi_flashsize);
441 print_num("bi_flashoffset", bd->bi_flashoffset);
442 print_num("bi_sramstart", bd->bi_sramstart);
443 print_num("bi_sramsize", bd->bi_sramsize);
444 print_num("bi_bootflags", bd->bi_bootflags);
445 print_mhz("cpufreq", bd->bi_intfreq);
446 print_mhz("busfreq", bd->bi_busfreq);
448 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
449 print_num("DRAM bank", i);
450 print_num("-> start", bd->bi_dram[i].start);
451 print_num("-> size", bd->bi_dram[i].size);
454 #if defined(CONFIG_CMD_NET)
456 printf("ip_addr = %s\n", getenv("ipaddr"));
457 print_mhz("ethspeed", bd->bi_ethspeed);
459 printf("baudrate = %u bps\n", bd->bi_baudrate);
464 #elif defined(CONFIG_SANDBOX)
466 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
471 print_num("boot_params", (ulong)bd->bi_boot_params);
473 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
474 print_num("DRAM bank", i);
475 print_num("-> start", bd->bi_dram[i].start);
476 print_num("-> size", bd->bi_dram[i].size);
479 #if defined(CONFIG_CMD_NET)
481 printf("ip_addr = %s\n", getenv("ipaddr"));
483 #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
484 print_num("FB base ", gd->fb_base);
489 #elif defined(CONFIG_NDS32)
491 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
496 print_num("arch_number", bd->bi_arch_number);
497 print_num("boot_params", (ulong)bd->bi_boot_params);
499 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
500 print_num("DRAM bank", i);
501 print_num("-> start", bd->bi_dram[i].start);
502 print_num("-> size", bd->bi_dram[i].size);
505 #if defined(CONFIG_CMD_NET)
507 printf("ip_addr = %s\n", getenv("ipaddr"));
509 printf("baudrate = %u bps\n", bd->bi_baudrate);
514 #elif defined(CONFIG_OPENRISC)
516 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
520 print_num("mem start", (ulong)bd->bi_memstart);
521 print_lnum("mem size", (u64)bd->bi_memsize);
522 print_num("flash start", (ulong)bd->bi_flashstart);
523 print_num("flash size", (ulong)bd->bi_flashsize);
524 print_num("flash offset", (ulong)bd->bi_flashoffset);
526 #if defined(CONFIG_CMD_NET)
528 printf("ip_addr = %s\n", getenv("ipaddr"));
531 printf("baudrate = %u bps\n", bd->bi_baudrate);
537 #error "a case for this architecture does not exist!"
540 /* -------------------------------------------------------------------- */
543 bdinfo, 1, 1, do_bdinfo,
544 "print Board Info structure",