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 */
133 #if defined(CONFIG_MPC8220)
134 print_mhz("inpfreq", bd->bi_inpfreq);
135 print_mhz("flbfreq", bd->bi_flbfreq);
136 print_mhz("pcifreq", bd->bi_pcifreq);
137 print_mhz("vcofreq", bd->bi_vcofreq);
138 print_mhz("pevfreq", bd->bi_pevfreq);
141 #ifdef CONFIG_ENABLE_36BIT_PHYS
142 #ifdef CONFIG_PHYS_64BIT
143 puts("addressing = 36-bit\n");
145 puts("addressing = 32-bit\n");
150 #if defined(CONFIG_HAS_ETH1)
153 #if defined(CONFIG_HAS_ETH2)
156 #if defined(CONFIG_HAS_ETH3)
159 #if defined(CONFIG_HAS_ETH4)
162 #if defined(CONFIG_HAS_ETH5)
167 print_mhz("ethspeed", bd->bi_ethspeed);
169 printf("IP addr = %s\n", getenv("ipaddr"));
170 printf("baudrate = %6u bps\n", bd->bi_baudrate);
171 print_num("relocaddr", gd->relocaddr);
175 #elif defined(CONFIG_NIOS2)
177 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
181 print_num("mem start", (ulong)bd->bi_memstart);
182 print_lnum("mem size", (u64)bd->bi_memsize);
183 print_num("flash start", (ulong)bd->bi_flashstart);
184 print_num("flash size", (ulong)bd->bi_flashsize);
185 print_num("flash offset", (ulong)bd->bi_flashoffset);
187 #if defined(CONFIG_SYS_SRAM_BASE)
188 print_num ("sram start", (ulong)bd->bi_sramstart);
189 print_num ("sram size", (ulong)bd->bi_sramsize);
192 #if defined(CONFIG_CMD_NET)
194 printf("ip_addr = %s\n", getenv("ipaddr"));
197 printf("baudrate = %u bps\n", bd->bi_baudrate);
202 #elif defined(CONFIG_MICROBLAZE)
204 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
207 print_num("mem start ", (ulong)bd->bi_memstart);
208 print_lnum("mem size ", (u64)bd->bi_memsize);
209 print_num("flash start ", (ulong)bd->bi_flashstart);
210 print_num("flash size ", (ulong)bd->bi_flashsize);
211 print_num("flash offset ", (ulong)bd->bi_flashoffset);
212 #if defined(CONFIG_SYS_SRAM_BASE)
213 print_num("sram start ", (ulong)bd->bi_sramstart);
214 print_num("sram size ", (ulong)bd->bi_sramsize);
216 #if defined(CONFIG_CMD_NET)
219 printf("baudrate = %u bps\n", bd->bi_baudrate);
223 #elif defined(CONFIG_SPARC)
225 int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
230 print_num("bd address ", (ulong) bd);
232 print_num("memstart ", bd->bi_memstart);
233 print_lnum("memsize ", bd->bi_memsize);
234 print_num("flashstart ", bd->bi_flashstart);
235 print_num("CONFIG_SYS_MONITOR_BASE ", CONFIG_SYS_MONITOR_BASE);
236 print_num("CONFIG_ENV_ADDR ", CONFIG_ENV_ADDR);
237 printf("CONFIG_SYS_RELOC_MONITOR_BASE = 0x%x (%d)\n", CONFIG_SYS_RELOC_MONITOR_BASE,
238 CONFIG_SYS_MONITOR_LEN);
239 printf("CONFIG_SYS_MALLOC_BASE = 0x%x (%d)\n", CONFIG_SYS_MALLOC_BASE,
240 CONFIG_SYS_MALLOC_LEN);
241 printf("CONFIG_SYS_INIT_SP_OFFSET = 0x%x (%d)\n", CONFIG_SYS_INIT_SP_OFFSET,
242 CONFIG_SYS_STACK_SIZE);
243 printf("CONFIG_SYS_PROM_OFFSET = 0x%x (%d)\n", CONFIG_SYS_PROM_OFFSET,
244 CONFIG_SYS_PROM_SIZE);
245 printf("CONFIG_SYS_GBL_DATA_OFFSET = 0x%x (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET,
246 GENERATED_GBL_DATA_SIZE);
248 #if defined(CONFIG_CMD_NET)
250 printf("ip_addr = %s\n", getenv("ipaddr"));
252 printf("baudrate = %6u bps\n", bd->bi_baudrate);
256 #elif defined(CONFIG_M68K)
258 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
262 print_num("memstart", (ulong)bd->bi_memstart);
263 print_lnum("memsize", (u64)bd->bi_memsize);
264 print_num("flashstart", (ulong)bd->bi_flashstart);
265 print_num("flashsize", (ulong)bd->bi_flashsize);
266 print_num("flashoffset", (ulong)bd->bi_flashoffset);
267 #if defined(CONFIG_SYS_INIT_RAM_ADDR)
268 print_num("sramstart", (ulong)bd->bi_sramstart);
269 print_num("sramsize", (ulong)bd->bi_sramsize);
271 #if defined(CONFIG_SYS_MBAR)
272 print_num("mbar", bd->bi_mbar_base);
274 print_mhz("cpufreq", bd->bi_intfreq);
275 print_mhz("busfreq", bd->bi_busfreq);
277 print_mhz("pcifreq", bd->bi_pcifreq);
279 #ifdef CONFIG_EXTRA_CLOCK
280 print_mhz("flbfreq", bd->bi_flbfreq);
281 print_mhz("inpfreq", bd->bi_inpfreq);
282 print_mhz("vcofreq", bd->bi_vcofreq);
284 #if defined(CONFIG_CMD_NET)
286 #if defined(CONFIG_HAS_ETH1)
289 #if defined(CONFIG_HAS_ETH2)
292 #if defined(CONFIG_HAS_ETH3)
296 printf("ip_addr = %s\n", getenv("ipaddr"));
298 printf("baudrate = %u bps\n", bd->bi_baudrate);
303 #elif defined(CONFIG_BLACKFIN)
305 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
309 printf("U-Boot = %s\n", bd->bi_r_version);
310 printf("CPU = %s\n", bd->bi_cpu);
311 printf("Board = %s\n", bd->bi_board_name);
312 print_mhz("VCO", bd->bi_vco);
313 print_mhz("CCLK", bd->bi_cclk);
314 print_mhz("SCLK", bd->bi_sclk);
316 print_num("boot_params", (ulong)bd->bi_boot_params);
317 print_num("memstart", (ulong)bd->bi_memstart);
318 print_lnum("memsize", (u64)bd->bi_memsize);
319 print_num("flashstart", (ulong)bd->bi_flashstart);
320 print_num("flashsize", (ulong)bd->bi_flashsize);
321 print_num("flashoffset", (ulong)bd->bi_flashoffset);
324 printf("ip_addr = %s\n", getenv("ipaddr"));
325 printf("baudrate = %u bps\n", bd->bi_baudrate);
330 #elif defined(CONFIG_MIPS)
332 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
336 print_num("boot_params", (ulong)bd->bi_boot_params);
337 print_num("memstart", (ulong)bd->bi_memstart);
338 print_lnum("memsize", (u64)bd->bi_memsize);
339 print_num("flashstart", (ulong)bd->bi_flashstart);
340 print_num("flashsize", (ulong)bd->bi_flashsize);
341 print_num("flashoffset", (ulong)bd->bi_flashoffset);
344 printf("ip_addr = %s\n", getenv("ipaddr"));
345 printf("baudrate = %u bps\n", bd->bi_baudrate);
350 #elif defined(CONFIG_AVR32)
352 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
356 print_num("boot_params", (ulong)bd->bi_boot_params);
357 print_num("memstart", (ulong)bd->bi_memstart);
358 print_lnum("memsize", (u64)bd->bi_memsize);
359 print_num("flashstart", (ulong)bd->bi_flashstart);
360 print_num("flashsize", (ulong)bd->bi_flashsize);
361 print_num("flashoffset", (ulong)bd->bi_flashoffset);
364 printf("ip_addr = %s\n", getenv("ipaddr"));
365 printf("baudrate = %u bps\n", bd->bi_baudrate);
370 #elif defined(CONFIG_ARM)
372 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
377 print_num("arch_number", bd->bi_arch_number);
378 print_num("boot_params", (ulong)bd->bi_boot_params);
380 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
381 print_num("DRAM bank", i);
382 print_num("-> start", bd->bi_dram[i].start);
383 print_num("-> size", bd->bi_dram[i].size);
386 #if defined(CONFIG_CMD_NET)
389 printf("baudrate = %u bps\n", bd->bi_baudrate);
390 #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
391 print_num("TLB addr", gd->arch.tlb_addr);
393 print_num("relocaddr", gd->relocaddr);
394 print_num("reloc off", gd->reloc_off);
395 print_num("irq_sp", gd->irq_sp); /* irq stack pointer */
396 print_num("sp start ", gd->start_addr_sp);
397 #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
398 print_num("FB base ", gd->fb_base);
401 * TODO: Currently only support for davinci SOC's is added.
402 * Remove this check once all the board implement this.
405 printf("ARM frequency = %ld MHz\n", gd->bd->bi_arm_freq);
406 printf("DSP frequency = %ld MHz\n", gd->bd->bi_dsp_freq);
407 printf("DDR frequency = %ld MHz\n", gd->bd->bi_ddr_freq);
412 #elif defined(CONFIG_SH)
414 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
417 print_num("mem start ", (ulong)bd->bi_memstart);
418 print_lnum("mem size ", (u64)bd->bi_memsize);
419 print_num("flash start ", (ulong)bd->bi_flashstart);
420 print_num("flash size ", (ulong)bd->bi_flashsize);
421 print_num("flash offset ", (ulong)bd->bi_flashoffset);
423 #if defined(CONFIG_CMD_NET)
425 printf("ip_addr = %s\n", getenv("ipaddr"));
427 printf("baudrate = %u bps\n", bd->bi_baudrate);
431 #elif defined(CONFIG_X86)
433 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
438 print_num("boot_params", (ulong)bd->bi_boot_params);
439 print_num("bi_memstart", bd->bi_memstart);
440 print_num("bi_memsize", bd->bi_memsize);
441 print_num("bi_flashstart", bd->bi_flashstart);
442 print_num("bi_flashsize", bd->bi_flashsize);
443 print_num("bi_flashoffset", bd->bi_flashoffset);
444 print_num("bi_sramstart", bd->bi_sramstart);
445 print_num("bi_sramsize", bd->bi_sramsize);
446 print_num("bi_bootflags", bd->bi_bootflags);
447 print_mhz("cpufreq", bd->bi_intfreq);
448 print_mhz("busfreq", bd->bi_busfreq);
450 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
451 print_num("DRAM bank", i);
452 print_num("-> start", bd->bi_dram[i].start);
453 print_num("-> size", bd->bi_dram[i].size);
456 #if defined(CONFIG_CMD_NET)
458 printf("ip_addr = %s\n", getenv("ipaddr"));
459 print_mhz("ethspeed", bd->bi_ethspeed);
461 printf("baudrate = %u bps\n", bd->bi_baudrate);
466 #elif defined(CONFIG_SANDBOX)
468 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
473 print_num("boot_params", (ulong)bd->bi_boot_params);
475 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
476 print_num("DRAM bank", i);
477 print_num("-> start", bd->bi_dram[i].start);
478 print_num("-> size", bd->bi_dram[i].size);
481 #if defined(CONFIG_CMD_NET)
483 printf("ip_addr = %s\n", getenv("ipaddr"));
485 #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
486 print_num("FB base ", gd->fb_base);
491 #elif defined(CONFIG_NDS32)
493 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
498 print_num("arch_number", bd->bi_arch_number);
499 print_num("boot_params", (ulong)bd->bi_boot_params);
501 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
502 print_num("DRAM bank", i);
503 print_num("-> start", bd->bi_dram[i].start);
504 print_num("-> size", bd->bi_dram[i].size);
507 #if defined(CONFIG_CMD_NET)
509 printf("ip_addr = %s\n", getenv("ipaddr"));
511 printf("baudrate = %u bps\n", bd->bi_baudrate);
516 #elif defined(CONFIG_OPENRISC)
518 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
522 print_num("mem start", (ulong)bd->bi_memstart);
523 print_lnum("mem size", (u64)bd->bi_memsize);
524 print_num("flash start", (ulong)bd->bi_flashstart);
525 print_num("flash size", (ulong)bd->bi_flashsize);
526 print_num("flash offset", (ulong)bd->bi_flashoffset);
528 #if defined(CONFIG_CMD_NET)
530 printf("ip_addr = %s\n", getenv("ipaddr"));
533 printf("baudrate = %u bps\n", bd->bi_baudrate);
539 #error "a case for this architecture does not exist!"
542 /* -------------------------------------------------------------------- */
545 bdinfo, 1, 1, do_bdinfo,
546 "print Board Info structure",