blob: 67cb0dad8345c8baf1ef563c53ea52aedb080683 [file] [log] [blame]
wdenk57b2d802003-06-27 21:31:46 +00001/*
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>
Mike Frysinger1a8d6582011-12-04 17:45:22 +000029#include <linux/compiler.h>
wdenk57b2d802003-06-27 21:31:46 +000030
Wolfgang Denk6405a152006-03-31 18:32:53 +020031DECLARE_GLOBAL_DATA_PTR;
wdenk57b2d802003-06-27 21:31:46 +000032
Mike Frysinger1a8d6582011-12-04 17:45:22 +000033__maybe_unused
34static void print_num(const char *name, ulong value)
35{
36 printf("%-12s= 0x%08lX\n", name, value);
37}
wdenk57b2d802003-06-27 21:31:46 +000038
Simon Glass1a0f81d2011-12-06 13:37:17 +000039__maybe_unused
Mike Frysinger1a8d6582011-12-04 17:45:22 +000040static void print_eth(int idx)
41{
42 char name[10], *val;
43 if (idx)
44 sprintf(name, "eth%iaddr", idx);
45 else
46 strcpy(name, "ethaddr");
47 val = getenv(name);
48 if (!val)
49 val = "(not set)";
50 printf("%-12s= %s\n", name, val);
51}
Mike Frysinger9335cc72009-02-11 18:50:10 -050052
Mike Frysinger1a8d6582011-12-04 17:45:22 +000053__maybe_unused
54static void print_lnum(const char *name, u64 value)
55{
56 printf("%-12s= 0x%.8llX\n", name, value);
57}
58
59__maybe_unused
60static void print_mhz(const char *name, unsigned long hz)
61{
62 char buf[32];
63
64 printf("%-12s= %6s MHz\n", name, strmhz(buf, hz));
65}
wdenk57b2d802003-06-27 21:31:46 +000066
Reinhard Meyer0f8337b2010-06-06 19:01:59 +020067#if defined(CONFIG_PPC)
wdenk57b2d802003-06-27 21:31:46 +000068
Macpaul Lindfd70642011-04-27 16:28:35 +000069int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk57b2d802003-06-27 21:31:46 +000070{
wdenk57b2d802003-06-27 21:31:46 +000071 bd_t *bd = gd->bd;
wdenk57b2d802003-06-27 21:31:46 +000072
73#ifdef DEBUG
Macpaul Lindfd70642011-04-27 16:28:35 +000074 print_num("bd address", (ulong)bd);
wdenk57b2d802003-06-27 21:31:46 +000075#endif
Macpaul Lindfd70642011-04-27 16:28:35 +000076 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);
wdenk57b2d802003-06-27 21:31:46 +000086#endif
Macpaul Lindfd70642011-04-27 16:28:35 +000087 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)
Timur Tabi7b480702011-10-05 17:08:07 -050094 print_mhz("procfreq", bd->bi_procfreq);
95 print_mhz("plb_busfreq", bd->bi_plb_busfreq);
Macpaul Lindfd70642011-04-27 16:28:35 +000096#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)
Timur Tabi7b480702011-10-05 17:08:07 -0500100 print_mhz("pci_busfreq", bd->bi_pci_busfreq);
wdenk57b2d802003-06-27 21:31:46 +0000101#endif
Michal Simek594c7b52008-06-24 09:54:09 +0200102#else /* ! CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
Jon Loeligerf5ad3782005-07-23 10:37:35 -0500103#if defined(CONFIG_CPM2)
Timur Tabi7b480702011-10-05 17:08:07 -0500104 print_mhz("vco", bd->bi_vco);
105 print_mhz("sccfreq", bd->bi_sccfreq);
106 print_mhz("brgfreq", bd->bi_brgfreq);
wdenk57b2d802003-06-27 21:31:46 +0000107#endif
Timur Tabi7b480702011-10-05 17:08:07 -0500108 print_mhz("intfreq", bd->bi_intfreq);
Jon Loeligerf5ad3782005-07-23 10:37:35 -0500109#if defined(CONFIG_CPM2)
Timur Tabi7b480702011-10-05 17:08:07 -0500110 print_mhz("cpmfreq", bd->bi_cpmfreq);
wdenk57b2d802003-06-27 21:31:46 +0000111#endif
Timur Tabi7b480702011-10-05 17:08:07 -0500112 print_mhz("busfreq", bd->bi_busfreq);
Michal Simek594c7b52008-06-24 09:54:09 +0200113#endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
wdenk337f5652004-10-28 00:09:35 +0000114#if defined(CONFIG_MPC8220)
Timur Tabi7b480702011-10-05 17:08:07 -0500115 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);
wdenk337f5652004-10-28 00:09:35 +0000120#endif
wdenk0aeb8532004-10-10 21:21:55 +0000121
Mike Frysinger9335cc72009-02-11 18:50:10 -0500122 print_eth(0);
wdenk54070ab2004-12-31 09:32:47 +0000123#if defined(CONFIG_HAS_ETH1)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500124 print_eth(1);
wdenk0aeb8532004-10-10 21:21:55 +0000125#endif
wdenk54070ab2004-12-31 09:32:47 +0000126#if defined(CONFIG_HAS_ETH2)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500127 print_eth(2);
wdenk9c53f402003-10-15 23:53:47 +0000128#endif
wdenk54070ab2004-12-31 09:32:47 +0000129#if defined(CONFIG_HAS_ETH3)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500130 print_eth(3);
wdenk0aeb8532004-10-10 21:21:55 +0000131#endif
richardretanubune5167f12008-09-29 18:28:23 -0400132#if defined(CONFIG_HAS_ETH4)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500133 print_eth(4);
richardretanubune5167f12008-09-29 18:28:23 -0400134#endif
richardretanubune5167f12008-09-29 18:28:23 -0400135#if defined(CONFIG_HAS_ETH5)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500136 print_eth(5);
richardretanubune5167f12008-09-29 18:28:23 -0400137#endif
138
wdenk57b2d802003-06-27 21:31:46 +0000139#ifdef CONFIG_HERMES
Timur Tabi7b480702011-10-05 17:08:07 -0500140 print_mhz("ethspeed", bd->bi_ethspeed);
wdenk57b2d802003-06-27 21:31:46 +0000141#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000142 printf("IP addr = %pI4\n", &bd->bi_ip_addr);
143 printf("baudrate = %6ld bps\n", bd->bi_baudrate);
144 print_num("relocaddr", gd->relocaddr);
wdenk57b2d802003-06-27 21:31:46 +0000145 return 0;
146}
147
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200148#elif defined(CONFIG_NIOS2)
wdenkef3386f2004-10-10 21:27:30 +0000149
Macpaul Lindfd70642011-04-27 16:28:35 +0000150int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenkef3386f2004-10-10 21:27:30 +0000151{
wdenkef3386f2004-10-10 21:27:30 +0000152 bd_t *bd = gd->bd;
153
Macpaul Lindfd70642011-04-27 16:28:35 +0000154 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);
wdenkef3386f2004-10-10 21:27:30 +0000159
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200160#if defined(CONFIG_SYS_SRAM_BASE)
wdenkef3386f2004-10-10 21:27:30 +0000161 print_num ("sram start", (ulong)bd->bi_sramstart);
162 print_num ("sram size", (ulong)bd->bi_sramsize);
163#endif
164
Jon Loeligerd704d912007-07-10 11:02:44 -0500165#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500166 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000167 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
wdenkef3386f2004-10-10 21:27:30 +0000168#endif
169
Macpaul Lindfd70642011-04-27 16:28:35 +0000170 printf("baudrate = %ld bps\n", bd->bi_baudrate);
wdenkef3386f2004-10-10 21:27:30 +0000171
172 return 0;
173}
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200174
175#elif defined(CONFIG_MICROBLAZE)
Michal Simek922ce202007-03-11 13:48:24 +0100176
Macpaul Lindfd70642011-04-27 16:28:35 +0000177int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Michal Simek922ce202007-03-11 13:48:24 +0100178{
Michal Simek922ce202007-03-11 13:48:24 +0100179 bd_t *bd = gd->bd;
Macpaul Lindfd70642011-04-27 16:28:35 +0000180 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);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200185#if defined(CONFIG_SYS_SRAM_BASE)
Macpaul Lindfd70642011-04-27 16:28:35 +0000186 print_num("sram start ", (ulong)bd->bi_sramstart);
187 print_num("sram size ", (ulong)bd->bi_sramsize);
Michal Simek922ce202007-03-11 13:48:24 +0100188#endif
Jon Loeligerd704d912007-07-10 11:02:44 -0500189#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500190 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000191 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Michal Simek922ce202007-03-11 13:48:24 +0100192#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000193 printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
Michal Simek922ce202007-03-11 13:48:24 +0100194 return 0;
195}
wdenk60164a82003-10-08 23:26:14 +0000196
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200197#elif defined(CONFIG_SPARC)
198
Wolfgang Denk6262d0212010-06-28 22:00:46 +0200199int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100200{
201 bd_t *bd = gd->bd;
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100202
203#ifdef DEBUG
204 print_num("bd address ", (ulong) bd);
205#endif
206 print_num("memstart ", bd->bi_memstart);
Becky Brucea36601e2008-06-09 20:37:16 -0500207 print_lnum("memsize ", bd->bi_memsize);
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100208 print_num("flashstart ", bd->bi_flashstart);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200209 print_num("CONFIG_SYS_MONITOR_BASE ", CONFIG_SYS_MONITOR_BASE);
Jean-Christophe PLAGNIOL-VILLARD7e1cda62008-09-10 22:48:06 +0200210 print_num("CONFIG_ENV_ADDR ", CONFIG_ENV_ADDR);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200211 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,
Wolfgang Denk0191e472010-10-26 14:34:52 +0200220 GENERATED_GBL_DATA_SIZE);
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100221
222#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500223 print_eth(0);
Mike Frysingerd5695f42009-02-17 00:00:53 -0500224 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100225#endif
Mike Frysingerd5695f42009-02-17 00:00:53 -0500226 printf("baudrate = %6ld bps\n", bd->bi_baudrate);
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100227 return 0;
228}
229
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200230#elif defined(CONFIG_M68K)
231
Macpaul Lindfd70642011-04-27 16:28:35 +0000232int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
TsiChung Liewf6afe722007-06-18 13:50:13 -0500233{
TsiChung Liewf6afe722007-06-18 13:50:13 -0500234 bd_t *bd = gd->bd;
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -0500235
Macpaul Lindfd70642011-04-27 16:28:35 +0000236 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);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200241#if defined(CONFIG_SYS_INIT_RAM_ADDR)
Macpaul Lindfd70642011-04-27 16:28:35 +0000242 print_num("sramstart", (ulong)bd->bi_sramstart);
243 print_num("sramsize", (ulong)bd->bi_sramsize);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500244#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200245#if defined(CONFIG_SYS_MBAR)
Macpaul Lindfd70642011-04-27 16:28:35 +0000246 print_num("mbar", bd->bi_mbar_base);
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -0500247#endif
Timur Tabi7b480702011-10-05 17:08:07 -0500248 print_mhz("cpufreq", bd->bi_intfreq);
249 print_mhz("busfreq", bd->bi_busfreq);
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -0500250#ifdef CONFIG_PCI
Timur Tabi7b480702011-10-05 17:08:07 -0500251 print_mhz("pcifreq", bd->bi_pcifreq);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500252#endif
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -0500253#ifdef CONFIG_EXTRA_CLOCK
Timur Tabi7b480702011-10-05 17:08:07 -0500254 print_mhz("flbfreq", bd->bi_flbfreq);
255 print_mhz("inpfreq", bd->bi_inpfreq);
256 print_mhz("vcofreq", bd->bi_vcofreq);
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -0500257#endif
Stefan Roeseaddc4472007-08-18 14:37:52 +0200258#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500259 print_eth(0);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500260#if defined(CONFIG_HAS_ETH1)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500261 print_eth(1);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500262#endif
TsiChung Liewf6afe722007-06-18 13:50:13 -0500263#if defined(CONFIG_HAS_ETH2)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500264 print_eth(2);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500265#endif
TsiChung Liewf6afe722007-06-18 13:50:13 -0500266#if defined(CONFIG_HAS_ETH3)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500267 print_eth(3);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500268#endif
269
Macpaul Lindfd70642011-04-27 16:28:35 +0000270 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Stefan Roeseaddc4472007-08-18 14:37:52 +0200271#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000272 printf("baudrate = %ld bps\n", bd->bi_baudrate);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500273
274 return 0;
275}
276
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500277#elif defined(CONFIG_BLACKFIN)
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200278
Wolfgang Denk6262d0212010-06-28 22:00:46 +0200279int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500280{
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500281 bd_t *bd = gd->bd;
282
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);
Timur Tabi7b480702011-10-05 17:08:07 -0500286 print_mhz("VCO", bd->bi_vco);
287 print_mhz("CCLK", bd->bi_cclk);
288 print_mhz("SCLK", bd->bi_sclk);
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500289
Macpaul Lindfd70642011-04-27 16:28:35 +0000290 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);
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500296
Mike Frysinger9335cc72009-02-11 18:50:10 -0500297 print_eth(0);
Mike Frysingerd5695f42009-02-17 00:00:53 -0500298 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
299 printf("baudrate = %d bps\n", bd->bi_baudrate);
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500300
301 return 0;
302}
303
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200304#elif defined(CONFIG_MIPS)
wdenk57b2d802003-06-27 21:31:46 +0000305
Macpaul Lindfd70642011-04-27 16:28:35 +0000306int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk57b2d802003-06-27 21:31:46 +0000307{
wdenk57b2d802003-06-27 21:31:46 +0000308 bd_t *bd = gd->bd;
309
Macpaul Lindfd70642011-04-27 16:28:35 +0000310 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);
wdenk57b2d802003-06-27 21:31:46 +0000316
Mike Frysinger9335cc72009-02-11 18:50:10 -0500317 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000318 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
319 printf("baudrate = %d bps\n", bd->bi_baudrate);
wdenk57b2d802003-06-27 21:31:46 +0000320
321 return 0;
322}
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200323
324#elif defined(CONFIG_AVR32)
325
Macpaul Lindfd70642011-04-27 16:28:35 +0000326int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200327{
328 bd_t *bd = gd->bd;
329
Macpaul Lindfd70642011-04-27 16:28:35 +0000330 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);
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200336
337 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000338 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
339 printf("baudrate = %lu bps\n", bd->bi_baudrate);
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200340
341 return 0;
342}
wdenk57b2d802003-06-27 21:31:46 +0000343
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200344#elif defined(CONFIG_ARM)
wdenk57b2d802003-06-27 21:31:46 +0000345
Macpaul Lindfd70642011-04-27 16:28:35 +0000346int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk57b2d802003-06-27 21:31:46 +0000347{
wdenk57b2d802003-06-27 21:31:46 +0000348 int i;
349 bd_t *bd = gd->bd;
350
Macpaul Lindfd70642011-04-27 16:28:35 +0000351 print_num("arch_number", bd->bi_arch_number);
352 print_num("boot_params", (ulong)bd->bi_boot_params);
wdenk57b2d802003-06-27 21:31:46 +0000353
Macpaul Lindfd70642011-04-27 16:28:35 +0000354 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
wdenk57b2d802003-06-27 21:31:46 +0000355 print_num("DRAM bank", i);
356 print_num("-> start", bd->bi_dram[i].start);
357 print_num("-> size", bd->bi_dram[i].size);
358 }
359
Hebbare6c85282007-12-18 16:03:07 -0800360#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500361 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000362 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Hebbare6c85282007-12-18 16:03:07 -0800363#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000364 printf("baudrate = %d bps\n", bd->bi_baudrate);
Aneesh Vecee9c82011-06-16 23:30:48 +0000365#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
Macpaul Lindfd70642011-04-27 16:28:35 +0000366 print_num("TLB addr", gd->tlb_addr);
Heiko Schocheraeb29912010-09-17 13:10:39 +0200367#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000368 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);
wdenk57b2d802003-06-27 21:31:46 +0000373 return 0;
374}
375
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900376#elif defined(CONFIG_SH)
377
Macpaul Lindfd70642011-04-27 16:28:35 +0000378int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900379{
380 bd_t *bd = gd->bd;
Macpaul Lindfd70642011-04-27 16:28:35 +0000381 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);
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900386
387#if defined(CONFIG_CMD_NET)
388 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000389 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900390#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000391 printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900392 return 0;
393}
394
Graeme Russ14917a92010-08-22 16:25:58 +1000395#elif defined(CONFIG_X86)
396
Macpaul Lindfd70642011-04-27 16:28:35 +0000397int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Graeme Russ14917a92010-08-22 16:25:58 +1000398{
399 int i;
400 bd_t *bd = gd->bd;
Graeme Russ14917a92010-08-22 16:25:58 +1000401
Macpaul Lindfd70642011-04-27 16:28:35 +0000402 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);
Timur Tabi7b480702011-10-05 17:08:07 -0500411 print_mhz("cpufreq", bd->bi_intfreq);
412 print_mhz("busfreq", bd->bi_busfreq);
Graeme Russ14917a92010-08-22 16:25:58 +1000413
Macpaul Lindfd70642011-04-27 16:28:35 +0000414 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
Graeme Russ14917a92010-08-22 16:25:58 +1000415 print_num("DRAM bank", i);
416 print_num("-> start", bd->bi_dram[i].start);
417 print_num("-> size", bd->bi_dram[i].size);
418 }
419
420#if defined(CONFIG_CMD_NET)
421 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000422 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Timur Tabi7b480702011-10-05 17:08:07 -0500423 print_mhz("ethspeed", bd->bi_ethspeed);
Graeme Russ14917a92010-08-22 16:25:58 +1000424#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000425 printf("baudrate = %d bps\n", bd->bi_baudrate);
Graeme Russ14917a92010-08-22 16:25:58 +1000426
427 return 0;
428}
429
Simon Glass4413ed32011-09-17 06:48:47 +0000430#elif defined(CONFIG_SANDBOX)
431
432int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
433{
434 int i;
435 bd_t *bd = gd->bd;
436
437 print_num("boot_params", (ulong)bd->bi_boot_params);
438
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);
443 }
444
445#if defined(CONFIG_CMD_NET)
446 print_eth(0);
447 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
448#endif
449 print_num("FB base ", gd->fb_base);
450 return 0;
451}
452
Macpaul Lin354b4e32011-10-19 20:41:09 +0000453#elif defined(CONFIG_NDS32)
454
455int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
456{
457 int i;
458 bd_t *bd = gd->bd;
459
460 print_num("arch_number", bd->bi_arch_number);
461 print_num("boot_params", (ulong)bd->bi_boot_params);
462
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);
467 }
468
469#if defined(CONFIG_CMD_NET)
470 print_eth(0);
471 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
472#endif
473 printf("baudrate = %d bps\n", bd->bi_baudrate);
474
475 return 0;
476}
477
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200478#else
479 #error "a case for this architecture does not exist!"
480#endif
wdenk57b2d802003-06-27 21:31:46 +0000481
wdenk57b2d802003-06-27 21:31:46 +0000482/* -------------------------------------------------------------------- */
483
wdenkf287a242003-07-01 21:06:45 +0000484U_BOOT_CMD(
485 bdinfo, 1, 1, do_bdinfo,
Peter Tyserdfb72b82009-01-27 18:03:12 -0600486 "print Board Info structure",
Wolfgang Denkc54781c2009-05-24 17:06:54 +0200487 ""
wdenk57b2d802003-06-27 21:31:46 +0000488);