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_lnum(const char *name, u64 value)
56 printf("%-12s= 0x%.8llX\n", name, value);
60 static void print_mhz(const char *name, unsigned long hz)
64 printf("%-12s= %6s MHz\n", name, strmhz(buf, hz));
67 #if defined(CONFIG_PPC)
69 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
74 print_num("bd address", (ulong)bd);
76 print_num("memstart", bd->bi_memstart);
77 print_lnum("memsize", bd->bi_memsize);
78 print_num("flashstart", bd->bi_flashstart);
79 print_num("flashsize", bd->bi_flashsize);
80 print_num("flashoffset", bd->bi_flashoffset);
81 print_num("sramstart", bd->bi_sramstart);
82 print_num("sramsize", bd->bi_sramsize);
83 #if defined(CONFIG_5xx) || defined(CONFIG_8xx) || \
84 defined(CONFIG_8260) || defined(CONFIG_E500)
85 print_num("immr_base", bd->bi_immr_base);
87 print_num("bootflags", bd->bi_bootflags);
88 #if defined(CONFIG_405CR) || defined(CONFIG_405EP) || \
89 defined(CONFIG_405GP) || \
90 defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
91 defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \
92 defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \
93 defined(CONFIG_XILINX_405)
94 print_mhz("procfreq", bd->bi_procfreq);
95 print_mhz("plb_busfreq", bd->bi_plb_busfreq);
96 #if defined(CONFIG_405EP) || defined(CONFIG_405GP) || \
97 defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
98 defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \
99 defined(CONFIG_440SPE) || defined(CONFIG_XILINX_405)
100 print_mhz("pci_busfreq", bd->bi_pci_busfreq);
102 #else /* ! CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
103 #if defined(CONFIG_CPM2)
104 print_mhz("vco", bd->bi_vco);
105 print_mhz("sccfreq", bd->bi_sccfreq);
106 print_mhz("brgfreq", bd->bi_brgfreq);
108 print_mhz("intfreq", bd->bi_intfreq);
109 #if defined(CONFIG_CPM2)
110 print_mhz("cpmfreq", bd->bi_cpmfreq);
112 print_mhz("busfreq", bd->bi_busfreq);
113 #endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
114 #if defined(CONFIG_MPC8220)
115 print_mhz("inpfreq", bd->bi_inpfreq);
116 print_mhz("flbfreq", bd->bi_flbfreq);
117 print_mhz("pcifreq", bd->bi_pcifreq);
118 print_mhz("vcofreq", bd->bi_vcofreq);
119 print_mhz("pevfreq", bd->bi_pevfreq);
123 #if defined(CONFIG_HAS_ETH1)
126 #if defined(CONFIG_HAS_ETH2)
129 #if defined(CONFIG_HAS_ETH3)
132 #if defined(CONFIG_HAS_ETH4)
135 #if defined(CONFIG_HAS_ETH5)
140 print_mhz("ethspeed", bd->bi_ethspeed);
142 printf("IP addr = %pI4\n", &bd->bi_ip_addr);
143 printf("baudrate = %6ld bps\n", bd->bi_baudrate);
144 print_num("relocaddr", gd->relocaddr);
148 #elif defined(CONFIG_NIOS2)
150 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
154 print_num("mem start", (ulong)bd->bi_memstart);
155 print_lnum("mem size", (u64)bd->bi_memsize);
156 print_num("flash start", (ulong)bd->bi_flashstart);
157 print_num("flash size", (ulong)bd->bi_flashsize);
158 print_num("flash offset", (ulong)bd->bi_flashoffset);
160 #if defined(CONFIG_SYS_SRAM_BASE)
161 print_num ("sram start", (ulong)bd->bi_sramstart);
162 print_num ("sram size", (ulong)bd->bi_sramsize);
165 #if defined(CONFIG_CMD_NET)
167 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
170 printf("baudrate = %ld bps\n", bd->bi_baudrate);
175 #elif defined(CONFIG_MICROBLAZE)
177 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
180 print_num("mem start ", (ulong)bd->bi_memstart);
181 print_lnum("mem size ", (u64)bd->bi_memsize);
182 print_num("flash start ", (ulong)bd->bi_flashstart);
183 print_num("flash size ", (ulong)bd->bi_flashsize);
184 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);
189 #if defined(CONFIG_CMD_NET)
191 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
193 printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
197 #elif defined(CONFIG_SPARC)
199 int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
204 print_num("bd address ", (ulong) bd);
206 print_num("memstart ", bd->bi_memstart);
207 print_lnum("memsize ", bd->bi_memsize);
208 print_num("flashstart ", bd->bi_flashstart);
209 print_num("CONFIG_SYS_MONITOR_BASE ", CONFIG_SYS_MONITOR_BASE);
210 print_num("CONFIG_ENV_ADDR ", CONFIG_ENV_ADDR);
211 printf("CONFIG_SYS_RELOC_MONITOR_BASE = 0x%lx (%d)\n", CONFIG_SYS_RELOC_MONITOR_BASE,
212 CONFIG_SYS_MONITOR_LEN);
213 printf("CONFIG_SYS_MALLOC_BASE = 0x%lx (%d)\n", CONFIG_SYS_MALLOC_BASE,
214 CONFIG_SYS_MALLOC_LEN);
215 printf("CONFIG_SYS_INIT_SP_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_INIT_SP_OFFSET,
216 CONFIG_SYS_STACK_SIZE);
217 printf("CONFIG_SYS_PROM_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_PROM_OFFSET,
218 CONFIG_SYS_PROM_SIZE);
219 printf("CONFIG_SYS_GBL_DATA_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET,
220 GENERATED_GBL_DATA_SIZE);
222 #if defined(CONFIG_CMD_NET)
224 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
226 printf("baudrate = %6ld bps\n", bd->bi_baudrate);
230 #elif defined(CONFIG_M68K)
232 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
236 print_num("memstart", (ulong)bd->bi_memstart);
237 print_lnum("memsize", (u64)bd->bi_memsize);
238 print_num("flashstart", (ulong)bd->bi_flashstart);
239 print_num("flashsize", (ulong)bd->bi_flashsize);
240 print_num("flashoffset", (ulong)bd->bi_flashoffset);
241 #if defined(CONFIG_SYS_INIT_RAM_ADDR)
242 print_num("sramstart", (ulong)bd->bi_sramstart);
243 print_num("sramsize", (ulong)bd->bi_sramsize);
245 #if defined(CONFIG_SYS_MBAR)
246 print_num("mbar", bd->bi_mbar_base);
248 print_mhz("cpufreq", bd->bi_intfreq);
249 print_mhz("busfreq", bd->bi_busfreq);
251 print_mhz("pcifreq", bd->bi_pcifreq);
253 #ifdef CONFIG_EXTRA_CLOCK
254 print_mhz("flbfreq", bd->bi_flbfreq);
255 print_mhz("inpfreq", bd->bi_inpfreq);
256 print_mhz("vcofreq", bd->bi_vcofreq);
258 #if defined(CONFIG_CMD_NET)
260 #if defined(CONFIG_HAS_ETH1)
263 #if defined(CONFIG_HAS_ETH2)
266 #if defined(CONFIG_HAS_ETH3)
270 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
272 printf("baudrate = %ld bps\n", bd->bi_baudrate);
277 #elif defined(CONFIG_BLACKFIN)
279 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
283 printf("U-Boot = %s\n", bd->bi_r_version);
284 printf("CPU = %s\n", bd->bi_cpu);
285 printf("Board = %s\n", bd->bi_board_name);
286 print_mhz("VCO", bd->bi_vco);
287 print_mhz("CCLK", bd->bi_cclk);
288 print_mhz("SCLK", bd->bi_sclk);
290 print_num("boot_params", (ulong)bd->bi_boot_params);
291 print_num("memstart", (ulong)bd->bi_memstart);
292 print_lnum("memsize", (u64)bd->bi_memsize);
293 print_num("flashstart", (ulong)bd->bi_flashstart);
294 print_num("flashsize", (ulong)bd->bi_flashsize);
295 print_num("flashoffset", (ulong)bd->bi_flashoffset);
298 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
299 printf("baudrate = %d bps\n", bd->bi_baudrate);
304 #elif defined(CONFIG_MIPS)
306 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
310 print_num("boot_params", (ulong)bd->bi_boot_params);
311 print_num("memstart", (ulong)bd->bi_memstart);
312 print_lnum("memsize", (u64)bd->bi_memsize);
313 print_num("flashstart", (ulong)bd->bi_flashstart);
314 print_num("flashsize", (ulong)bd->bi_flashsize);
315 print_num("flashoffset", (ulong)bd->bi_flashoffset);
318 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
319 printf("baudrate = %d bps\n", bd->bi_baudrate);
324 #elif defined(CONFIG_AVR32)
326 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
330 print_num("boot_params", (ulong)bd->bi_boot_params);
331 print_num("memstart", (ulong)bd->bi_memstart);
332 print_lnum("memsize", (u64)bd->bi_memsize);
333 print_num("flashstart", (ulong)bd->bi_flashstart);
334 print_num("flashsize", (ulong)bd->bi_flashsize);
335 print_num("flashoffset", (ulong)bd->bi_flashoffset);
338 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
339 printf("baudrate = %lu bps\n", bd->bi_baudrate);
344 #elif defined(CONFIG_ARM)
346 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
351 print_num("arch_number", bd->bi_arch_number);
352 print_num("boot_params", (ulong)bd->bi_boot_params);
354 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
355 print_num("DRAM bank", i);
356 print_num("-> start", bd->bi_dram[i].start);
357 print_num("-> size", bd->bi_dram[i].size);
360 #if defined(CONFIG_CMD_NET)
362 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
364 printf("baudrate = %d bps\n", bd->bi_baudrate);
365 #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
366 print_num("TLB addr", gd->tlb_addr);
368 print_num("relocaddr", gd->relocaddr);
369 print_num("reloc off", gd->reloc_off);
370 print_num("irq_sp", gd->irq_sp); /* irq stack pointer */
371 print_num("sp start ", gd->start_addr_sp);
372 print_num("FB base ", gd->fb_base);
376 #elif defined(CONFIG_SH)
378 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
381 print_num("mem start ", (ulong)bd->bi_memstart);
382 print_lnum("mem size ", (u64)bd->bi_memsize);
383 print_num("flash start ", (ulong)bd->bi_flashstart);
384 print_num("flash size ", (ulong)bd->bi_flashsize);
385 print_num("flash offset ", (ulong)bd->bi_flashoffset);
387 #if defined(CONFIG_CMD_NET)
389 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
391 printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
395 #elif defined(CONFIG_X86)
397 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
402 print_num("boot_params", (ulong)bd->bi_boot_params);
403 print_num("bi_memstart", bd->bi_memstart);
404 print_num("bi_memsize", bd->bi_memsize);
405 print_num("bi_flashstart", bd->bi_flashstart);
406 print_num("bi_flashsize", bd->bi_flashsize);
407 print_num("bi_flashoffset", bd->bi_flashoffset);
408 print_num("bi_sramstart", bd->bi_sramstart);
409 print_num("bi_sramsize", bd->bi_sramsize);
410 print_num("bi_bootflags", bd->bi_bootflags);
411 print_mhz("cpufreq", bd->bi_intfreq);
412 print_mhz("busfreq", bd->bi_busfreq);
414 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
415 print_num("DRAM bank", i);
416 print_num("-> start", bd->bi_dram[i].start);
417 print_num("-> size", bd->bi_dram[i].size);
420 #if defined(CONFIG_CMD_NET)
422 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
423 print_mhz("ethspeed", bd->bi_ethspeed);
425 printf("baudrate = %d bps\n", bd->bi_baudrate);
430 #elif defined(CONFIG_SANDBOX)
432 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
437 print_num("boot_params", (ulong)bd->bi_boot_params);
439 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
440 print_num("DRAM bank", i);
441 print_num("-> start", bd->bi_dram[i].start);
442 print_num("-> size", bd->bi_dram[i].size);
445 #if defined(CONFIG_CMD_NET)
447 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
449 print_num("FB base ", gd->fb_base);
453 #elif defined(CONFIG_NDS32)
455 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
460 print_num("arch_number", bd->bi_arch_number);
461 print_num("boot_params", (ulong)bd->bi_boot_params);
463 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
464 print_num("DRAM bank", i);
465 print_num("-> start", bd->bi_dram[i].start);
466 print_num("-> size", bd->bi_dram[i].size);
469 #if defined(CONFIG_CMD_NET)
471 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
473 printf("baudrate = %d bps\n", bd->bi_baudrate);
478 #elif defined(CONFIG_OPENRISC)
480 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
484 print_num("mem start", (ulong)bd->bi_memstart);
485 print_lnum("mem size", (u64)bd->bi_memsize);
486 print_num("flash start", (ulong)bd->bi_flashstart);
487 print_num("flash size", (ulong)bd->bi_flashsize);
488 print_num("flash offset", (ulong)bd->bi_flashoffset);
490 #if defined(CONFIG_CMD_NET)
492 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
495 printf("baudrate = %ld bps\n", bd->bi_baudrate);
501 #error "a case for this architecture does not exist!"
504 /* -------------------------------------------------------------------- */
507 bdinfo, 1, 1, do_bdinfo,
508 "print Board Info structure",