blob: 6c485949c0662f6d397a40c3889f8fb603d51e9b [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>
wdenk57b2d802003-06-27 21:31:46 +000029
Wolfgang Denk6405a152006-03-31 18:32:53 +020030DECLARE_GLOBAL_DATA_PTR;
wdenk57b2d802003-06-27 21:31:46 +000031
wdenk57b2d802003-06-27 21:31:46 +000032static void print_num(const char *, ulong);
33
Graeme Russ19fc0d52011-11-08 02:33:20 +000034#if !(defined(CONFIG_ARM) || defined(CONFIG_M68K) || \
35 defined(CONFIG_SANDBOX) || defined(CONFIG_X86)) \
Simon Glass4413ed32011-09-17 06:48:47 +000036 || defined(CONFIG_CMD_NET)
37#define HAVE_PRINT_ETH
Mike Frysinger9335cc72009-02-11 18:50:10 -050038static void print_eth(int idx);
Wolfgang Denk770a1882009-03-29 00:54:21 +010039#endif
Mike Frysinger9335cc72009-02-11 18:50:10 -050040
Simon Glass4413ed32011-09-17 06:48:47 +000041#if (!defined(CONFIG_ARM) && !defined(CONFIG_X86) && !defined(CONFIG_SANDBOX))
42#define HAVE_PRINT_LNUM
Becky Brucea36601e2008-06-09 20:37:16 -050043static void print_lnum(const char *, u64);
Reinhard Meyer0f8337b2010-06-06 19:01:59 +020044#endif
wdenk57b2d802003-06-27 21:31:46 +000045
Reinhard Meyer0f8337b2010-06-06 19:01:59 +020046#if defined(CONFIG_PPC)
Timur Tabi7b480702011-10-05 17:08:07 -050047static void print_mhz(const char *, unsigned long);
wdenk57b2d802003-06-27 21:31:46 +000048
Macpaul Lindfd70642011-04-27 16:28:35 +000049int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk57b2d802003-06-27 21:31:46 +000050{
wdenk57b2d802003-06-27 21:31:46 +000051 bd_t *bd = gd->bd;
wdenk57b2d802003-06-27 21:31:46 +000052
53#ifdef DEBUG
Macpaul Lindfd70642011-04-27 16:28:35 +000054 print_num("bd address", (ulong)bd);
wdenk57b2d802003-06-27 21:31:46 +000055#endif
Macpaul Lindfd70642011-04-27 16:28:35 +000056 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);
wdenk57b2d802003-06-27 21:31:46 +000066#endif
Macpaul Lindfd70642011-04-27 16:28:35 +000067 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)
Timur Tabi7b480702011-10-05 17:08:07 -050074 print_mhz("procfreq", bd->bi_procfreq);
75 print_mhz("plb_busfreq", bd->bi_plb_busfreq);
Macpaul Lindfd70642011-04-27 16:28:35 +000076#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)
Timur Tabi7b480702011-10-05 17:08:07 -050080 print_mhz("pci_busfreq", bd->bi_pci_busfreq);
wdenk57b2d802003-06-27 21:31:46 +000081#endif
Michal Simek594c7b52008-06-24 09:54:09 +020082#else /* ! CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
Jon Loeligerf5ad3782005-07-23 10:37:35 -050083#if defined(CONFIG_CPM2)
Timur Tabi7b480702011-10-05 17:08:07 -050084 print_mhz("vco", bd->bi_vco);
85 print_mhz("sccfreq", bd->bi_sccfreq);
86 print_mhz("brgfreq", bd->bi_brgfreq);
wdenk57b2d802003-06-27 21:31:46 +000087#endif
Timur Tabi7b480702011-10-05 17:08:07 -050088 print_mhz("intfreq", bd->bi_intfreq);
Jon Loeligerf5ad3782005-07-23 10:37:35 -050089#if defined(CONFIG_CPM2)
Timur Tabi7b480702011-10-05 17:08:07 -050090 print_mhz("cpmfreq", bd->bi_cpmfreq);
wdenk57b2d802003-06-27 21:31:46 +000091#endif
Timur Tabi7b480702011-10-05 17:08:07 -050092 print_mhz("busfreq", bd->bi_busfreq);
Michal Simek594c7b52008-06-24 09:54:09 +020093#endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
wdenk337f5652004-10-28 00:09:35 +000094#if defined(CONFIG_MPC8220)
Timur Tabi7b480702011-10-05 17:08:07 -050095 print_mhz("inpfreq", bd->bi_inpfreq);
96 print_mhz("flbfreq", bd->bi_flbfreq);
97 print_mhz("pcifreq", bd->bi_pcifreq);
98 print_mhz("vcofreq", bd->bi_vcofreq);
99 print_mhz("pevfreq", bd->bi_pevfreq);
wdenk337f5652004-10-28 00:09:35 +0000100#endif
wdenk0aeb8532004-10-10 21:21:55 +0000101
Mike Frysinger9335cc72009-02-11 18:50:10 -0500102 print_eth(0);
wdenk54070ab2004-12-31 09:32:47 +0000103#if defined(CONFIG_HAS_ETH1)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500104 print_eth(1);
wdenk0aeb8532004-10-10 21:21:55 +0000105#endif
wdenk54070ab2004-12-31 09:32:47 +0000106#if defined(CONFIG_HAS_ETH2)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500107 print_eth(2);
wdenk9c53f402003-10-15 23:53:47 +0000108#endif
wdenk54070ab2004-12-31 09:32:47 +0000109#if defined(CONFIG_HAS_ETH3)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500110 print_eth(3);
wdenk0aeb8532004-10-10 21:21:55 +0000111#endif
richardretanubune5167f12008-09-29 18:28:23 -0400112#if defined(CONFIG_HAS_ETH4)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500113 print_eth(4);
richardretanubune5167f12008-09-29 18:28:23 -0400114#endif
richardretanubune5167f12008-09-29 18:28:23 -0400115#if defined(CONFIG_HAS_ETH5)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500116 print_eth(5);
richardretanubune5167f12008-09-29 18:28:23 -0400117#endif
118
wdenk57b2d802003-06-27 21:31:46 +0000119#ifdef CONFIG_HERMES
Timur Tabi7b480702011-10-05 17:08:07 -0500120 print_mhz("ethspeed", bd->bi_ethspeed);
wdenk57b2d802003-06-27 21:31:46 +0000121#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000122 printf("IP addr = %pI4\n", &bd->bi_ip_addr);
123 printf("baudrate = %6ld bps\n", bd->bi_baudrate);
124 print_num("relocaddr", gd->relocaddr);
wdenk57b2d802003-06-27 21:31:46 +0000125 return 0;
126}
127
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200128#elif defined(CONFIG_NIOS2)
wdenkef3386f2004-10-10 21:27:30 +0000129
Macpaul Lindfd70642011-04-27 16:28:35 +0000130int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenkef3386f2004-10-10 21:27:30 +0000131{
wdenkef3386f2004-10-10 21:27:30 +0000132 bd_t *bd = gd->bd;
133
Macpaul Lindfd70642011-04-27 16:28:35 +0000134 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);
wdenkef3386f2004-10-10 21:27:30 +0000139
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200140#if defined(CONFIG_SYS_SRAM_BASE)
wdenkef3386f2004-10-10 21:27:30 +0000141 print_num ("sram start", (ulong)bd->bi_sramstart);
142 print_num ("sram size", (ulong)bd->bi_sramsize);
143#endif
144
Jon Loeligerd704d912007-07-10 11:02:44 -0500145#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500146 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000147 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
wdenkef3386f2004-10-10 21:27:30 +0000148#endif
149
Macpaul Lindfd70642011-04-27 16:28:35 +0000150 printf("baudrate = %ld bps\n", bd->bi_baudrate);
wdenkef3386f2004-10-10 21:27:30 +0000151
152 return 0;
153}
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200154
155#elif defined(CONFIG_MICROBLAZE)
Michal Simek922ce202007-03-11 13:48:24 +0100156
Macpaul Lindfd70642011-04-27 16:28:35 +0000157int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Michal Simek922ce202007-03-11 13:48:24 +0100158{
Michal Simek922ce202007-03-11 13:48:24 +0100159 bd_t *bd = gd->bd;
Macpaul Lindfd70642011-04-27 16:28:35 +0000160 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);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200165#if defined(CONFIG_SYS_SRAM_BASE)
Macpaul Lindfd70642011-04-27 16:28:35 +0000166 print_num("sram start ", (ulong)bd->bi_sramstart);
167 print_num("sram size ", (ulong)bd->bi_sramsize);
Michal Simek922ce202007-03-11 13:48:24 +0100168#endif
Jon Loeligerd704d912007-07-10 11:02:44 -0500169#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500170 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000171 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Michal Simek922ce202007-03-11 13:48:24 +0100172#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000173 printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
Michal Simek922ce202007-03-11 13:48:24 +0100174 return 0;
175}
wdenk60164a82003-10-08 23:26:14 +0000176
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200177#elif defined(CONFIG_SPARC)
178
Wolfgang Denk6262d0212010-06-28 22:00:46 +0200179int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100180{
181 bd_t *bd = gd->bd;
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100182
183#ifdef DEBUG
184 print_num("bd address ", (ulong) bd);
185#endif
186 print_num("memstart ", bd->bi_memstart);
Becky Brucea36601e2008-06-09 20:37:16 -0500187 print_lnum("memsize ", bd->bi_memsize);
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100188 print_num("flashstart ", bd->bi_flashstart);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200189 print_num("CONFIG_SYS_MONITOR_BASE ", CONFIG_SYS_MONITOR_BASE);
Jean-Christophe PLAGNIOL-VILLARD7e1cda62008-09-10 22:48:06 +0200190 print_num("CONFIG_ENV_ADDR ", CONFIG_ENV_ADDR);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200191 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,
Wolfgang Denk0191e472010-10-26 14:34:52 +0200200 GENERATED_GBL_DATA_SIZE);
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100201
202#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500203 print_eth(0);
Mike Frysingerd5695f42009-02-17 00:00:53 -0500204 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100205#endif
Mike Frysingerd5695f42009-02-17 00:00:53 -0500206 printf("baudrate = %6ld bps\n", bd->bi_baudrate);
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100207 return 0;
208}
209
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200210#elif defined(CONFIG_M68K)
211
Timur Tabi7b480702011-10-05 17:08:07 -0500212static void print_mhz(const char *, unsigned long);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500213
Macpaul Lindfd70642011-04-27 16:28:35 +0000214int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
TsiChung Liewf6afe722007-06-18 13:50:13 -0500215{
TsiChung Liewf6afe722007-06-18 13:50:13 -0500216 bd_t *bd = gd->bd;
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -0500217
Macpaul Lindfd70642011-04-27 16:28:35 +0000218 print_num("memstart", (ulong)bd->bi_memstart);
219 print_lnum("memsize", (u64)bd->bi_memsize);
220 print_num("flashstart", (ulong)bd->bi_flashstart);
221 print_num("flashsize", (ulong)bd->bi_flashsize);
222 print_num("flashoffset", (ulong)bd->bi_flashoffset);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200223#if defined(CONFIG_SYS_INIT_RAM_ADDR)
Macpaul Lindfd70642011-04-27 16:28:35 +0000224 print_num("sramstart", (ulong)bd->bi_sramstart);
225 print_num("sramsize", (ulong)bd->bi_sramsize);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500226#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200227#if defined(CONFIG_SYS_MBAR)
Macpaul Lindfd70642011-04-27 16:28:35 +0000228 print_num("mbar", bd->bi_mbar_base);
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -0500229#endif
Timur Tabi7b480702011-10-05 17:08:07 -0500230 print_mhz("cpufreq", bd->bi_intfreq);
231 print_mhz("busfreq", bd->bi_busfreq);
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -0500232#ifdef CONFIG_PCI
Timur Tabi7b480702011-10-05 17:08:07 -0500233 print_mhz("pcifreq", bd->bi_pcifreq);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500234#endif
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -0500235#ifdef CONFIG_EXTRA_CLOCK
Timur Tabi7b480702011-10-05 17:08:07 -0500236 print_mhz("flbfreq", bd->bi_flbfreq);
237 print_mhz("inpfreq", bd->bi_inpfreq);
238 print_mhz("vcofreq", bd->bi_vcofreq);
TsiChungLiewfc3ca3b62007-08-16 15:05:11 -0500239#endif
Stefan Roeseaddc4472007-08-18 14:37:52 +0200240#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500241 print_eth(0);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500242#if defined(CONFIG_HAS_ETH1)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500243 print_eth(1);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500244#endif
TsiChung Liewf6afe722007-06-18 13:50:13 -0500245#if defined(CONFIG_HAS_ETH2)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500246 print_eth(2);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500247#endif
TsiChung Liewf6afe722007-06-18 13:50:13 -0500248#if defined(CONFIG_HAS_ETH3)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500249 print_eth(3);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500250#endif
251
Macpaul Lindfd70642011-04-27 16:28:35 +0000252 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Stefan Roeseaddc4472007-08-18 14:37:52 +0200253#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000254 printf("baudrate = %ld bps\n", bd->bi_baudrate);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500255
256 return 0;
257}
258
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500259#elif defined(CONFIG_BLACKFIN)
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200260
Timur Tabi7b480702011-10-05 17:08:07 -0500261static void print_mhz(const char *, unsigned long);
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500262
Wolfgang Denk6262d0212010-06-28 22:00:46 +0200263int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500264{
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500265 bd_t *bd = gd->bd;
266
267 printf("U-Boot = %s\n", bd->bi_r_version);
268 printf("CPU = %s\n", bd->bi_cpu);
269 printf("Board = %s\n", bd->bi_board_name);
Timur Tabi7b480702011-10-05 17:08:07 -0500270 print_mhz("VCO", bd->bi_vco);
271 print_mhz("CCLK", bd->bi_cclk);
272 print_mhz("SCLK", bd->bi_sclk);
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500273
Macpaul Lindfd70642011-04-27 16:28:35 +0000274 print_num("boot_params", (ulong)bd->bi_boot_params);
275 print_num("memstart", (ulong)bd->bi_memstart);
276 print_lnum("memsize", (u64)bd->bi_memsize);
277 print_num("flashstart", (ulong)bd->bi_flashstart);
278 print_num("flashsize", (ulong)bd->bi_flashsize);
279 print_num("flashoffset", (ulong)bd->bi_flashoffset);
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500280
Mike Frysinger9335cc72009-02-11 18:50:10 -0500281 print_eth(0);
Mike Frysingerd5695f42009-02-17 00:00:53 -0500282 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
283 printf("baudrate = %d bps\n", bd->bi_baudrate);
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500284
285 return 0;
286}
287
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200288#elif defined(CONFIG_MIPS)
wdenk57b2d802003-06-27 21:31:46 +0000289
Macpaul Lindfd70642011-04-27 16:28:35 +0000290int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk57b2d802003-06-27 21:31:46 +0000291{
wdenk57b2d802003-06-27 21:31:46 +0000292 bd_t *bd = gd->bd;
293
Macpaul Lindfd70642011-04-27 16:28:35 +0000294 print_num("boot_params", (ulong)bd->bi_boot_params);
295 print_num("memstart", (ulong)bd->bi_memstart);
296 print_lnum("memsize", (u64)bd->bi_memsize);
297 print_num("flashstart", (ulong)bd->bi_flashstart);
298 print_num("flashsize", (ulong)bd->bi_flashsize);
299 print_num("flashoffset", (ulong)bd->bi_flashoffset);
wdenk57b2d802003-06-27 21:31:46 +0000300
Mike Frysinger9335cc72009-02-11 18:50:10 -0500301 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000302 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
303 printf("baudrate = %d bps\n", bd->bi_baudrate);
wdenk57b2d802003-06-27 21:31:46 +0000304
305 return 0;
306}
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200307
308#elif defined(CONFIG_AVR32)
309
Macpaul Lindfd70642011-04-27 16:28:35 +0000310int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200311{
312 bd_t *bd = gd->bd;
313
Macpaul Lindfd70642011-04-27 16:28:35 +0000314 print_num("boot_params", (ulong)bd->bi_boot_params);
315 print_num("memstart", (ulong)bd->bi_memstart);
316 print_lnum("memsize", (u64)bd->bi_memsize);
317 print_num("flashstart", (ulong)bd->bi_flashstart);
318 print_num("flashsize", (ulong)bd->bi_flashsize);
319 print_num("flashoffset", (ulong)bd->bi_flashoffset);
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200320
321 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000322 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
323 printf("baudrate = %lu bps\n", bd->bi_baudrate);
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200324
325 return 0;
326}
wdenk57b2d802003-06-27 21:31:46 +0000327
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200328#elif defined(CONFIG_ARM)
wdenk57b2d802003-06-27 21:31:46 +0000329
Macpaul Lindfd70642011-04-27 16:28:35 +0000330int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk57b2d802003-06-27 21:31:46 +0000331{
wdenk57b2d802003-06-27 21:31:46 +0000332 int i;
333 bd_t *bd = gd->bd;
334
Macpaul Lindfd70642011-04-27 16:28:35 +0000335 print_num("arch_number", bd->bi_arch_number);
336 print_num("boot_params", (ulong)bd->bi_boot_params);
wdenk57b2d802003-06-27 21:31:46 +0000337
Macpaul Lindfd70642011-04-27 16:28:35 +0000338 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
wdenk57b2d802003-06-27 21:31:46 +0000339 print_num("DRAM bank", i);
340 print_num("-> start", bd->bi_dram[i].start);
341 print_num("-> size", bd->bi_dram[i].size);
342 }
343
Hebbare6c85282007-12-18 16:03:07 -0800344#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500345 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000346 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Hebbare6c85282007-12-18 16:03:07 -0800347#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000348 printf("baudrate = %d bps\n", bd->bi_baudrate);
Aneesh Vecee9c82011-06-16 23:30:48 +0000349#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
Macpaul Lindfd70642011-04-27 16:28:35 +0000350 print_num("TLB addr", gd->tlb_addr);
Heiko Schocheraeb29912010-09-17 13:10:39 +0200351#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000352 print_num("relocaddr", gd->relocaddr);
353 print_num("reloc off", gd->reloc_off);
354 print_num("irq_sp", gd->irq_sp); /* irq stack pointer */
355 print_num("sp start ", gd->start_addr_sp);
356 print_num("FB base ", gd->fb_base);
wdenk57b2d802003-06-27 21:31:46 +0000357 return 0;
358}
359
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900360#elif defined(CONFIG_SH)
361
Macpaul Lindfd70642011-04-27 16:28:35 +0000362int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900363{
364 bd_t *bd = gd->bd;
Macpaul Lindfd70642011-04-27 16:28:35 +0000365 print_num("mem start ", (ulong)bd->bi_memstart);
366 print_lnum("mem size ", (u64)bd->bi_memsize);
367 print_num("flash start ", (ulong)bd->bi_flashstart);
368 print_num("flash size ", (ulong)bd->bi_flashsize);
369 print_num("flash offset ", (ulong)bd->bi_flashoffset);
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900370
371#if defined(CONFIG_CMD_NET)
372 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000373 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900374#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000375 printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900376 return 0;
377}
378
Graeme Russ14917a92010-08-22 16:25:58 +1000379#elif defined(CONFIG_X86)
380
Timur Tabi7b480702011-10-05 17:08:07 -0500381static void print_mhz(const char *, unsigned long);
Graeme Russ14917a92010-08-22 16:25:58 +1000382
Macpaul Lindfd70642011-04-27 16:28:35 +0000383int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Graeme Russ14917a92010-08-22 16:25:58 +1000384{
385 int i;
386 bd_t *bd = gd->bd;
Graeme Russ14917a92010-08-22 16:25:58 +1000387
Macpaul Lindfd70642011-04-27 16:28:35 +0000388 print_num("boot_params", (ulong)bd->bi_boot_params);
389 print_num("bi_memstart", bd->bi_memstart);
390 print_num("bi_memsize", bd->bi_memsize);
391 print_num("bi_flashstart", bd->bi_flashstart);
392 print_num("bi_flashsize", bd->bi_flashsize);
393 print_num("bi_flashoffset", bd->bi_flashoffset);
394 print_num("bi_sramstart", bd->bi_sramstart);
395 print_num("bi_sramsize", bd->bi_sramsize);
396 print_num("bi_bootflags", bd->bi_bootflags);
Timur Tabi7b480702011-10-05 17:08:07 -0500397 print_mhz("cpufreq", bd->bi_intfreq);
398 print_mhz("busfreq", bd->bi_busfreq);
Graeme Russ14917a92010-08-22 16:25:58 +1000399
Macpaul Lindfd70642011-04-27 16:28:35 +0000400 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
Graeme Russ14917a92010-08-22 16:25:58 +1000401 print_num("DRAM bank", i);
402 print_num("-> start", bd->bi_dram[i].start);
403 print_num("-> size", bd->bi_dram[i].size);
404 }
405
406#if defined(CONFIG_CMD_NET)
407 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000408 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Timur Tabi7b480702011-10-05 17:08:07 -0500409 print_mhz("ethspeed", bd->bi_ethspeed);
Graeme Russ14917a92010-08-22 16:25:58 +1000410#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000411 printf("baudrate = %d bps\n", bd->bi_baudrate);
Graeme Russ14917a92010-08-22 16:25:58 +1000412
413 return 0;
414}
415
Simon Glass4413ed32011-09-17 06:48:47 +0000416#elif defined(CONFIG_SANDBOX)
417
418int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
419{
420 int i;
421 bd_t *bd = gd->bd;
422
423 print_num("boot_params", (ulong)bd->bi_boot_params);
424
425 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
426 print_num("DRAM bank", i);
427 print_num("-> start", bd->bi_dram[i].start);
428 print_num("-> size", bd->bi_dram[i].size);
429 }
430
431#if defined(CONFIG_CMD_NET)
432 print_eth(0);
433 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
434#endif
435 print_num("FB base ", gd->fb_base);
436 return 0;
437}
438
Macpaul Lin354b4e32011-10-19 20:41:09 +0000439#elif defined(CONFIG_NDS32)
440
441int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
442{
443 int i;
444 bd_t *bd = gd->bd;
445
446 print_num("arch_number", bd->bi_arch_number);
447 print_num("boot_params", (ulong)bd->bi_boot_params);
448
449 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
450 print_num("DRAM bank", i);
451 print_num("-> start", bd->bi_dram[i].start);
452 print_num("-> size", bd->bi_dram[i].size);
453 }
454
455#if defined(CONFIG_CMD_NET)
456 print_eth(0);
457 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
458#endif
459 printf("baudrate = %d bps\n", bd->bi_baudrate);
460
461 return 0;
462}
463
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200464#else
465 #error "a case for this architecture does not exist!"
466#endif
wdenk57b2d802003-06-27 21:31:46 +0000467
468static void print_num(const char *name, ulong value)
469{
Macpaul Lindfd70642011-04-27 16:28:35 +0000470 printf("%-12s= 0x%08lX\n", name, value);
wdenk57b2d802003-06-27 21:31:46 +0000471}
472
Simon Glass4413ed32011-09-17 06:48:47 +0000473#ifdef HAVE_PRINT_ETH
Mike Frysinger9335cc72009-02-11 18:50:10 -0500474static void print_eth(int idx)
475{
476 char name[10], *val;
477 if (idx)
478 sprintf(name, "eth%iaddr", idx);
479 else
480 strcpy(name, "ethaddr");
481 val = getenv(name);
482 if (!val)
483 val = "(not set)";
484 printf("%-12s= %s\n", name, val);
485}
Wolfgang Denk770a1882009-03-29 00:54:21 +0100486#endif
Mike Frysinger9335cc72009-02-11 18:50:10 -0500487
Simon Glass4413ed32011-09-17 06:48:47 +0000488#ifdef HAVE_PRINT_LNUM
Becky Brucea36601e2008-06-09 20:37:16 -0500489static void print_lnum(const char *name, u64 value)
490{
Macpaul Lindfd70642011-04-27 16:28:35 +0000491 printf("%-12s= 0x%.8llX\n", name, value);
Becky Brucea36601e2008-06-09 20:37:16 -0500492}
493#endif
494
Macpaul Lindfd70642011-04-27 16:28:35 +0000495#if defined(CONFIG_PPC) || \
496 defined(CONFIG_M68K) || \
497 defined(CONFIG_BLACKFIN) || \
498 defined(CONFIG_X86)
Timur Tabi7b480702011-10-05 17:08:07 -0500499static void print_mhz(const char *name, unsigned long hz)
wdenk57b2d802003-06-27 21:31:46 +0000500{
Timur Tabi7b480702011-10-05 17:08:07 -0500501 char buf[32];
502
503 printf("%-12s= %6s MHz\n", name, strmhz(buf, hz));
wdenk57b2d802003-06-27 21:31:46 +0000504}
505#endif /* CONFIG_PPC */
506
507
508/* -------------------------------------------------------------------- */
509
wdenkf287a242003-07-01 21:06:45 +0000510U_BOOT_CMD(
511 bdinfo, 1, 1, do_bdinfo,
Peter Tyserdfb72b82009-01-27 18:03:12 -0600512 "print Board Info structure",
Wolfgang Denkc54781c2009-05-24 17:06:54 +0200513 ""
wdenk57b2d802003-06-27 21:31:46 +0000514);