]>
Commit | Line | Data |
---|---|---|
8bde7f77 WD |
1 | /* |
2 | * (C) Copyright 2003 | |
3 | * Wolfgang Denk, DENX Software Engineering, [email protected]. | |
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 | ||
116095eb | 34 | #if !(defined(CONFIG_ARM) || defined(CONFIG_M68K)) || defined(CONFIG_CMD_NET) |
de2dff6f | 35 | static void print_eth(int idx); |
26e42cbd | 36 | #endif |
de2dff6f | 37 | |
8bde7f77 | 38 | #ifndef CONFIG_ARM /* PowerPC and other */ |
b57ca3e1 | 39 | static void print_lnum(const char *, u64); |
c99ea790 | 40 | #endif |
8bde7f77 | 41 | |
c99ea790 | 42 | #if defined(CONFIG_PPC) |
8bde7f77 WD |
43 | static void print_str(const char *, const char *); |
44 | ||
54841ab5 | 45 | int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
8bde7f77 | 46 | { |
8bde7f77 WD |
47 | bd_t *bd = gd->bd; |
48 | char buf[32]; | |
49 | ||
50 | #ifdef DEBUG | |
51 | print_num ("bd address", (ulong)bd ); | |
52 | #endif | |
53 | print_num ("memstart", bd->bi_memstart ); | |
b57ca3e1 | 54 | print_lnum ("memsize", bd->bi_memsize ); |
8bde7f77 WD |
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 ); | |
97d80fc3 WD |
60 | #if defined(CONFIG_5xx) || defined(CONFIG_8xx) || \ |
61 | defined(CONFIG_8260) || defined(CONFIG_E500) | |
8bde7f77 WD |
62 | print_num ("immr_base", bd->bi_immr_base ); |
63 | #endif | |
64 | print_num ("bootflags", bd->bi_bootflags ); | |
97d80fc3 | 65 | #if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \ |
9fea65a6 | 66 | defined(CONFIG_405EP) || defined(CONFIG_XILINX_405) || \ |
6c5879f3 | 67 | defined(CONFIG_440EP) || defined(CONFIG_440GR) || \ |
887e2ec9 SR |
68 | defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \ |
69 | defined(CONFIG_440SP) || defined(CONFIG_440SPE) | |
8bde7f77 | 70 | print_str ("procfreq", strmhz(buf, bd->bi_procfreq)); |
983fda83 | 71 | print_str ("plb_busfreq", strmhz(buf, bd->bi_plb_busfreq)); |
9fea65a6 | 72 | #if defined(CONFIG_405GP) || defined(CONFIG_405EP) || defined(CONFIG_XILINX_405) || \ |
887e2ec9 SR |
73 | defined(CONFIG_440EP) || defined(CONFIG_440GR) || defined(CONFIG_440SPE) || \ |
74 | defined(CONFIG_440EPX) || defined(CONFIG_440GRX) | |
983fda83 | 75 | print_str ("pci_busfreq", strmhz(buf, bd->bi_pci_busfreq)); |
8bde7f77 | 76 | #endif |
9fea65a6 | 77 | #else /* ! CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */ |
9c4c5ae3 | 78 | #if defined(CONFIG_CPM2) |
8bde7f77 WD |
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)); | |
82 | #endif | |
83 | print_str ("intfreq", strmhz(buf, bd->bi_intfreq)); | |
9c4c5ae3 | 84 | #if defined(CONFIG_CPM2) |
8bde7f77 WD |
85 | print_str ("cpmfreq", strmhz(buf, bd->bi_cpmfreq)); |
86 | #endif | |
87 | print_str ("busfreq", strmhz(buf, bd->bi_busfreq)); | |
9fea65a6 | 88 | #endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */ |
983fda83 WD |
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)); | |
95 | #endif | |
03f5c550 | 96 | |
de2dff6f | 97 | print_eth(0); |
e2ffd59b | 98 | #if defined(CONFIG_HAS_ETH1) |
de2dff6f | 99 | print_eth(1); |
03f5c550 | 100 | #endif |
e2ffd59b | 101 | #if defined(CONFIG_HAS_ETH2) |
de2dff6f | 102 | print_eth(2); |
42d1f039 | 103 | #endif |
e2ffd59b | 104 | #if defined(CONFIG_HAS_ETH3) |
de2dff6f | 105 | print_eth(3); |
03f5c550 | 106 | #endif |
c68a05fe | 107 | #if defined(CONFIG_HAS_ETH4) |
de2dff6f | 108 | print_eth(4); |
c68a05fe | 109 | #endif |
c68a05fe | 110 | #if defined(CONFIG_HAS_ETH5) |
de2dff6f | 111 | print_eth(5); |
c68a05fe | 112 | #endif |
113 | ||
8bde7f77 WD |
114 | #ifdef CONFIG_HERMES |
115 | print_str ("ethspeed", strmhz(buf, bd->bi_ethspeed)); | |
116 | #endif | |
b6446b67 MF |
117 | printf ("IP addr = %pI4\n", &bd->bi_ip_addr); |
118 | printf ("baudrate = %6ld bps\n", bd->bi_baudrate ); | |
4b99327a | 119 | print_num ("relocaddr", gd->relocaddr); |
8bde7f77 WD |
120 | return 0; |
121 | } | |
122 | ||
c99ea790 | 123 | #elif defined(CONFIG_NIOS2) |
5c952cf0 | 124 | |
54841ab5 | 125 | int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
5c952cf0 | 126 | { |
5c952cf0 WD |
127 | bd_t *bd = gd->bd; |
128 | ||
129 | print_num ("mem start", (ulong)bd->bi_memstart); | |
b57ca3e1 | 130 | print_lnum ("mem size", (u64)bd->bi_memsize); |
5c952cf0 WD |
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); | |
134 | ||
6d0f6bcf | 135 | #if defined(CONFIG_SYS_SRAM_BASE) |
5c952cf0 WD |
136 | print_num ("sram start", (ulong)bd->bi_sramstart); |
137 | print_num ("sram size", (ulong)bd->bi_sramsize); | |
138 | #endif | |
139 | ||
90253178 | 140 | #if defined(CONFIG_CMD_NET) |
de2dff6f | 141 | print_eth(0); |
b6446b67 | 142 | printf ("ip_addr = %pI4\n", &bd->bi_ip_addr); |
5c952cf0 WD |
143 | #endif |
144 | ||
b6446b67 | 145 | printf ("baudrate = %ld bps\n", bd->bi_baudrate); |
5c952cf0 WD |
146 | |
147 | return 0; | |
148 | } | |
c99ea790 RM |
149 | |
150 | #elif defined(CONFIG_MICROBLAZE) | |
cfc67116 | 151 | |
54841ab5 | 152 | int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
cfc67116 | 153 | { |
cfc67116 MS |
154 | bd_t *bd = gd->bd; |
155 | print_num ("mem start ", (ulong)bd->bi_memstart); | |
b57ca3e1 | 156 | print_lnum ("mem size ", (u64)bd->bi_memsize); |
cfc67116 MS |
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); | |
6d0f6bcf | 160 | #if defined(CONFIG_SYS_SRAM_BASE) |
cfc67116 MS |
161 | print_num ("sram start ", (ulong)bd->bi_sramstart); |
162 | print_num ("sram size ", (ulong)bd->bi_sramsize); | |
163 | #endif | |
90253178 | 164 | #if defined(CONFIG_CMD_NET) |
de2dff6f | 165 | print_eth(0); |
b6446b67 | 166 | printf ("ip_addr = %pI4\n", &bd->bi_ip_addr); |
cfc67116 | 167 | #endif |
b6446b67 | 168 | printf ("baudrate = %ld bps\n", (ulong)bd->bi_baudrate); |
cfc67116 MS |
169 | return 0; |
170 | } | |
4a551709 | 171 | |
c99ea790 RM |
172 | #elif defined(CONFIG_SPARC) |
173 | ||
54841ab5 | 174 | int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) |
00ab32c8 DH |
175 | { |
176 | bd_t *bd = gd->bd; | |
00ab32c8 DH |
177 | |
178 | #ifdef DEBUG | |
179 | print_num("bd address ", (ulong) bd); | |
180 | #endif | |
181 | print_num("memstart ", bd->bi_memstart); | |
b57ca3e1 | 182 | print_lnum("memsize ", bd->bi_memsize); |
00ab32c8 | 183 | print_num("flashstart ", bd->bi_flashstart); |
6d0f6bcf | 184 | print_num("CONFIG_SYS_MONITOR_BASE ", CONFIG_SYS_MONITOR_BASE); |
0e8d1586 | 185 | print_num("CONFIG_ENV_ADDR ", CONFIG_ENV_ADDR); |
6d0f6bcf JCPV |
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 | CONFIG_SYS_GBL_DATA_SIZE); | |
00ab32c8 DH |
196 | |
197 | #if defined(CONFIG_CMD_NET) | |
de2dff6f | 198 | print_eth(0); |
b6446b67 | 199 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
00ab32c8 | 200 | #endif |
b6446b67 | 201 | printf("baudrate = %6ld bps\n", bd->bi_baudrate); |
00ab32c8 DH |
202 | return 0; |
203 | } | |
204 | ||
c99ea790 RM |
205 | #elif defined(CONFIG_M68K) |
206 | ||
8ae158cd | 207 | static void print_str(const char *, const char *); |
8e585f02 | 208 | |
54841ab5 | 209 | int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
8e585f02 | 210 | { |
8e585f02 | 211 | bd_t *bd = gd->bd; |
8ae158cd TL |
212 | char buf[32]; |
213 | ||
8e585f02 | 214 | print_num ("memstart", (ulong)bd->bi_memstart); |
b57ca3e1 | 215 | print_lnum ("memsize", (u64)bd->bi_memsize); |
8e585f02 TL |
216 | print_num ("flashstart", (ulong)bd->bi_flashstart); |
217 | print_num ("flashsize", (ulong)bd->bi_flashsize); | |
218 | print_num ("flashoffset", (ulong)bd->bi_flashoffset); | |
6d0f6bcf | 219 | #if defined(CONFIG_SYS_INIT_RAM_ADDR) |
8ae158cd TL |
220 | print_num ("sramstart", (ulong)bd->bi_sramstart); |
221 | print_num ("sramsize", (ulong)bd->bi_sramsize); | |
8e585f02 | 222 | #endif |
6d0f6bcf | 223 | #if defined(CONFIG_SYS_MBAR) |
8ae158cd | 224 | print_num ("mbar", bd->bi_mbar_base); |
8e585f02 | 225 | #endif |
ee73cc59 | 226 | print_str ("cpufreq", strmhz(buf, bd->bi_intfreq)); |
8ae158cd TL |
227 | print_str ("busfreq", strmhz(buf, bd->bi_busfreq)); |
228 | #ifdef CONFIG_PCI | |
229 | print_str ("pcifreq", strmhz(buf, bd->bi_pcifreq)); | |
230 | #endif | |
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)); | |
235 | #endif | |
26667b7f | 236 | #if defined(CONFIG_CMD_NET) |
de2dff6f | 237 | print_eth(0); |
8e585f02 | 238 | #if defined(CONFIG_HAS_ETH1) |
de2dff6f | 239 | print_eth(1); |
8e585f02 | 240 | #endif |
8e585f02 | 241 | #if defined(CONFIG_HAS_ETH2) |
de2dff6f | 242 | print_eth(2); |
8e585f02 | 243 | #endif |
8e585f02 | 244 | #if defined(CONFIG_HAS_ETH3) |
de2dff6f | 245 | print_eth(3); |
8e585f02 TL |
246 | #endif |
247 | ||
b6446b67 | 248 | printf ("ip_addr = %pI4\n", &bd->bi_ip_addr); |
26667b7f | 249 | #endif |
b6446b67 | 250 | printf ("baudrate = %ld bps\n", bd->bi_baudrate); |
8e585f02 TL |
251 | |
252 | return 0; | |
253 | } | |
254 | ||
8dc48d71 | 255 | #elif defined(CONFIG_BLACKFIN) |
c99ea790 | 256 | |
6dadc919 | 257 | static void print_str(const char *, const char *); |
8dc48d71 | 258 | |
54841ab5 | 259 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
8dc48d71 | 260 | { |
8dc48d71 | 261 | bd_t *bd = gd->bd; |
6dadc919 | 262 | char buf[32]; |
8dc48d71 MF |
263 | |
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); | |
6dadc919 MF |
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)); | |
8dc48d71 MF |
270 | |
271 | print_num("boot_params", (ulong)bd->bi_boot_params); | |
272 | print_num("memstart", (ulong)bd->bi_memstart); | |
b57ca3e1 | 273 | print_lnum("memsize", (u64)bd->bi_memsize); |
8dc48d71 MF |
274 | print_num("flashstart", (ulong)bd->bi_flashstart); |
275 | print_num("flashsize", (ulong)bd->bi_flashsize); | |
276 | print_num("flashoffset", (ulong)bd->bi_flashoffset); | |
277 | ||
de2dff6f | 278 | print_eth(0); |
b6446b67 MF |
279 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
280 | printf("baudrate = %d bps\n", bd->bi_baudrate); | |
8dc48d71 MF |
281 | |
282 | return 0; | |
283 | } | |
284 | ||
c99ea790 | 285 | #elif defined(CONFIG_MIPS) |
8bde7f77 | 286 | |
54841ab5 | 287 | int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
8bde7f77 | 288 | { |
8bde7f77 WD |
289 | bd_t *bd = gd->bd; |
290 | ||
291 | print_num ("boot_params", (ulong)bd->bi_boot_params); | |
292 | print_num ("memstart", (ulong)bd->bi_memstart); | |
b57ca3e1 | 293 | print_lnum ("memsize", (u64)bd->bi_memsize); |
8bde7f77 WD |
294 | print_num ("flashstart", (ulong)bd->bi_flashstart); |
295 | print_num ("flashsize", (ulong)bd->bi_flashsize); | |
296 | print_num ("flashoffset", (ulong)bd->bi_flashoffset); | |
297 | ||
de2dff6f | 298 | print_eth(0); |
b6446b67 MF |
299 | printf ("ip_addr = %pI4\n", &bd->bi_ip_addr); |
300 | printf ("baudrate = %d bps\n", bd->bi_baudrate); | |
8bde7f77 WD |
301 | |
302 | return 0; | |
303 | } | |
8bde7f77 | 304 | |
c99ea790 RM |
305 | #elif defined(CONFIG_AVR32) |
306 | ||
307 | int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) | |
308 | { | |
309 | bd_t *bd = gd->bd; | |
310 | ||
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); | |
317 | ||
318 | print_eth(0); | |
319 | printf ("ip_addr = %pI4\n", &bd->bi_ip_addr); | |
320 | printf ("baudrate = %lu bps\n", bd->bi_baudrate); | |
321 | ||
322 | return 0; | |
323 | } | |
324 | ||
325 | #elif defined(CONFIG_ARM) | |
8bde7f77 | 326 | |
54841ab5 | 327 | int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
8bde7f77 | 328 | { |
8bde7f77 WD |
329 | int i; |
330 | bd_t *bd = gd->bd; | |
331 | ||
332 | print_num ("arch_number", bd->bi_arch_number); | |
333 | print_num ("env_t", (ulong)bd->bi_env); | |
334 | print_num ("boot_params", (ulong)bd->bi_boot_params); | |
335 | ||
336 | for (i=0; i<CONFIG_NR_DRAM_BANKS; ++i) { | |
337 | print_num("DRAM bank", i); | |
338 | print_num("-> start", bd->bi_dram[i].start); | |
339 | print_num("-> size", bd->bi_dram[i].size); | |
340 | } | |
341 | ||
a41dbbd9 | 342 | #if defined(CONFIG_CMD_NET) |
de2dff6f | 343 | print_eth(0); |
b6446b67 | 344 | printf ("ip_addr = %pI4\n", &bd->bi_ip_addr); |
a41dbbd9 | 345 | #endif |
b6446b67 | 346 | printf ("baudrate = %d bps\n", bd->bi_baudrate); |
8bde7f77 WD |
347 | |
348 | return 0; | |
349 | } | |
350 | ||
c99ea790 RM |
351 | #else |
352 | #error "a case for this architecture does not exist!" | |
353 | #endif | |
8bde7f77 WD |
354 | |
355 | static void print_num(const char *name, ulong value) | |
356 | { | |
357 | printf ("%-12s= 0x%08lX\n", name, value); | |
358 | } | |
359 | ||
116095eb | 360 | #if !(defined(CONFIG_ARM) || defined(CONFIG_M68K)) || defined(CONFIG_CMD_NET) |
de2dff6f MF |
361 | static void print_eth(int idx) |
362 | { | |
363 | char name[10], *val; | |
364 | if (idx) | |
365 | sprintf(name, "eth%iaddr", idx); | |
366 | else | |
367 | strcpy(name, "ethaddr"); | |
368 | val = getenv(name); | |
369 | if (!val) | |
370 | val = "(not set)"; | |
371 | printf("%-12s= %s\n", name, val); | |
372 | } | |
26e42cbd | 373 | #endif |
de2dff6f | 374 | |
b57ca3e1 BB |
375 | #ifndef CONFIG_ARM |
376 | static void print_lnum(const char *name, u64 value) | |
377 | { | |
378 | printf ("%-12s= 0x%.8llX\n", name, value); | |
379 | } | |
380 | #endif | |
381 | ||
6dadc919 | 382 | #if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_BLACKFIN) |
8bde7f77 WD |
383 | static void print_str(const char *name, const char *str) |
384 | { | |
385 | printf ("%-12s= %6s MHz\n", name, str); | |
386 | } | |
387 | #endif /* CONFIG_PPC */ | |
388 | ||
389 | ||
390 | /* -------------------------------------------------------------------- */ | |
391 | ||
0d498393 WD |
392 | U_BOOT_CMD( |
393 | bdinfo, 1, 1, do_bdinfo, | |
2fb2604d | 394 | "print Board Info structure", |
a89c33db | 395 | "" |
8bde7f77 | 396 | ); |