blob: 73c03a895f74de7112fbac78bdf909736a0fde63 [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
Mike Frysinger1a8d6582011-12-04 17:45:22 +000039static void print_eth(int idx)
40{
41 char name[10], *val;
42 if (idx)
43 sprintf(name, "eth%iaddr", idx);
44 else
45 strcpy(name, "ethaddr");
46 val = getenv(name);
47 if (!val)
48 val = "(not set)";
49 printf("%-12s= %s\n", name, val);
50}
Mike Frysinger9335cc72009-02-11 18:50:10 -050051
Mike Frysinger1a8d6582011-12-04 17:45:22 +000052__maybe_unused
53static void print_lnum(const char *name, u64 value)
54{
55 printf("%-12s= 0x%.8llX\n", name, value);
56}
57
58__maybe_unused
59static void print_mhz(const char *name, unsigned long hz)
60{
61 char buf[32];
62
63 printf("%-12s= %6s MHz\n", name, strmhz(buf, hz));
64}
wdenk57b2d802003-06-27 21:31:46 +000065
Reinhard Meyer0f8337b2010-06-06 19:01:59 +020066#if defined(CONFIG_PPC)
wdenk57b2d802003-06-27 21:31:46 +000067
Macpaul Lindfd70642011-04-27 16:28:35 +000068int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk57b2d802003-06-27 21:31:46 +000069{
wdenk57b2d802003-06-27 21:31:46 +000070 bd_t *bd = gd->bd;
wdenk57b2d802003-06-27 21:31:46 +000071
72#ifdef DEBUG
Macpaul Lindfd70642011-04-27 16:28:35 +000073 print_num("bd address", (ulong)bd);
wdenk57b2d802003-06-27 21:31:46 +000074#endif
Macpaul Lindfd70642011-04-27 16:28:35 +000075 print_num("memstart", bd->bi_memstart);
76 print_lnum("memsize", bd->bi_memsize);
77 print_num("flashstart", bd->bi_flashstart);
78 print_num("flashsize", bd->bi_flashsize);
79 print_num("flashoffset", bd->bi_flashoffset);
80 print_num("sramstart", bd->bi_sramstart);
81 print_num("sramsize", bd->bi_sramsize);
82#if defined(CONFIG_5xx) || defined(CONFIG_8xx) || \
83 defined(CONFIG_8260) || defined(CONFIG_E500)
84 print_num("immr_base", bd->bi_immr_base);
wdenk57b2d802003-06-27 21:31:46 +000085#endif
Macpaul Lindfd70642011-04-27 16:28:35 +000086 print_num("bootflags", bd->bi_bootflags);
87#if defined(CONFIG_405CR) || defined(CONFIG_405EP) || \
88 defined(CONFIG_405GP) || \
89 defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
90 defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \
91 defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \
92 defined(CONFIG_XILINX_405)
Timur Tabi7b480702011-10-05 17:08:07 -050093 print_mhz("procfreq", bd->bi_procfreq);
94 print_mhz("plb_busfreq", bd->bi_plb_busfreq);
Macpaul Lindfd70642011-04-27 16:28:35 +000095#if defined(CONFIG_405EP) || defined(CONFIG_405GP) || \
96 defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
97 defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \
98 defined(CONFIG_440SPE) || defined(CONFIG_XILINX_405)
Timur Tabi7b480702011-10-05 17:08:07 -050099 print_mhz("pci_busfreq", bd->bi_pci_busfreq);
wdenk57b2d802003-06-27 21:31:46 +0000100#endif
Michal Simek594c7b52008-06-24 09:54:09 +0200101#else /* ! CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
Jon Loeligerf5ad3782005-07-23 10:37:35 -0500102#if defined(CONFIG_CPM2)
Timur Tabi7b480702011-10-05 17:08:07 -0500103 print_mhz("vco", bd->bi_vco);
104 print_mhz("sccfreq", bd->bi_sccfreq);
105 print_mhz("brgfreq", bd->bi_brgfreq);
wdenk57b2d802003-06-27 21:31:46 +0000106#endif
Timur Tabi7b480702011-10-05 17:08:07 -0500107 print_mhz("intfreq", bd->bi_intfreq);
Jon Loeligerf5ad3782005-07-23 10:37:35 -0500108#if defined(CONFIG_CPM2)
Timur Tabi7b480702011-10-05 17:08:07 -0500109 print_mhz("cpmfreq", bd->bi_cpmfreq);
wdenk57b2d802003-06-27 21:31:46 +0000110#endif
Timur Tabi7b480702011-10-05 17:08:07 -0500111 print_mhz("busfreq", bd->bi_busfreq);
Michal Simek594c7b52008-06-24 09:54:09 +0200112#endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
wdenk337f5652004-10-28 00:09:35 +0000113#if defined(CONFIG_MPC8220)
Timur Tabi7b480702011-10-05 17:08:07 -0500114 print_mhz("inpfreq", bd->bi_inpfreq);
115 print_mhz("flbfreq", bd->bi_flbfreq);
116 print_mhz("pcifreq", bd->bi_pcifreq);
117 print_mhz("vcofreq", bd->bi_vcofreq);
118 print_mhz("pevfreq", bd->bi_pevfreq);
wdenk337f5652004-10-28 00:09:35 +0000119#endif
wdenk0aeb8532004-10-10 21:21:55 +0000120
Mike Frysinger9335cc72009-02-11 18:50:10 -0500121 print_eth(0);
wdenk54070ab2004-12-31 09:32:47 +0000122#if defined(CONFIG_HAS_ETH1)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500123 print_eth(1);
wdenk0aeb8532004-10-10 21:21:55 +0000124#endif
wdenk54070ab2004-12-31 09:32:47 +0000125#if defined(CONFIG_HAS_ETH2)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500126 print_eth(2);
wdenk9c53f402003-10-15 23:53:47 +0000127#endif
wdenk54070ab2004-12-31 09:32:47 +0000128#if defined(CONFIG_HAS_ETH3)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500129 print_eth(3);
wdenk0aeb8532004-10-10 21:21:55 +0000130#endif
richardretanubune5167f12008-09-29 18:28:23 -0400131#if defined(CONFIG_HAS_ETH4)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500132 print_eth(4);
richardretanubune5167f12008-09-29 18:28:23 -0400133#endif
richardretanubune5167f12008-09-29 18:28:23 -0400134#if defined(CONFIG_HAS_ETH5)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500135 print_eth(5);
richardretanubune5167f12008-09-29 18:28:23 -0400136#endif
137
wdenk57b2d802003-06-27 21:31:46 +0000138#ifdef CONFIG_HERMES
Timur Tabi7b480702011-10-05 17:08:07 -0500139 print_mhz("ethspeed", bd->bi_ethspeed);
wdenk57b2d802003-06-27 21:31:46 +0000140#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000141 printf("IP addr = %pI4\n", &bd->bi_ip_addr);
142 printf("baudrate = %6ld bps\n", bd->bi_baudrate);
143 print_num("relocaddr", gd->relocaddr);
wdenk57b2d802003-06-27 21:31:46 +0000144 return 0;
145}
146
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200147#elif defined(CONFIG_NIOS2)
wdenkef3386f2004-10-10 21:27:30 +0000148
Macpaul Lindfd70642011-04-27 16:28:35 +0000149int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenkef3386f2004-10-10 21:27:30 +0000150{
wdenkef3386f2004-10-10 21:27:30 +0000151 bd_t *bd = gd->bd;
152
Macpaul Lindfd70642011-04-27 16:28:35 +0000153 print_num("mem start", (ulong)bd->bi_memstart);
154 print_lnum("mem size", (u64)bd->bi_memsize);
155 print_num("flash start", (ulong)bd->bi_flashstart);
156 print_num("flash size", (ulong)bd->bi_flashsize);
157 print_num("flash offset", (ulong)bd->bi_flashoffset);
wdenkef3386f2004-10-10 21:27:30 +0000158
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200159#if defined(CONFIG_SYS_SRAM_BASE)
wdenkef3386f2004-10-10 21:27:30 +0000160 print_num ("sram start", (ulong)bd->bi_sramstart);
161 print_num ("sram size", (ulong)bd->bi_sramsize);
162#endif
163
Jon Loeligerd704d912007-07-10 11:02:44 -0500164#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500165 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000166 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
wdenkef3386f2004-10-10 21:27:30 +0000167#endif
168
Macpaul Lindfd70642011-04-27 16:28:35 +0000169 printf("baudrate = %ld bps\n", bd->bi_baudrate);
wdenkef3386f2004-10-10 21:27:30 +0000170
171 return 0;
172}
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200173
174#elif defined(CONFIG_MICROBLAZE)
Michal Simek922ce202007-03-11 13:48:24 +0100175
Macpaul Lindfd70642011-04-27 16:28:35 +0000176int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Michal Simek922ce202007-03-11 13:48:24 +0100177{
Michal Simek922ce202007-03-11 13:48:24 +0100178 bd_t *bd = gd->bd;
Macpaul Lindfd70642011-04-27 16:28:35 +0000179 print_num("mem start ", (ulong)bd->bi_memstart);
180 print_lnum("mem size ", (u64)bd->bi_memsize);
181 print_num("flash start ", (ulong)bd->bi_flashstart);
182 print_num("flash size ", (ulong)bd->bi_flashsize);
183 print_num("flash offset ", (ulong)bd->bi_flashoffset);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200184#if defined(CONFIG_SYS_SRAM_BASE)
Macpaul Lindfd70642011-04-27 16:28:35 +0000185 print_num("sram start ", (ulong)bd->bi_sramstart);
186 print_num("sram size ", (ulong)bd->bi_sramsize);
Michal Simek922ce202007-03-11 13:48:24 +0100187#endif
Jon Loeligerd704d912007-07-10 11:02:44 -0500188#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500189 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000190 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Michal Simek922ce202007-03-11 13:48:24 +0100191#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000192 printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
Michal Simek922ce202007-03-11 13:48:24 +0100193 return 0;
194}
wdenk60164a82003-10-08 23:26:14 +0000195
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200196#elif defined(CONFIG_SPARC)
197
Wolfgang Denk6262d0212010-06-28 22:00:46 +0200198int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100199{
200 bd_t *bd = gd->bd;
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100201
202#ifdef DEBUG
203 print_num("bd address ", (ulong) bd);
204#endif
205 print_num("memstart ", bd->bi_memstart);
Becky Brucea36601e2008-06-09 20:37:16 -0500206 print_lnum("memsize ", bd->bi_memsize);
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100207 print_num("flashstart ", bd->bi_flashstart);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200208 print_num("CONFIG_SYS_MONITOR_BASE ", CONFIG_SYS_MONITOR_BASE);
Jean-Christophe PLAGNIOL-VILLARD7e1cda62008-09-10 22:48:06 +0200209 print_num("CONFIG_ENV_ADDR ", CONFIG_ENV_ADDR);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200210 printf("CONFIG_SYS_RELOC_MONITOR_BASE = 0x%lx (%d)\n", CONFIG_SYS_RELOC_MONITOR_BASE,
211 CONFIG_SYS_MONITOR_LEN);
212 printf("CONFIG_SYS_MALLOC_BASE = 0x%lx (%d)\n", CONFIG_SYS_MALLOC_BASE,
213 CONFIG_SYS_MALLOC_LEN);
214 printf("CONFIG_SYS_INIT_SP_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_INIT_SP_OFFSET,
215 CONFIG_SYS_STACK_SIZE);
216 printf("CONFIG_SYS_PROM_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_PROM_OFFSET,
217 CONFIG_SYS_PROM_SIZE);
218 printf("CONFIG_SYS_GBL_DATA_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET,
Wolfgang Denk0191e472010-10-26 14:34:52 +0200219 GENERATED_GBL_DATA_SIZE);
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100220
221#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500222 print_eth(0);
Mike Frysingerd5695f42009-02-17 00:00:53 -0500223 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100224#endif
Mike Frysingerd5695f42009-02-17 00:00:53 -0500225 printf("baudrate = %6ld bps\n", bd->bi_baudrate);
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100226 return 0;
227}
228
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200229#elif defined(CONFIG_M68K)
230
Macpaul Lindfd70642011-04-27 16:28:35 +0000231int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
TsiChung Liewf6afe722007-06-18 13:50:13 -0500232{
TsiChung Liewf6afe722007-06-18 13:50:13 -0500233 bd_t *bd = gd->bd;
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -0500234
Macpaul Lindfd70642011-04-27 16:28:35 +0000235 print_num("memstart", (ulong)bd->bi_memstart);
236 print_lnum("memsize", (u64)bd->bi_memsize);
237 print_num("flashstart", (ulong)bd->bi_flashstart);
238 print_num("flashsize", (ulong)bd->bi_flashsize);
239 print_num("flashoffset", (ulong)bd->bi_flashoffset);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200240#if defined(CONFIG_SYS_INIT_RAM_ADDR)
Macpaul Lindfd70642011-04-27 16:28:35 +0000241 print_num("sramstart", (ulong)bd->bi_sramstart);
242 print_num("sramsize", (ulong)bd->bi_sramsize);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500243#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200244#if defined(CONFIG_SYS_MBAR)
Macpaul Lindfd70642011-04-27 16:28:35 +0000245 print_num("mbar", bd->bi_mbar_base);
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -0500246#endif
Timur Tabi7b480702011-10-05 17:08:07 -0500247 print_mhz("cpufreq", bd->bi_intfreq);
248 print_mhz("busfreq", bd->bi_busfreq);
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -0500249#ifdef CONFIG_PCI
Timur Tabi7b480702011-10-05 17:08:07 -0500250 print_mhz("pcifreq", bd->bi_pcifreq);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500251#endif
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -0500252#ifdef CONFIG_EXTRA_CLOCK
Timur Tabi7b480702011-10-05 17:08:07 -0500253 print_mhz("flbfreq", bd->bi_flbfreq);
254 print_mhz("inpfreq", bd->bi_inpfreq);
255 print_mhz("vcofreq", bd->bi_vcofreq);
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -0500256#endif
Stefan Roeseaddc4472007-08-18 14:37:52 +0200257#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500258 print_eth(0);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500259#if defined(CONFIG_HAS_ETH1)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500260 print_eth(1);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500261#endif
TsiChung Liewf6afe722007-06-18 13:50:13 -0500262#if defined(CONFIG_HAS_ETH2)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500263 print_eth(2);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500264#endif
TsiChung Liewf6afe722007-06-18 13:50:13 -0500265#if defined(CONFIG_HAS_ETH3)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500266 print_eth(3);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500267#endif
268
Macpaul Lindfd70642011-04-27 16:28:35 +0000269 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Stefan Roeseaddc4472007-08-18 14:37:52 +0200270#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000271 printf("baudrate = %ld bps\n", bd->bi_baudrate);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500272
273 return 0;
274}
275
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500276#elif defined(CONFIG_BLACKFIN)
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200277
Wolfgang Denk6262d0212010-06-28 22:00:46 +0200278int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500279{
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500280 bd_t *bd = gd->bd;
281
282 printf("U-Boot = %s\n", bd->bi_r_version);
283 printf("CPU = %s\n", bd->bi_cpu);
284 printf("Board = %s\n", bd->bi_board_name);
Timur Tabi7b480702011-10-05 17:08:07 -0500285 print_mhz("VCO", bd->bi_vco);
286 print_mhz("CCLK", bd->bi_cclk);
287 print_mhz("SCLK", bd->bi_sclk);
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500288
Macpaul Lindfd70642011-04-27 16:28:35 +0000289 print_num("boot_params", (ulong)bd->bi_boot_params);
290 print_num("memstart", (ulong)bd->bi_memstart);
291 print_lnum("memsize", (u64)bd->bi_memsize);
292 print_num("flashstart", (ulong)bd->bi_flashstart);
293 print_num("flashsize", (ulong)bd->bi_flashsize);
294 print_num("flashoffset", (ulong)bd->bi_flashoffset);
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500295
Mike Frysinger9335cc72009-02-11 18:50:10 -0500296 print_eth(0);
Mike Frysingerd5695f42009-02-17 00:00:53 -0500297 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
298 printf("baudrate = %d bps\n", bd->bi_baudrate);
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500299
300 return 0;
301}
302
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200303#elif defined(CONFIG_MIPS)
wdenk57b2d802003-06-27 21:31:46 +0000304
Macpaul Lindfd70642011-04-27 16:28:35 +0000305int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk57b2d802003-06-27 21:31:46 +0000306{
wdenk57b2d802003-06-27 21:31:46 +0000307 bd_t *bd = gd->bd;
308
Macpaul Lindfd70642011-04-27 16:28:35 +0000309 print_num("boot_params", (ulong)bd->bi_boot_params);
310 print_num("memstart", (ulong)bd->bi_memstart);
311 print_lnum("memsize", (u64)bd->bi_memsize);
312 print_num("flashstart", (ulong)bd->bi_flashstart);
313 print_num("flashsize", (ulong)bd->bi_flashsize);
314 print_num("flashoffset", (ulong)bd->bi_flashoffset);
wdenk57b2d802003-06-27 21:31:46 +0000315
Mike Frysinger9335cc72009-02-11 18:50:10 -0500316 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000317 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
318 printf("baudrate = %d bps\n", bd->bi_baudrate);
wdenk57b2d802003-06-27 21:31:46 +0000319
320 return 0;
321}
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200322
323#elif defined(CONFIG_AVR32)
324
Macpaul Lindfd70642011-04-27 16:28:35 +0000325int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200326{
327 bd_t *bd = gd->bd;
328
Macpaul Lindfd70642011-04-27 16:28:35 +0000329 print_num("boot_params", (ulong)bd->bi_boot_params);
330 print_num("memstart", (ulong)bd->bi_memstart);
331 print_lnum("memsize", (u64)bd->bi_memsize);
332 print_num("flashstart", (ulong)bd->bi_flashstart);
333 print_num("flashsize", (ulong)bd->bi_flashsize);
334 print_num("flashoffset", (ulong)bd->bi_flashoffset);
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200335
336 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000337 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
338 printf("baudrate = %lu bps\n", bd->bi_baudrate);
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200339
340 return 0;
341}
wdenk57b2d802003-06-27 21:31:46 +0000342
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200343#elif defined(CONFIG_ARM)
wdenk57b2d802003-06-27 21:31:46 +0000344
Macpaul Lindfd70642011-04-27 16:28:35 +0000345int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk57b2d802003-06-27 21:31:46 +0000346{
wdenk57b2d802003-06-27 21:31:46 +0000347 int i;
348 bd_t *bd = gd->bd;
349
Macpaul Lindfd70642011-04-27 16:28:35 +0000350 print_num("arch_number", bd->bi_arch_number);
351 print_num("boot_params", (ulong)bd->bi_boot_params);
wdenk57b2d802003-06-27 21:31:46 +0000352
Macpaul Lindfd70642011-04-27 16:28:35 +0000353 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
wdenk57b2d802003-06-27 21:31:46 +0000354 print_num("DRAM bank", i);
355 print_num("-> start", bd->bi_dram[i].start);
356 print_num("-> size", bd->bi_dram[i].size);
357 }
358
Hebbare6c85282007-12-18 16:03:07 -0800359#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500360 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000361 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Hebbare6c85282007-12-18 16:03:07 -0800362#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000363 printf("baudrate = %d bps\n", bd->bi_baudrate);
Aneesh Vecee9c82011-06-16 23:30:48 +0000364#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
Macpaul Lindfd70642011-04-27 16:28:35 +0000365 print_num("TLB addr", gd->tlb_addr);
Heiko Schocheraeb29912010-09-17 13:10:39 +0200366#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000367 print_num("relocaddr", gd->relocaddr);
368 print_num("reloc off", gd->reloc_off);
369 print_num("irq_sp", gd->irq_sp); /* irq stack pointer */
370 print_num("sp start ", gd->start_addr_sp);
371 print_num("FB base ", gd->fb_base);
wdenk57b2d802003-06-27 21:31:46 +0000372 return 0;
373}
374
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900375#elif defined(CONFIG_SH)
376
Macpaul Lindfd70642011-04-27 16:28:35 +0000377int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900378{
379 bd_t *bd = gd->bd;
Macpaul Lindfd70642011-04-27 16:28:35 +0000380 print_num("mem start ", (ulong)bd->bi_memstart);
381 print_lnum("mem size ", (u64)bd->bi_memsize);
382 print_num("flash start ", (ulong)bd->bi_flashstart);
383 print_num("flash size ", (ulong)bd->bi_flashsize);
384 print_num("flash offset ", (ulong)bd->bi_flashoffset);
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900385
386#if defined(CONFIG_CMD_NET)
387 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000388 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900389#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000390 printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900391 return 0;
392}
393
Graeme Russ14917a92010-08-22 16:25:58 +1000394#elif defined(CONFIG_X86)
395
Macpaul Lindfd70642011-04-27 16:28:35 +0000396int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Graeme Russ14917a92010-08-22 16:25:58 +1000397{
398 int i;
399 bd_t *bd = gd->bd;
Graeme Russ14917a92010-08-22 16:25:58 +1000400
Macpaul Lindfd70642011-04-27 16:28:35 +0000401 print_num("boot_params", (ulong)bd->bi_boot_params);
402 print_num("bi_memstart", bd->bi_memstart);
403 print_num("bi_memsize", bd->bi_memsize);
404 print_num("bi_flashstart", bd->bi_flashstart);
405 print_num("bi_flashsize", bd->bi_flashsize);
406 print_num("bi_flashoffset", bd->bi_flashoffset);
407 print_num("bi_sramstart", bd->bi_sramstart);
408 print_num("bi_sramsize", bd->bi_sramsize);
409 print_num("bi_bootflags", bd->bi_bootflags);
Timur Tabi7b480702011-10-05 17:08:07 -0500410 print_mhz("cpufreq", bd->bi_intfreq);
411 print_mhz("busfreq", bd->bi_busfreq);
Graeme Russ14917a92010-08-22 16:25:58 +1000412
Macpaul Lindfd70642011-04-27 16:28:35 +0000413 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
Graeme Russ14917a92010-08-22 16:25:58 +1000414 print_num("DRAM bank", i);
415 print_num("-> start", bd->bi_dram[i].start);
416 print_num("-> size", bd->bi_dram[i].size);
417 }
418
419#if defined(CONFIG_CMD_NET)
420 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000421 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Timur Tabi7b480702011-10-05 17:08:07 -0500422 print_mhz("ethspeed", bd->bi_ethspeed);
Graeme Russ14917a92010-08-22 16:25:58 +1000423#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000424 printf("baudrate = %d bps\n", bd->bi_baudrate);
Graeme Russ14917a92010-08-22 16:25:58 +1000425
426 return 0;
427}
428
Simon Glass4413ed32011-09-17 06:48:47 +0000429#elif defined(CONFIG_SANDBOX)
430
431int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
432{
433 int i;
434 bd_t *bd = gd->bd;
435
436 print_num("boot_params", (ulong)bd->bi_boot_params);
437
438 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
439 print_num("DRAM bank", i);
440 print_num("-> start", bd->bi_dram[i].start);
441 print_num("-> size", bd->bi_dram[i].size);
442 }
443
444#if defined(CONFIG_CMD_NET)
445 print_eth(0);
446 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
447#endif
448 print_num("FB base ", gd->fb_base);
449 return 0;
450}
451
Macpaul Lin354b4e32011-10-19 20:41:09 +0000452#elif defined(CONFIG_NDS32)
453
454int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
455{
456 int i;
457 bd_t *bd = gd->bd;
458
459 print_num("arch_number", bd->bi_arch_number);
460 print_num("boot_params", (ulong)bd->bi_boot_params);
461
462 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
463 print_num("DRAM bank", i);
464 print_num("-> start", bd->bi_dram[i].start);
465 print_num("-> size", bd->bi_dram[i].size);
466 }
467
468#if defined(CONFIG_CMD_NET)
469 print_eth(0);
470 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
471#endif
472 printf("baudrate = %d bps\n", bd->bi_baudrate);
473
474 return 0;
475}
476
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200477#else
478 #error "a case for this architecture does not exist!"
479#endif
wdenk57b2d802003-06-27 21:31:46 +0000480
wdenk57b2d802003-06-27 21:31:46 +0000481/* -------------------------------------------------------------------- */
482
wdenkf287a242003-07-01 21:06:45 +0000483U_BOOT_CMD(
484 bdinfo, 1, 1, do_bdinfo,
Peter Tyserdfb72b82009-01-27 18:03:12 -0600485 "print Board Info structure",
Wolfgang Denkc54781c2009-05-24 17:06:54 +0200486 ""
wdenk57b2d802003-06-27 21:31:46 +0000487);