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_CMD_NET)
35 static void print_eth(int idx);
38 #if (!defined(CONFIG_ARM) && !defined(CONFIG_X86))
39 static void print_lnum(const char *, u64);
42 #if defined(CONFIG_PPC)
43 static void print_str(const char *, const char *);
45 int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
51 print_num ("bd address", (ulong)bd );
53 print_num ("memstart", bd->bi_memstart );
54 print_lnum ("memsize", bd->bi_memsize );
55 print_num ("flashstart", bd->bi_flashstart );
56 print_num ("flashsize", bd->bi_flashsize );
57 print_num ("flashoffset", bd->bi_flashoffset );
58 print_num ("sramstart", bd->bi_sramstart );
59 print_num ("sramsize", bd->bi_sramsize );
60 #if defined(CONFIG_5xx) || defined(CONFIG_8xx) || \
61 defined(CONFIG_8260) || defined(CONFIG_E500)
62 print_num ("immr_base", bd->bi_immr_base );
64 print_num ("bootflags", bd->bi_bootflags );
65 #if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \
66 defined(CONFIG_405EP) || defined(CONFIG_XILINX_405) || \
67 defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
68 defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
69 defined(CONFIG_440SP) || defined(CONFIG_440SPE)
70 print_str ("procfreq", strmhz(buf, bd->bi_procfreq));
71 print_str ("plb_busfreq", strmhz(buf, bd->bi_plb_busfreq));
72 #if defined(CONFIG_405GP) || defined(CONFIG_405EP) || defined(CONFIG_XILINX_405) || \
73 defined(CONFIG_440EP) || defined(CONFIG_440GR) || defined(CONFIG_440SPE) || \
74 defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
75 print_str ("pci_busfreq", strmhz(buf, bd->bi_pci_busfreq));
77 #else /* ! CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
78 #if defined(CONFIG_CPM2)
79 print_str ("vco", strmhz(buf, bd->bi_vco));
80 print_str ("sccfreq", strmhz(buf, bd->bi_sccfreq));
81 print_str ("brgfreq", strmhz(buf, bd->bi_brgfreq));
83 print_str ("intfreq", strmhz(buf, bd->bi_intfreq));
84 #if defined(CONFIG_CPM2)
85 print_str ("cpmfreq", strmhz(buf, bd->bi_cpmfreq));
87 print_str ("busfreq", strmhz(buf, bd->bi_busfreq));
88 #endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
89 #if defined(CONFIG_MPC8220)
90 print_str ("inpfreq", strmhz(buf, bd->bi_inpfreq));
91 print_str ("flbfreq", strmhz(buf, bd->bi_flbfreq));
92 print_str ("pcifreq", strmhz(buf, bd->bi_pcifreq));
93 print_str ("vcofreq", strmhz(buf, bd->bi_vcofreq));
94 print_str ("pevfreq", strmhz(buf, bd->bi_pevfreq));
98 #if defined(CONFIG_HAS_ETH1)
101 #if defined(CONFIG_HAS_ETH2)
104 #if defined(CONFIG_HAS_ETH3)
107 #if defined(CONFIG_HAS_ETH4)
110 #if defined(CONFIG_HAS_ETH5)
115 print_str ("ethspeed", strmhz(buf, bd->bi_ethspeed));
117 printf ("IP addr = %pI4\n", &bd->bi_ip_addr);
118 printf ("baudrate = %6ld bps\n", bd->bi_baudrate );
119 print_num ("relocaddr", gd->relocaddr);
123 #elif defined(CONFIG_NIOS2)
125 int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
129 print_num ("mem start", (ulong)bd->bi_memstart);
130 print_lnum ("mem size", (u64)bd->bi_memsize);
131 print_num ("flash start", (ulong)bd->bi_flashstart);
132 print_num ("flash size", (ulong)bd->bi_flashsize);
133 print_num ("flash offset", (ulong)bd->bi_flashoffset);
135 #if defined(CONFIG_SYS_SRAM_BASE)
136 print_num ("sram start", (ulong)bd->bi_sramstart);
137 print_num ("sram size", (ulong)bd->bi_sramsize);
140 #if defined(CONFIG_CMD_NET)
142 printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
145 printf ("baudrate = %ld bps\n", bd->bi_baudrate);
150 #elif defined(CONFIG_MICROBLAZE)
152 int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
155 print_num ("mem start ", (ulong)bd->bi_memstart);
156 print_lnum ("mem size ", (u64)bd->bi_memsize);
157 print_num ("flash start ", (ulong)bd->bi_flashstart);
158 print_num ("flash size ", (ulong)bd->bi_flashsize);
159 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);
164 #if defined(CONFIG_CMD_NET)
166 printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
168 printf ("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
172 #elif defined(CONFIG_SPARC)
174 int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
179 print_num("bd address ", (ulong) bd);
181 print_num("memstart ", bd->bi_memstart);
182 print_lnum("memsize ", bd->bi_memsize);
183 print_num("flashstart ", bd->bi_flashstart);
184 print_num("CONFIG_SYS_MONITOR_BASE ", CONFIG_SYS_MONITOR_BASE);
185 print_num("CONFIG_ENV_ADDR ", CONFIG_ENV_ADDR);
186 printf("CONFIG_SYS_RELOC_MONITOR_BASE = 0x%lx (%d)\n", CONFIG_SYS_RELOC_MONITOR_BASE,
187 CONFIG_SYS_MONITOR_LEN);
188 printf("CONFIG_SYS_MALLOC_BASE = 0x%lx (%d)\n", CONFIG_SYS_MALLOC_BASE,
189 CONFIG_SYS_MALLOC_LEN);
190 printf("CONFIG_SYS_INIT_SP_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_INIT_SP_OFFSET,
191 CONFIG_SYS_STACK_SIZE);
192 printf("CONFIG_SYS_PROM_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_PROM_OFFSET,
193 CONFIG_SYS_PROM_SIZE);
194 printf("CONFIG_SYS_GBL_DATA_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET,
195 GENERATED_GBL_DATA_SIZE);
197 #if defined(CONFIG_CMD_NET)
199 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
201 printf("baudrate = %6ld bps\n", bd->bi_baudrate);
205 #elif defined(CONFIG_M68K)
207 static void print_str(const char *, const char *);
209 int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
214 print_num ("memstart", (ulong)bd->bi_memstart);
215 print_lnum ("memsize", (u64)bd->bi_memsize);
216 print_num ("flashstart", (ulong)bd->bi_flashstart);
217 print_num ("flashsize", (ulong)bd->bi_flashsize);
218 print_num ("flashoffset", (ulong)bd->bi_flashoffset);
219 #if defined(CONFIG_SYS_INIT_RAM_ADDR)
220 print_num ("sramstart", (ulong)bd->bi_sramstart);
221 print_num ("sramsize", (ulong)bd->bi_sramsize);
223 #if defined(CONFIG_SYS_MBAR)
224 print_num ("mbar", bd->bi_mbar_base);
226 print_str ("cpufreq", strmhz(buf, bd->bi_intfreq));
227 print_str ("busfreq", strmhz(buf, bd->bi_busfreq));
229 print_str ("pcifreq", strmhz(buf, bd->bi_pcifreq));
231 #ifdef CONFIG_EXTRA_CLOCK
232 print_str ("flbfreq", strmhz(buf, bd->bi_flbfreq));
233 print_str ("inpfreq", strmhz(buf, bd->bi_inpfreq));
234 print_str ("vcofreq", strmhz(buf, bd->bi_vcofreq));
236 #if defined(CONFIG_CMD_NET)
238 #if defined(CONFIG_HAS_ETH1)
241 #if defined(CONFIG_HAS_ETH2)
244 #if defined(CONFIG_HAS_ETH3)
248 printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
250 printf ("baudrate = %ld bps\n", bd->bi_baudrate);
255 #elif defined(CONFIG_BLACKFIN)
257 static void print_str(const char *, const char *);
259 int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
264 printf("U-Boot = %s\n", bd->bi_r_version);
265 printf("CPU = %s\n", bd->bi_cpu);
266 printf("Board = %s\n", bd->bi_board_name);
267 print_str("VCO", strmhz(buf, bd->bi_vco));
268 print_str("CCLK", strmhz(buf, bd->bi_cclk));
269 print_str("SCLK", strmhz(buf, bd->bi_sclk));
271 print_num("boot_params", (ulong)bd->bi_boot_params);
272 print_num("memstart", (ulong)bd->bi_memstart);
273 print_lnum("memsize", (u64)bd->bi_memsize);
274 print_num("flashstart", (ulong)bd->bi_flashstart);
275 print_num("flashsize", (ulong)bd->bi_flashsize);
276 print_num("flashoffset", (ulong)bd->bi_flashoffset);
279 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
280 printf("baudrate = %d bps\n", bd->bi_baudrate);
285 #elif defined(CONFIG_MIPS)
287 int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
291 print_num ("boot_params", (ulong)bd->bi_boot_params);
292 print_num ("memstart", (ulong)bd->bi_memstart);
293 print_lnum ("memsize", (u64)bd->bi_memsize);
294 print_num ("flashstart", (ulong)bd->bi_flashstart);
295 print_num ("flashsize", (ulong)bd->bi_flashsize);
296 print_num ("flashoffset", (ulong)bd->bi_flashoffset);
299 printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
300 printf ("baudrate = %d bps\n", bd->bi_baudrate);
305 #elif defined(CONFIG_AVR32)
307 int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
311 print_num ("boot_params", (ulong)bd->bi_boot_params);
312 print_num ("memstart", (ulong)bd->bi_memstart);
313 print_lnum ("memsize", (u64)bd->bi_memsize);
314 print_num ("flashstart", (ulong)bd->bi_flashstart);
315 print_num ("flashsize", (ulong)bd->bi_flashsize);
316 print_num ("flashoffset", (ulong)bd->bi_flashoffset);
319 printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
320 printf ("baudrate = %lu bps\n", bd->bi_baudrate);
325 #elif defined(CONFIG_ARM)
327 int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
332 print_num ("arch_number", bd->bi_arch_number);
333 print_num ("boot_params", (ulong)bd->bi_boot_params);
335 for (i=0; i<CONFIG_NR_DRAM_BANKS; ++i) {
336 print_num("DRAM bank", i);
337 print_num("-> start", bd->bi_dram[i].start);
338 print_num("-> size", bd->bi_dram[i].size);
341 #if defined(CONFIG_CMD_NET)
343 printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
345 printf ("baudrate = %d bps\n", bd->bi_baudrate);
346 #if !(defined(CONFIG_SYS_NO_ICACHE) && defined(CONFIG_SYS_NO_DCACHE))
347 print_num ("TLB addr", gd->tlb_addr);
349 print_num ("relocaddr", gd->relocaddr);
350 print_num ("reloc off", gd->reloc_off);
351 print_num ("irq_sp", gd->irq_sp); /* irq stack pointer */
352 print_num ("sp start ", gd->start_addr_sp);
353 print_num ("FB base ", gd->fb_base);
357 #elif defined(CONFIG_SH)
359 int do_bdinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
362 print_num ("mem start ", (ulong)bd->bi_memstart);
363 print_lnum ("mem size ", (u64)bd->bi_memsize);
364 print_num ("flash start ", (ulong)bd->bi_flashstart);
365 print_num ("flash size ", (ulong)bd->bi_flashsize);
366 print_num ("flash offset ", (ulong)bd->bi_flashoffset);
368 #if defined(CONFIG_CMD_NET)
370 printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
372 printf ("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
376 #elif defined(CONFIG_X86)
378 static void print_str(const char *, const char *);
380 int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
386 print_num ("boot_params", (ulong)bd->bi_boot_params);
387 print_num ("bi_memstart", bd->bi_memstart);
388 print_num ("bi_memsize", bd->bi_memsize);
389 print_num ("bi_flashstart", bd->bi_flashstart);
390 print_num ("bi_flashsize", bd->bi_flashsize);
391 print_num ("bi_flashoffset", bd->bi_flashoffset);
392 print_num ("bi_sramstart", bd->bi_sramstart);
393 print_num ("bi_sramsize", bd->bi_sramsize);
394 print_num ("bi_bootflags", bd->bi_bootflags);
395 print_str ("cpufreq", strmhz(buf, bd->bi_intfreq));
396 print_str ("busfreq", strmhz(buf, bd->bi_busfreq));
398 for (i=0; i<CONFIG_NR_DRAM_BANKS; ++i) {
399 print_num("DRAM bank", i);
400 print_num("-> start", bd->bi_dram[i].start);
401 print_num("-> size", bd->bi_dram[i].size);
404 #if defined(CONFIG_CMD_NET)
406 printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
407 print_str ("ethspeed", strmhz(buf, bd->bi_ethspeed));
409 printf ("baudrate = %d bps\n", bd->bi_baudrate);
415 #error "a case for this architecture does not exist!"
418 static void print_num(const char *name, ulong value)
420 printf ("%-12s= 0x%08lX\n", name, value);
423 #if !(defined(CONFIG_ARM) || defined(CONFIG_M68K)) || defined(CONFIG_CMD_NET)
424 static void print_eth(int idx)
428 sprintf(name, "eth%iaddr", idx);
430 strcpy(name, "ethaddr");
434 printf("%-12s= %s\n", name, val);
438 #if (!defined(CONFIG_ARM) && !defined(CONFIG_X86))
439 static void print_lnum(const char *name, u64 value)
441 printf ("%-12s= 0x%.8llX\n", name, value);
445 #if defined(CONFIG_PPC) || \
446 defined(CONFIG_M68K) || \
447 defined(CONFIG_BLACKFIN) || \
449 static void print_str(const char *name, const char *str)
451 printf ("%-12s= %6s MHz\n", name, str);
453 #endif /* CONFIG_PPC */
456 /* -------------------------------------------------------------------- */
459 bdinfo, 1, 1, do_bdinfo,
460 "print Board Info structure",