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,
30 DECLARE_GLOBAL_DATA_PTR;
32 static void print_num(const char *, ulong);
34 #if !(defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_SANDBOX)) \
35 || defined(CONFIG_CMD_NET)
36 #define HAVE_PRINT_ETH
37 static void print_eth(int idx);
40 #if (!defined(CONFIG_ARM) && !defined(CONFIG_X86) && !defined(CONFIG_SANDBOX))
41 #define HAVE_PRINT_LNUM
42 static void print_lnum(const char *, u64);
45 #if defined(CONFIG_PPC)
46 static void print_mhz(const char *, unsigned long);
48 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
53 print_num("bd address", (ulong)bd);
55 print_num("memstart", bd->bi_memstart);
56 print_lnum("memsize", bd->bi_memsize);
57 print_num("flashstart", bd->bi_flashstart);
58 print_num("flashsize", bd->bi_flashsize);
59 print_num("flashoffset", bd->bi_flashoffset);
60 print_num("sramstart", bd->bi_sramstart);
61 print_num("sramsize", bd->bi_sramsize);
62 #if defined(CONFIG_5xx) || defined(CONFIG_8xx) || \
63 defined(CONFIG_8260) || defined(CONFIG_E500)
64 print_num("immr_base", bd->bi_immr_base);
66 print_num("bootflags", bd->bi_bootflags);
67 #if defined(CONFIG_405CR) || defined(CONFIG_405EP) || \
68 defined(CONFIG_405GP) || \
69 defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
70 defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \
71 defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \
72 defined(CONFIG_XILINX_405)
73 print_mhz("procfreq", bd->bi_procfreq);
74 print_mhz("plb_busfreq", bd->bi_plb_busfreq);
75 #if defined(CONFIG_405EP) || defined(CONFIG_405GP) || \
76 defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
77 defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \
78 defined(CONFIG_440SPE) || defined(CONFIG_XILINX_405)
79 print_mhz("pci_busfreq", bd->bi_pci_busfreq);
81 #else /* ! CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
82 #if defined(CONFIG_CPM2)
83 print_mhz("vco", bd->bi_vco);
84 print_mhz("sccfreq", bd->bi_sccfreq);
85 print_mhz("brgfreq", bd->bi_brgfreq);
87 print_mhz("intfreq", bd->bi_intfreq);
88 #if defined(CONFIG_CPM2)
89 print_mhz("cpmfreq", bd->bi_cpmfreq);
91 print_mhz("busfreq", bd->bi_busfreq);
92 #endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
93 #if defined(CONFIG_MPC8220)
94 print_mhz("inpfreq", bd->bi_inpfreq);
95 print_mhz("flbfreq", bd->bi_flbfreq);
96 print_mhz("pcifreq", bd->bi_pcifreq);
97 print_mhz("vcofreq", bd->bi_vcofreq);
98 print_mhz("pevfreq", bd->bi_pevfreq);
102 #if defined(CONFIG_HAS_ETH1)
105 #if defined(CONFIG_HAS_ETH2)
108 #if defined(CONFIG_HAS_ETH3)
111 #if defined(CONFIG_HAS_ETH4)
114 #if defined(CONFIG_HAS_ETH5)
119 print_mhz("ethspeed", bd->bi_ethspeed);
121 printf("IP addr = %pI4\n", &bd->bi_ip_addr);
122 printf("baudrate = %6ld bps\n", bd->bi_baudrate);
123 print_num("relocaddr", gd->relocaddr);
127 #elif defined(CONFIG_NIOS2)
129 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
133 print_num("mem start", (ulong)bd->bi_memstart);
134 print_lnum("mem size", (u64)bd->bi_memsize);
135 print_num("flash start", (ulong)bd->bi_flashstart);
136 print_num("flash size", (ulong)bd->bi_flashsize);
137 print_num("flash offset", (ulong)bd->bi_flashoffset);
139 #if defined(CONFIG_SYS_SRAM_BASE)
140 print_num ("sram start", (ulong)bd->bi_sramstart);
141 print_num ("sram size", (ulong)bd->bi_sramsize);
144 #if defined(CONFIG_CMD_NET)
146 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
149 printf("baudrate = %ld bps\n", bd->bi_baudrate);
154 #elif defined(CONFIG_MICROBLAZE)
156 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
159 print_num("mem start ", (ulong)bd->bi_memstart);
160 print_lnum("mem size ", (u64)bd->bi_memsize);
161 print_num("flash start ", (ulong)bd->bi_flashstart);
162 print_num("flash size ", (ulong)bd->bi_flashsize);
163 print_num("flash offset ", (ulong)bd->bi_flashoffset);
164 #if defined(CONFIG_SYS_SRAM_BASE)
165 print_num("sram start ", (ulong)bd->bi_sramstart);
166 print_num("sram size ", (ulong)bd->bi_sramsize);
168 #if defined(CONFIG_CMD_NET)
170 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
172 printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
176 #elif defined(CONFIG_SPARC)
178 int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
183 print_num("bd address ", (ulong) bd);
185 print_num("memstart ", bd->bi_memstart);
186 print_lnum("memsize ", bd->bi_memsize);
187 print_num("flashstart ", bd->bi_flashstart);
188 print_num("CONFIG_SYS_MONITOR_BASE ", CONFIG_SYS_MONITOR_BASE);
189 print_num("CONFIG_ENV_ADDR ", CONFIG_ENV_ADDR);
190 printf("CONFIG_SYS_RELOC_MONITOR_BASE = 0x%lx (%d)\n", CONFIG_SYS_RELOC_MONITOR_BASE,
191 CONFIG_SYS_MONITOR_LEN);
192 printf("CONFIG_SYS_MALLOC_BASE = 0x%lx (%d)\n", CONFIG_SYS_MALLOC_BASE,
193 CONFIG_SYS_MALLOC_LEN);
194 printf("CONFIG_SYS_INIT_SP_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_INIT_SP_OFFSET,
195 CONFIG_SYS_STACK_SIZE);
196 printf("CONFIG_SYS_PROM_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_PROM_OFFSET,
197 CONFIG_SYS_PROM_SIZE);
198 printf("CONFIG_SYS_GBL_DATA_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET,
199 GENERATED_GBL_DATA_SIZE);
201 #if defined(CONFIG_CMD_NET)
203 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
205 printf("baudrate = %6ld bps\n", bd->bi_baudrate);
209 #elif defined(CONFIG_M68K)
211 static void print_mhz(const char *, unsigned long);
213 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
217 print_num("memstart", (ulong)bd->bi_memstart);
218 print_lnum("memsize", (u64)bd->bi_memsize);
219 print_num("flashstart", (ulong)bd->bi_flashstart);
220 print_num("flashsize", (ulong)bd->bi_flashsize);
221 print_num("flashoffset", (ulong)bd->bi_flashoffset);
222 #if defined(CONFIG_SYS_INIT_RAM_ADDR)
223 print_num("sramstart", (ulong)bd->bi_sramstart);
224 print_num("sramsize", (ulong)bd->bi_sramsize);
226 #if defined(CONFIG_SYS_MBAR)
227 print_num("mbar", bd->bi_mbar_base);
229 print_mhz("cpufreq", bd->bi_intfreq);
230 print_mhz("busfreq", bd->bi_busfreq);
232 print_mhz("pcifreq", bd->bi_pcifreq);
234 #ifdef CONFIG_EXTRA_CLOCK
235 print_mhz("flbfreq", bd->bi_flbfreq);
236 print_mhz("inpfreq", bd->bi_inpfreq);
237 print_mhz("vcofreq", bd->bi_vcofreq);
239 #if defined(CONFIG_CMD_NET)
241 #if defined(CONFIG_HAS_ETH1)
244 #if defined(CONFIG_HAS_ETH2)
247 #if defined(CONFIG_HAS_ETH3)
251 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
253 printf("baudrate = %ld bps\n", bd->bi_baudrate);
258 #elif defined(CONFIG_BLACKFIN)
260 static void print_mhz(const char *, unsigned long);
262 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
266 printf("U-Boot = %s\n", bd->bi_r_version);
267 printf("CPU = %s\n", bd->bi_cpu);
268 printf("Board = %s\n", bd->bi_board_name);
269 print_mhz("VCO", bd->bi_vco);
270 print_mhz("CCLK", bd->bi_cclk);
271 print_mhz("SCLK", bd->bi_sclk);
273 print_num("boot_params", (ulong)bd->bi_boot_params);
274 print_num("memstart", (ulong)bd->bi_memstart);
275 print_lnum("memsize", (u64)bd->bi_memsize);
276 print_num("flashstart", (ulong)bd->bi_flashstart);
277 print_num("flashsize", (ulong)bd->bi_flashsize);
278 print_num("flashoffset", (ulong)bd->bi_flashoffset);
281 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
282 printf("baudrate = %d bps\n", bd->bi_baudrate);
287 #elif defined(CONFIG_MIPS)
289 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
293 print_num("boot_params", (ulong)bd->bi_boot_params);
294 print_num("memstart", (ulong)bd->bi_memstart);
295 print_lnum("memsize", (u64)bd->bi_memsize);
296 print_num("flashstart", (ulong)bd->bi_flashstart);
297 print_num("flashsize", (ulong)bd->bi_flashsize);
298 print_num("flashoffset", (ulong)bd->bi_flashoffset);
301 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
302 printf("baudrate = %d bps\n", bd->bi_baudrate);
307 #elif defined(CONFIG_AVR32)
309 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
313 print_num("boot_params", (ulong)bd->bi_boot_params);
314 print_num("memstart", (ulong)bd->bi_memstart);
315 print_lnum("memsize", (u64)bd->bi_memsize);
316 print_num("flashstart", (ulong)bd->bi_flashstart);
317 print_num("flashsize", (ulong)bd->bi_flashsize);
318 print_num("flashoffset", (ulong)bd->bi_flashoffset);
321 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
322 printf("baudrate = %lu bps\n", bd->bi_baudrate);
327 #elif defined(CONFIG_ARM)
329 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
334 print_num("arch_number", bd->bi_arch_number);
335 print_num("boot_params", (ulong)bd->bi_boot_params);
337 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
338 print_num("DRAM bank", i);
339 print_num("-> start", bd->bi_dram[i].start);
340 print_num("-> size", bd->bi_dram[i].size);
343 #if defined(CONFIG_CMD_NET)
345 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
347 printf("baudrate = %d bps\n", bd->bi_baudrate);
348 #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
349 print_num("TLB addr", gd->tlb_addr);
351 print_num("relocaddr", gd->relocaddr);
352 print_num("reloc off", gd->reloc_off);
353 print_num("irq_sp", gd->irq_sp); /* irq stack pointer */
354 print_num("sp start ", gd->start_addr_sp);
355 print_num("FB base ", gd->fb_base);
359 #elif defined(CONFIG_SH)
361 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
364 print_num("mem start ", (ulong)bd->bi_memstart);
365 print_lnum("mem size ", (u64)bd->bi_memsize);
366 print_num("flash start ", (ulong)bd->bi_flashstart);
367 print_num("flash size ", (ulong)bd->bi_flashsize);
368 print_num("flash offset ", (ulong)bd->bi_flashoffset);
370 #if defined(CONFIG_CMD_NET)
372 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
374 printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
378 #elif defined(CONFIG_X86)
380 static void print_mhz(const char *, unsigned long);
382 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
387 print_num("boot_params", (ulong)bd->bi_boot_params);
388 print_num("bi_memstart", bd->bi_memstart);
389 print_num("bi_memsize", bd->bi_memsize);
390 print_num("bi_flashstart", bd->bi_flashstart);
391 print_num("bi_flashsize", bd->bi_flashsize);
392 print_num("bi_flashoffset", bd->bi_flashoffset);
393 print_num("bi_sramstart", bd->bi_sramstart);
394 print_num("bi_sramsize", bd->bi_sramsize);
395 print_num("bi_bootflags", bd->bi_bootflags);
396 print_mhz("cpufreq", bd->bi_intfreq);
397 print_mhz("busfreq", bd->bi_busfreq);
399 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
400 print_num("DRAM bank", i);
401 print_num("-> start", bd->bi_dram[i].start);
402 print_num("-> size", bd->bi_dram[i].size);
405 #if defined(CONFIG_CMD_NET)
407 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
408 print_mhz("ethspeed", bd->bi_ethspeed);
410 printf("baudrate = %d bps\n", bd->bi_baudrate);
415 #elif defined(CONFIG_SANDBOX)
417 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
422 print_num("boot_params", (ulong)bd->bi_boot_params);
424 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
425 print_num("DRAM bank", i);
426 print_num("-> start", bd->bi_dram[i].start);
427 print_num("-> size", bd->bi_dram[i].size);
430 #if defined(CONFIG_CMD_NET)
432 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
434 print_num("FB base ", gd->fb_base);
438 #elif defined(CONFIG_NDS32)
440 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
445 print_num("arch_number", bd->bi_arch_number);
446 print_num("boot_params", (ulong)bd->bi_boot_params);
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 = %pI4\n", &bd->bi_ip_addr);
458 printf("baudrate = %d bps\n", bd->bi_baudrate);
464 #error "a case for this architecture does not exist!"
467 static void print_num(const char *name, ulong value)
469 printf("%-12s= 0x%08lX\n", name, value);
472 #ifdef HAVE_PRINT_ETH
473 static void print_eth(int idx)
477 sprintf(name, "eth%iaddr", idx);
479 strcpy(name, "ethaddr");
483 printf("%-12s= %s\n", name, val);
487 #ifdef HAVE_PRINT_LNUM
488 static void print_lnum(const char *name, u64 value)
490 printf("%-12s= 0x%.8llX\n", name, value);
494 #if defined(CONFIG_PPC) || \
495 defined(CONFIG_M68K) || \
496 defined(CONFIG_BLACKFIN) || \
498 static void print_mhz(const char *name, unsigned long hz)
502 printf("%-12s= %6s MHz\n", name, strmhz(buf, hz));
504 #endif /* CONFIG_PPC */
507 /* -------------------------------------------------------------------- */
510 bdinfo, 1, 1, do_bdinfo,
511 "print Board Info structure",