]>
Commit | Line | Data |
---|---|---|
8bde7f77 WD |
1 | /* |
2 | * (C) Copyright 2003 | |
3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | |
4 | * | |
5 | * See file CREDITS for list of people who contributed to this | |
6 | * project. | |
7 | * | |
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. | |
12 | * | |
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. | |
17 | * | |
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, | |
21 | * MA 02111-1307 USA | |
22 | */ | |
23 | ||
24 | /* | |
25 | * Boot support | |
26 | */ | |
27 | #include <common.h> | |
28 | #include <command.h> | |
29 | ||
d87080b7 | 30 | DECLARE_GLOBAL_DATA_PTR; |
8bde7f77 | 31 | |
8bde7f77 WD |
32 | static void print_num(const char *, ulong); |
33 | ||
6fcc3be4 SG |
34 | #if !(defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_SANDBOX)) \ |
35 | || defined(CONFIG_CMD_NET) | |
36 | #define HAVE_PRINT_ETH | |
de2dff6f | 37 | static void print_eth(int idx); |
26e42cbd | 38 | #endif |
de2dff6f | 39 | |
6fcc3be4 SG |
40 | #if (!defined(CONFIG_ARM) && !defined(CONFIG_X86) && !defined(CONFIG_SANDBOX)) |
41 | #define HAVE_PRINT_LNUM | |
b57ca3e1 | 42 | static void print_lnum(const char *, u64); |
c99ea790 | 43 | #endif |
8bde7f77 | 44 | |
c99ea790 | 45 | #if defined(CONFIG_PPC) |
8bde7f77 WD |
46 | static void print_str(const char *, const char *); |
47 | ||
5902e8f7 | 48 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
8bde7f77 | 49 | { |
8bde7f77 WD |
50 | bd_t *bd = gd->bd; |
51 | char buf[32]; | |
52 | ||
53 | #ifdef DEBUG | |
5902e8f7 ML |
54 | print_num("bd address", (ulong)bd); |
55 | #endif | |
56 | print_num("memstart", bd->bi_memstart); | |
57 | print_lnum("memsize", bd->bi_memsize); | |
58 | print_num("flashstart", bd->bi_flashstart); | |
59 | print_num("flashsize", bd->bi_flashsize); | |
60 | print_num("flashoffset", bd->bi_flashoffset); | |
61 | print_num("sramstart", bd->bi_sramstart); | |
62 | print_num("sramsize", bd->bi_sramsize); | |
63 | #if defined(CONFIG_5xx) || defined(CONFIG_8xx) || \ | |
64 | defined(CONFIG_8260) || defined(CONFIG_E500) | |
65 | print_num("immr_base", bd->bi_immr_base); | |
66 | #endif | |
67 | print_num("bootflags", bd->bi_bootflags); | |
68 | #if defined(CONFIG_405CR) || defined(CONFIG_405EP) || \ | |
69 | defined(CONFIG_405GP) || \ | |
70 | defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \ | |
71 | defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \ | |
72 | defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \ | |
73 | defined(CONFIG_XILINX_405) | |
74 | print_str("procfreq", strmhz(buf, bd->bi_procfreq)); | |
75 | print_str("plb_busfreq", strmhz(buf, bd->bi_plb_busfreq)); | |
76 | #if defined(CONFIG_405EP) || defined(CONFIG_405GP) || \ | |
77 | defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \ | |
78 | defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \ | |
79 | defined(CONFIG_440SPE) || defined(CONFIG_XILINX_405) | |
80 | print_str("pci_busfreq", strmhz(buf, bd->bi_pci_busfreq)); | |
8bde7f77 | 81 | #endif |
9fea65a6 | 82 | #else /* ! CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */ |
9c4c5ae3 | 83 | #if defined(CONFIG_CPM2) |
5902e8f7 ML |
84 | print_str("vco", strmhz(buf, bd->bi_vco)); |
85 | print_str("sccfreq", strmhz(buf, bd->bi_sccfreq)); | |
86 | print_str("brgfreq", strmhz(buf, bd->bi_brgfreq)); | |
8bde7f77 | 87 | #endif |
5902e8f7 | 88 | print_str("intfreq", strmhz(buf, bd->bi_intfreq)); |
9c4c5ae3 | 89 | #if defined(CONFIG_CPM2) |
5902e8f7 | 90 | print_str("cpmfreq", strmhz(buf, bd->bi_cpmfreq)); |
8bde7f77 | 91 | #endif |
5902e8f7 | 92 | print_str("busfreq", strmhz(buf, bd->bi_busfreq)); |
9fea65a6 | 93 | #endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */ |
983fda83 | 94 | #if defined(CONFIG_MPC8220) |
5902e8f7 ML |
95 | print_str("inpfreq", strmhz(buf, bd->bi_inpfreq)); |
96 | print_str("flbfreq", strmhz(buf, bd->bi_flbfreq)); | |
97 | print_str("pcifreq", strmhz(buf, bd->bi_pcifreq)); | |
98 | print_str("vcofreq", strmhz(buf, bd->bi_vcofreq)); | |
99 | print_str("pevfreq", strmhz(buf, bd->bi_pevfreq)); | |
983fda83 | 100 | #endif |
03f5c550 | 101 | |
de2dff6f | 102 | print_eth(0); |
e2ffd59b | 103 | #if defined(CONFIG_HAS_ETH1) |
de2dff6f | 104 | print_eth(1); |
03f5c550 | 105 | #endif |
e2ffd59b | 106 | #if defined(CONFIG_HAS_ETH2) |
de2dff6f | 107 | print_eth(2); |
42d1f039 | 108 | #endif |
e2ffd59b | 109 | #if defined(CONFIG_HAS_ETH3) |
de2dff6f | 110 | print_eth(3); |
03f5c550 | 111 | #endif |
c68a05fe | 112 | #if defined(CONFIG_HAS_ETH4) |
de2dff6f | 113 | print_eth(4); |
c68a05fe | 114 | #endif |
c68a05fe | 115 | #if defined(CONFIG_HAS_ETH5) |
de2dff6f | 116 | print_eth(5); |
c68a05fe | 117 | #endif |
118 | ||
8bde7f77 | 119 | #ifdef CONFIG_HERMES |
5902e8f7 | 120 | print_str("ethspeed", strmhz(buf, bd->bi_ethspeed)); |
8bde7f77 | 121 | #endif |
5902e8f7 ML |
122 | printf("IP addr = %pI4\n", &bd->bi_ip_addr); |
123 | printf("baudrate = %6ld bps\n", bd->bi_baudrate); | |
124 | print_num("relocaddr", gd->relocaddr); | |
8bde7f77 WD |
125 | return 0; |
126 | } | |
127 | ||
c99ea790 | 128 | #elif defined(CONFIG_NIOS2) |
5c952cf0 | 129 | |
5902e8f7 | 130 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
5c952cf0 | 131 | { |
5c952cf0 WD |
132 | bd_t *bd = gd->bd; |
133 | ||
5902e8f7 ML |
134 | print_num("mem start", (ulong)bd->bi_memstart); |
135 | print_lnum("mem size", (u64)bd->bi_memsize); | |
136 | print_num("flash start", (ulong)bd->bi_flashstart); | |
137 | print_num("flash size", (ulong)bd->bi_flashsize); | |
138 | print_num("flash offset", (ulong)bd->bi_flashoffset); | |
5c952cf0 | 139 | |
6d0f6bcf | 140 | #if defined(CONFIG_SYS_SRAM_BASE) |
5c952cf0 WD |
141 | print_num ("sram start", (ulong)bd->bi_sramstart); |
142 | print_num ("sram size", (ulong)bd->bi_sramsize); | |
143 | #endif | |
144 | ||
90253178 | 145 | #if defined(CONFIG_CMD_NET) |
de2dff6f | 146 | print_eth(0); |
5902e8f7 | 147 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
5c952cf0 WD |
148 | #endif |
149 | ||
5902e8f7 | 150 | printf("baudrate = %ld bps\n", bd->bi_baudrate); |
5c952cf0 WD |
151 | |
152 | return 0; | |
153 | } | |
c99ea790 RM |
154 | |
155 | #elif defined(CONFIG_MICROBLAZE) | |
cfc67116 | 156 | |
5902e8f7 | 157 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
cfc67116 | 158 | { |
cfc67116 | 159 | bd_t *bd = gd->bd; |
5902e8f7 ML |
160 | print_num("mem start ", (ulong)bd->bi_memstart); |
161 | print_lnum("mem size ", (u64)bd->bi_memsize); | |
162 | print_num("flash start ", (ulong)bd->bi_flashstart); | |
163 | print_num("flash size ", (ulong)bd->bi_flashsize); | |
164 | print_num("flash offset ", (ulong)bd->bi_flashoffset); | |
6d0f6bcf | 165 | #if defined(CONFIG_SYS_SRAM_BASE) |
5902e8f7 ML |
166 | print_num("sram start ", (ulong)bd->bi_sramstart); |
167 | print_num("sram size ", (ulong)bd->bi_sramsize); | |
cfc67116 | 168 | #endif |
90253178 | 169 | #if defined(CONFIG_CMD_NET) |
de2dff6f | 170 | print_eth(0); |
5902e8f7 | 171 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
cfc67116 | 172 | #endif |
5902e8f7 | 173 | printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate); |
cfc67116 MS |
174 | return 0; |
175 | } | |
4a551709 | 176 | |
c99ea790 RM |
177 | #elif defined(CONFIG_SPARC) |
178 | ||
54841ab5 | 179 | int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) |
00ab32c8 DH |
180 | { |
181 | bd_t *bd = gd->bd; | |
00ab32c8 DH |
182 | |
183 | #ifdef DEBUG | |
184 | print_num("bd address ", (ulong) bd); | |
185 | #endif | |
186 | print_num("memstart ", bd->bi_memstart); | |
b57ca3e1 | 187 | print_lnum("memsize ", bd->bi_memsize); |
00ab32c8 | 188 | print_num("flashstart ", bd->bi_flashstart); |
6d0f6bcf | 189 | print_num("CONFIG_SYS_MONITOR_BASE ", CONFIG_SYS_MONITOR_BASE); |
0e8d1586 | 190 | print_num("CONFIG_ENV_ADDR ", CONFIG_ENV_ADDR); |
6d0f6bcf JCPV |
191 | printf("CONFIG_SYS_RELOC_MONITOR_BASE = 0x%lx (%d)\n", CONFIG_SYS_RELOC_MONITOR_BASE, |
192 | CONFIG_SYS_MONITOR_LEN); | |
193 | printf("CONFIG_SYS_MALLOC_BASE = 0x%lx (%d)\n", CONFIG_SYS_MALLOC_BASE, | |
194 | CONFIG_SYS_MALLOC_LEN); | |
195 | printf("CONFIG_SYS_INIT_SP_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_INIT_SP_OFFSET, | |
196 | CONFIG_SYS_STACK_SIZE); | |
197 | printf("CONFIG_SYS_PROM_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_PROM_OFFSET, | |
198 | CONFIG_SYS_PROM_SIZE); | |
199 | printf("CONFIG_SYS_GBL_DATA_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET, | |
25ddd1fb | 200 | GENERATED_GBL_DATA_SIZE); |
00ab32c8 DH |
201 | |
202 | #if defined(CONFIG_CMD_NET) | |
de2dff6f | 203 | print_eth(0); |
b6446b67 | 204 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
00ab32c8 | 205 | #endif |
b6446b67 | 206 | printf("baudrate = %6ld bps\n", bd->bi_baudrate); |
00ab32c8 DH |
207 | return 0; |
208 | } | |
209 | ||
c99ea790 RM |
210 | #elif defined(CONFIG_M68K) |
211 | ||
8ae158cd | 212 | static void print_str(const char *, const char *); |
8e585f02 | 213 | |
5902e8f7 | 214 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
8e585f02 | 215 | { |
8e585f02 | 216 | bd_t *bd = gd->bd; |
8ae158cd TL |
217 | char buf[32]; |
218 | ||
5902e8f7 ML |
219 | print_num("memstart", (ulong)bd->bi_memstart); |
220 | print_lnum("memsize", (u64)bd->bi_memsize); | |
221 | print_num("flashstart", (ulong)bd->bi_flashstart); | |
222 | print_num("flashsize", (ulong)bd->bi_flashsize); | |
223 | print_num("flashoffset", (ulong)bd->bi_flashoffset); | |
6d0f6bcf | 224 | #if defined(CONFIG_SYS_INIT_RAM_ADDR) |
5902e8f7 ML |
225 | print_num("sramstart", (ulong)bd->bi_sramstart); |
226 | print_num("sramsize", (ulong)bd->bi_sramsize); | |
8e585f02 | 227 | #endif |
6d0f6bcf | 228 | #if defined(CONFIG_SYS_MBAR) |
5902e8f7 | 229 | print_num("mbar", bd->bi_mbar_base); |
8e585f02 | 230 | #endif |
5902e8f7 ML |
231 | print_str("cpufreq", strmhz(buf, bd->bi_intfreq)); |
232 | print_str("busfreq", strmhz(buf, bd->bi_busfreq)); | |
8ae158cd | 233 | #ifdef CONFIG_PCI |
5902e8f7 | 234 | print_str("pcifreq", strmhz(buf, bd->bi_pcifreq)); |
8ae158cd TL |
235 | #endif |
236 | #ifdef CONFIG_EXTRA_CLOCK | |
5902e8f7 ML |
237 | print_str("flbfreq", strmhz(buf, bd->bi_flbfreq)); |
238 | print_str("inpfreq", strmhz(buf, bd->bi_inpfreq)); | |
239 | print_str("vcofreq", strmhz(buf, bd->bi_vcofreq)); | |
8ae158cd | 240 | #endif |
26667b7f | 241 | #if defined(CONFIG_CMD_NET) |
de2dff6f | 242 | print_eth(0); |
8e585f02 | 243 | #if defined(CONFIG_HAS_ETH1) |
de2dff6f | 244 | print_eth(1); |
8e585f02 | 245 | #endif |
8e585f02 | 246 | #if defined(CONFIG_HAS_ETH2) |
de2dff6f | 247 | print_eth(2); |
8e585f02 | 248 | #endif |
8e585f02 | 249 | #if defined(CONFIG_HAS_ETH3) |
de2dff6f | 250 | print_eth(3); |
8e585f02 TL |
251 | #endif |
252 | ||
5902e8f7 | 253 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
26667b7f | 254 | #endif |
5902e8f7 | 255 | printf("baudrate = %ld bps\n", bd->bi_baudrate); |
8e585f02 TL |
256 | |
257 | return 0; | |
258 | } | |
259 | ||
8dc48d71 | 260 | #elif defined(CONFIG_BLACKFIN) |
c99ea790 | 261 | |
6dadc919 | 262 | static void print_str(const char *, const char *); |
8dc48d71 | 263 | |
54841ab5 | 264 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
8dc48d71 | 265 | { |
8dc48d71 | 266 | bd_t *bd = gd->bd; |
6dadc919 | 267 | char buf[32]; |
8dc48d71 MF |
268 | |
269 | printf("U-Boot = %s\n", bd->bi_r_version); | |
270 | printf("CPU = %s\n", bd->bi_cpu); | |
271 | printf("Board = %s\n", bd->bi_board_name); | |
5902e8f7 ML |
272 | print_str("VCO", strmhz(buf, bd->bi_vco)); |
273 | print_str("CCLK", strmhz(buf, bd->bi_cclk)); | |
274 | print_str("SCLK", strmhz(buf, bd->bi_sclk)); | |
8dc48d71 | 275 | |
5902e8f7 ML |
276 | print_num("boot_params", (ulong)bd->bi_boot_params); |
277 | print_num("memstart", (ulong)bd->bi_memstart); | |
278 | print_lnum("memsize", (u64)bd->bi_memsize); | |
279 | print_num("flashstart", (ulong)bd->bi_flashstart); | |
280 | print_num("flashsize", (ulong)bd->bi_flashsize); | |
281 | print_num("flashoffset", (ulong)bd->bi_flashoffset); | |
8dc48d71 | 282 | |
de2dff6f | 283 | print_eth(0); |
b6446b67 MF |
284 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
285 | printf("baudrate = %d bps\n", bd->bi_baudrate); | |
8dc48d71 MF |
286 | |
287 | return 0; | |
288 | } | |
289 | ||
c99ea790 | 290 | #elif defined(CONFIG_MIPS) |
8bde7f77 | 291 | |
5902e8f7 | 292 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
8bde7f77 | 293 | { |
8bde7f77 WD |
294 | bd_t *bd = gd->bd; |
295 | ||
5902e8f7 ML |
296 | print_num("boot_params", (ulong)bd->bi_boot_params); |
297 | print_num("memstart", (ulong)bd->bi_memstart); | |
298 | print_lnum("memsize", (u64)bd->bi_memsize); | |
299 | print_num("flashstart", (ulong)bd->bi_flashstart); | |
300 | print_num("flashsize", (ulong)bd->bi_flashsize); | |
301 | print_num("flashoffset", (ulong)bd->bi_flashoffset); | |
8bde7f77 | 302 | |
de2dff6f | 303 | print_eth(0); |
5902e8f7 ML |
304 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
305 | printf("baudrate = %d bps\n", bd->bi_baudrate); | |
8bde7f77 WD |
306 | |
307 | return 0; | |
308 | } | |
8bde7f77 | 309 | |
c99ea790 RM |
310 | #elif defined(CONFIG_AVR32) |
311 | ||
5902e8f7 | 312 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
c99ea790 RM |
313 | { |
314 | bd_t *bd = gd->bd; | |
315 | ||
5902e8f7 ML |
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); | |
c99ea790 RM |
322 | |
323 | print_eth(0); | |
5902e8f7 ML |
324 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
325 | printf("baudrate = %lu bps\n", bd->bi_baudrate); | |
c99ea790 RM |
326 | |
327 | return 0; | |
328 | } | |
329 | ||
330 | #elif defined(CONFIG_ARM) | |
8bde7f77 | 331 | |
5902e8f7 | 332 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
8bde7f77 | 333 | { |
8bde7f77 WD |
334 | int i; |
335 | bd_t *bd = gd->bd; | |
336 | ||
5902e8f7 ML |
337 | print_num("arch_number", bd->bi_arch_number); |
338 | print_num("boot_params", (ulong)bd->bi_boot_params); | |
8bde7f77 | 339 | |
5902e8f7 | 340 | for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) { |
8bde7f77 WD |
341 | print_num("DRAM bank", i); |
342 | print_num("-> start", bd->bi_dram[i].start); | |
343 | print_num("-> size", bd->bi_dram[i].size); | |
344 | } | |
345 | ||
a41dbbd9 | 346 | #if defined(CONFIG_CMD_NET) |
de2dff6f | 347 | print_eth(0); |
5902e8f7 | 348 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
a41dbbd9 | 349 | #endif |
5902e8f7 | 350 | printf("baudrate = %d bps\n", bd->bi_baudrate); |
e47f2db5 | 351 | #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF)) |
5902e8f7 | 352 | print_num("TLB addr", gd->tlb_addr); |
f1d2b313 | 353 | #endif |
5902e8f7 ML |
354 | print_num("relocaddr", gd->relocaddr); |
355 | print_num("reloc off", gd->reloc_off); | |
356 | print_num("irq_sp", gd->irq_sp); /* irq stack pointer */ | |
357 | print_num("sp start ", gd->start_addr_sp); | |
358 | print_num("FB base ", gd->fb_base); | |
8bde7f77 WD |
359 | return 0; |
360 | } | |
361 | ||
ebd0d062 NI |
362 | #elif defined(CONFIG_SH) |
363 | ||
5902e8f7 | 364 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
ebd0d062 NI |
365 | { |
366 | bd_t *bd = gd->bd; | |
5902e8f7 ML |
367 | print_num("mem start ", (ulong)bd->bi_memstart); |
368 | print_lnum("mem size ", (u64)bd->bi_memsize); | |
369 | print_num("flash start ", (ulong)bd->bi_flashstart); | |
370 | print_num("flash size ", (ulong)bd->bi_flashsize); | |
371 | print_num("flash offset ", (ulong)bd->bi_flashoffset); | |
ebd0d062 NI |
372 | |
373 | #if defined(CONFIG_CMD_NET) | |
374 | print_eth(0); | |
5902e8f7 | 375 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
ebd0d062 | 376 | #endif |
5902e8f7 | 377 | printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate); |
ebd0d062 NI |
378 | return 0; |
379 | } | |
380 | ||
a806ee6f GR |
381 | #elif defined(CONFIG_X86) |
382 | ||
383 | static void print_str(const char *, const char *); | |
384 | ||
5902e8f7 | 385 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
a806ee6f GR |
386 | { |
387 | int i; | |
388 | bd_t *bd = gd->bd; | |
389 | char buf[32]; | |
390 | ||
5902e8f7 ML |
391 | print_num("boot_params", (ulong)bd->bi_boot_params); |
392 | print_num("bi_memstart", bd->bi_memstart); | |
393 | print_num("bi_memsize", bd->bi_memsize); | |
394 | print_num("bi_flashstart", bd->bi_flashstart); | |
395 | print_num("bi_flashsize", bd->bi_flashsize); | |
396 | print_num("bi_flashoffset", bd->bi_flashoffset); | |
397 | print_num("bi_sramstart", bd->bi_sramstart); | |
398 | print_num("bi_sramsize", bd->bi_sramsize); | |
399 | print_num("bi_bootflags", bd->bi_bootflags); | |
400 | print_str("cpufreq", strmhz(buf, bd->bi_intfreq)); | |
401 | print_str("busfreq", strmhz(buf, bd->bi_busfreq)); | |
402 | ||
403 | for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) { | |
a806ee6f GR |
404 | print_num("DRAM bank", i); |
405 | print_num("-> start", bd->bi_dram[i].start); | |
406 | print_num("-> size", bd->bi_dram[i].size); | |
407 | } | |
408 | ||
409 | #if defined(CONFIG_CMD_NET) | |
410 | print_eth(0); | |
5902e8f7 ML |
411 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
412 | print_str("ethspeed", strmhz(buf, bd->bi_ethspeed)); | |
a806ee6f | 413 | #endif |
5902e8f7 | 414 | printf("baudrate = %d bps\n", bd->bi_baudrate); |
a806ee6f GR |
415 | |
416 | return 0; | |
417 | } | |
418 | ||
6fcc3be4 SG |
419 | #elif defined(CONFIG_SANDBOX) |
420 | ||
421 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | |
422 | { | |
423 | int i; | |
424 | bd_t *bd = gd->bd; | |
425 | ||
426 | print_num("boot_params", (ulong)bd->bi_boot_params); | |
427 | ||
428 | for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) { | |
429 | print_num("DRAM bank", i); | |
430 | print_num("-> start", bd->bi_dram[i].start); | |
431 | print_num("-> size", bd->bi_dram[i].size); | |
432 | } | |
433 | ||
434 | #if defined(CONFIG_CMD_NET) | |
435 | print_eth(0); | |
436 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); | |
437 | #endif | |
438 | print_num("FB base ", gd->fb_base); | |
439 | return 0; | |
440 | } | |
441 | ||
c99ea790 RM |
442 | #else |
443 | #error "a case for this architecture does not exist!" | |
444 | #endif | |
8bde7f77 WD |
445 | |
446 | static void print_num(const char *name, ulong value) | |
447 | { | |
5902e8f7 | 448 | printf("%-12s= 0x%08lX\n", name, value); |
8bde7f77 WD |
449 | } |
450 | ||
6fcc3be4 | 451 | #ifdef HAVE_PRINT_ETH |
de2dff6f MF |
452 | static void print_eth(int idx) |
453 | { | |
454 | char name[10], *val; | |
455 | if (idx) | |
456 | sprintf(name, "eth%iaddr", idx); | |
457 | else | |
458 | strcpy(name, "ethaddr"); | |
459 | val = getenv(name); | |
460 | if (!val) | |
461 | val = "(not set)"; | |
462 | printf("%-12s= %s\n", name, val); | |
463 | } | |
26e42cbd | 464 | #endif |
de2dff6f | 465 | |
6fcc3be4 | 466 | #ifdef HAVE_PRINT_LNUM |
b57ca3e1 BB |
467 | static void print_lnum(const char *name, u64 value) |
468 | { | |
5902e8f7 | 469 | printf("%-12s= 0x%.8llX\n", name, value); |
b57ca3e1 BB |
470 | } |
471 | #endif | |
472 | ||
5902e8f7 ML |
473 | #if defined(CONFIG_PPC) || \ |
474 | defined(CONFIG_M68K) || \ | |
475 | defined(CONFIG_BLACKFIN) || \ | |
476 | defined(CONFIG_X86) | |
8bde7f77 WD |
477 | static void print_str(const char *name, const char *str) |
478 | { | |
5902e8f7 | 479 | printf("%-12s= %6s MHz\n", name, str); |
8bde7f77 WD |
480 | } |
481 | #endif /* CONFIG_PPC */ | |
482 | ||
483 | ||
484 | /* -------------------------------------------------------------------- */ | |
485 | ||
0d498393 WD |
486 | U_BOOT_CMD( |
487 | bdinfo, 1, 1, do_bdinfo, | |
2fb2604d | 488 | "print Board Info structure", |
a89c33db | 489 | "" |
8bde7f77 | 490 | ); |