blob: 605112083ee0286ff29af03309f5826fba893dbb [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
Philippe De Muyter004a6ff2009-09-21 22:20:29 -060034#if !(defined(CONFIG_ARM) || defined(CONFIG_M68K)) || defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -050035static void print_eth(int idx);
Wolfgang Denk770a1882009-03-29 00:54:21 +010036#endif
Mike Frysinger9335cc72009-02-11 18:50:10 -050037
Graeme Russ14917a92010-08-22 16:25:58 +100038#if (!defined(CONFIG_ARM) && !defined(CONFIG_X86))
Becky Brucea36601e2008-06-09 20:37:16 -050039static void print_lnum(const char *, u64);
Reinhard Meyer0f8337b2010-06-06 19:01:59 +020040#endif
wdenk57b2d802003-06-27 21:31:46 +000041
Reinhard Meyer0f8337b2010-06-06 19:01:59 +020042#if defined(CONFIG_PPC)
wdenk57b2d802003-06-27 21:31:46 +000043static void print_str(const char *, const char *);
44
Macpaul Lindfd70642011-04-27 16:28:35 +000045int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk57b2d802003-06-27 21:31:46 +000046{
wdenk57b2d802003-06-27 21:31:46 +000047 bd_t *bd = gd->bd;
48 char buf[32];
49
50#ifdef DEBUG
Macpaul Lindfd70642011-04-27 16:28:35 +000051 print_num("bd address", (ulong)bd);
wdenk57b2d802003-06-27 21:31:46 +000052#endif
Macpaul Lindfd70642011-04-27 16:28:35 +000053 print_num("memstart", bd->bi_memstart);
54 print_lnum("memsize", bd->bi_memsize);
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);
60#if defined(CONFIG_5xx) || defined(CONFIG_8xx) || \
61 defined(CONFIG_8260) || defined(CONFIG_E500)
62 print_num("immr_base", bd->bi_immr_base);
wdenk57b2d802003-06-27 21:31:46 +000063#endif
Macpaul Lindfd70642011-04-27 16:28:35 +000064 print_num("bootflags", bd->bi_bootflags);
65#if defined(CONFIG_405CR) || defined(CONFIG_405EP) || \
66 defined(CONFIG_405GP) || \
67 defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
68 defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \
69 defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \
70 defined(CONFIG_XILINX_405)
71 print_str("procfreq", strmhz(buf, bd->bi_procfreq));
72 print_str("plb_busfreq", strmhz(buf, bd->bi_plb_busfreq));
73#if defined(CONFIG_405EP) || defined(CONFIG_405GP) || \
74 defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
75 defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \
76 defined(CONFIG_440SPE) || defined(CONFIG_XILINX_405)
77 print_str("pci_busfreq", strmhz(buf, bd->bi_pci_busfreq));
wdenk57b2d802003-06-27 21:31:46 +000078#endif
Michal Simek594c7b52008-06-24 09:54:09 +020079#else /* ! CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
Jon Loeligerf5ad3782005-07-23 10:37:35 -050080#if defined(CONFIG_CPM2)
Macpaul Lindfd70642011-04-27 16:28:35 +000081 print_str("vco", strmhz(buf, bd->bi_vco));
82 print_str("sccfreq", strmhz(buf, bd->bi_sccfreq));
83 print_str("brgfreq", strmhz(buf, bd->bi_brgfreq));
wdenk57b2d802003-06-27 21:31:46 +000084#endif
Macpaul Lindfd70642011-04-27 16:28:35 +000085 print_str("intfreq", strmhz(buf, bd->bi_intfreq));
Jon Loeligerf5ad3782005-07-23 10:37:35 -050086#if defined(CONFIG_CPM2)
Macpaul Lindfd70642011-04-27 16:28:35 +000087 print_str("cpmfreq", strmhz(buf, bd->bi_cpmfreq));
wdenk57b2d802003-06-27 21:31:46 +000088#endif
Macpaul Lindfd70642011-04-27 16:28:35 +000089 print_str("busfreq", strmhz(buf, bd->bi_busfreq));
Michal Simek594c7b52008-06-24 09:54:09 +020090#endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
wdenk337f5652004-10-28 00:09:35 +000091#if defined(CONFIG_MPC8220)
Macpaul Lindfd70642011-04-27 16:28:35 +000092 print_str("inpfreq", strmhz(buf, bd->bi_inpfreq));
93 print_str("flbfreq", strmhz(buf, bd->bi_flbfreq));
94 print_str("pcifreq", strmhz(buf, bd->bi_pcifreq));
95 print_str("vcofreq", strmhz(buf, bd->bi_vcofreq));
96 print_str("pevfreq", strmhz(buf, bd->bi_pevfreq));
wdenk337f5652004-10-28 00:09:35 +000097#endif
wdenk0aeb8532004-10-10 21:21:55 +000098
Mike Frysinger9335cc72009-02-11 18:50:10 -050099 print_eth(0);
wdenk54070ab2004-12-31 09:32:47 +0000100#if defined(CONFIG_HAS_ETH1)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500101 print_eth(1);
wdenk0aeb8532004-10-10 21:21:55 +0000102#endif
wdenk54070ab2004-12-31 09:32:47 +0000103#if defined(CONFIG_HAS_ETH2)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500104 print_eth(2);
wdenk9c53f402003-10-15 23:53:47 +0000105#endif
wdenk54070ab2004-12-31 09:32:47 +0000106#if defined(CONFIG_HAS_ETH3)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500107 print_eth(3);
wdenk0aeb8532004-10-10 21:21:55 +0000108#endif
richardretanubune5167f12008-09-29 18:28:23 -0400109#if defined(CONFIG_HAS_ETH4)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500110 print_eth(4);
richardretanubune5167f12008-09-29 18:28:23 -0400111#endif
richardretanubune5167f12008-09-29 18:28:23 -0400112#if defined(CONFIG_HAS_ETH5)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500113 print_eth(5);
richardretanubune5167f12008-09-29 18:28:23 -0400114#endif
115
wdenk57b2d802003-06-27 21:31:46 +0000116#ifdef CONFIG_HERMES
Macpaul Lindfd70642011-04-27 16:28:35 +0000117 print_str("ethspeed", strmhz(buf, bd->bi_ethspeed));
wdenk57b2d802003-06-27 21:31:46 +0000118#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000119 printf("IP addr = %pI4\n", &bd->bi_ip_addr);
120 printf("baudrate = %6ld bps\n", bd->bi_baudrate);
121 print_num("relocaddr", gd->relocaddr);
wdenk57b2d802003-06-27 21:31:46 +0000122 return 0;
123}
124
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200125#elif defined(CONFIG_NIOS2)
wdenkef3386f2004-10-10 21:27:30 +0000126
Macpaul Lindfd70642011-04-27 16:28:35 +0000127int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenkef3386f2004-10-10 21:27:30 +0000128{
wdenkef3386f2004-10-10 21:27:30 +0000129 bd_t *bd = gd->bd;
130
Macpaul Lindfd70642011-04-27 16:28:35 +0000131 print_num("mem start", (ulong)bd->bi_memstart);
132 print_lnum("mem size", (u64)bd->bi_memsize);
133 print_num("flash start", (ulong)bd->bi_flashstart);
134 print_num("flash size", (ulong)bd->bi_flashsize);
135 print_num("flash offset", (ulong)bd->bi_flashoffset);
wdenkef3386f2004-10-10 21:27:30 +0000136
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200137#if defined(CONFIG_SYS_SRAM_BASE)
wdenkef3386f2004-10-10 21:27:30 +0000138 print_num ("sram start", (ulong)bd->bi_sramstart);
139 print_num ("sram size", (ulong)bd->bi_sramsize);
140#endif
141
Jon Loeligerd704d912007-07-10 11:02:44 -0500142#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500143 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000144 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
wdenkef3386f2004-10-10 21:27:30 +0000145#endif
146
Macpaul Lindfd70642011-04-27 16:28:35 +0000147 printf("baudrate = %ld bps\n", bd->bi_baudrate);
wdenkef3386f2004-10-10 21:27:30 +0000148
149 return 0;
150}
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200151
152#elif defined(CONFIG_MICROBLAZE)
Michal Simek922ce202007-03-11 13:48:24 +0100153
Macpaul Lindfd70642011-04-27 16:28:35 +0000154int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Michal Simek922ce202007-03-11 13:48:24 +0100155{
Michal Simek922ce202007-03-11 13:48:24 +0100156 bd_t *bd = gd->bd;
Macpaul Lindfd70642011-04-27 16:28:35 +0000157 print_num("mem start ", (ulong)bd->bi_memstart);
158 print_lnum("mem size ", (u64)bd->bi_memsize);
159 print_num("flash start ", (ulong)bd->bi_flashstart);
160 print_num("flash size ", (ulong)bd->bi_flashsize);
161 print_num("flash offset ", (ulong)bd->bi_flashoffset);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200162#if defined(CONFIG_SYS_SRAM_BASE)
Macpaul Lindfd70642011-04-27 16:28:35 +0000163 print_num("sram start ", (ulong)bd->bi_sramstart);
164 print_num("sram size ", (ulong)bd->bi_sramsize);
Michal Simek922ce202007-03-11 13:48:24 +0100165#endif
Jon Loeligerd704d912007-07-10 11:02:44 -0500166#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500167 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000168 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Michal Simek922ce202007-03-11 13:48:24 +0100169#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000170 printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
Michal Simek922ce202007-03-11 13:48:24 +0100171 return 0;
172}
wdenk60164a82003-10-08 23:26:14 +0000173
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200174#elif defined(CONFIG_SPARC)
175
Wolfgang Denk6262d0212010-06-28 22:00:46 +0200176int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100177{
178 bd_t *bd = gd->bd;
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100179
180#ifdef DEBUG
181 print_num("bd address ", (ulong) bd);
182#endif
183 print_num("memstart ", bd->bi_memstart);
Becky Brucea36601e2008-06-09 20:37:16 -0500184 print_lnum("memsize ", bd->bi_memsize);
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100185 print_num("flashstart ", bd->bi_flashstart);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200186 print_num("CONFIG_SYS_MONITOR_BASE ", CONFIG_SYS_MONITOR_BASE);
Jean-Christophe PLAGNIOL-VILLARD7e1cda62008-09-10 22:48:06 +0200187 print_num("CONFIG_ENV_ADDR ", CONFIG_ENV_ADDR);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200188 printf("CONFIG_SYS_RELOC_MONITOR_BASE = 0x%lx (%d)\n", CONFIG_SYS_RELOC_MONITOR_BASE,
189 CONFIG_SYS_MONITOR_LEN);
190 printf("CONFIG_SYS_MALLOC_BASE = 0x%lx (%d)\n", CONFIG_SYS_MALLOC_BASE,
191 CONFIG_SYS_MALLOC_LEN);
192 printf("CONFIG_SYS_INIT_SP_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_INIT_SP_OFFSET,
193 CONFIG_SYS_STACK_SIZE);
194 printf("CONFIG_SYS_PROM_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_PROM_OFFSET,
195 CONFIG_SYS_PROM_SIZE);
196 printf("CONFIG_SYS_GBL_DATA_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET,
Wolfgang Denk0191e472010-10-26 14:34:52 +0200197 GENERATED_GBL_DATA_SIZE);
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100198
199#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500200 print_eth(0);
Mike Frysingerd5695f42009-02-17 00:00:53 -0500201 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100202#endif
Mike Frysingerd5695f42009-02-17 00:00:53 -0500203 printf("baudrate = %6ld bps\n", bd->bi_baudrate);
Daniel Hellstrom83eb3cc2008-03-26 22:36:03 +0100204 return 0;
205}
206
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200207#elif defined(CONFIG_M68K)
208
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -0500209static void print_str(const char *, const char *);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500210
Macpaul Lindfd70642011-04-27 16:28:35 +0000211int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
TsiChung Liewf6afe722007-06-18 13:50:13 -0500212{
TsiChung Liewf6afe722007-06-18 13:50:13 -0500213 bd_t *bd = gd->bd;
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -0500214 char buf[32];
215
Macpaul Lindfd70642011-04-27 16:28:35 +0000216 print_num("memstart", (ulong)bd->bi_memstart);
217 print_lnum("memsize", (u64)bd->bi_memsize);
218 print_num("flashstart", (ulong)bd->bi_flashstart);
219 print_num("flashsize", (ulong)bd->bi_flashsize);
220 print_num("flashoffset", (ulong)bd->bi_flashoffset);
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200221#if defined(CONFIG_SYS_INIT_RAM_ADDR)
Macpaul Lindfd70642011-04-27 16:28:35 +0000222 print_num("sramstart", (ulong)bd->bi_sramstart);
223 print_num("sramsize", (ulong)bd->bi_sramsize);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500224#endif
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200225#if defined(CONFIG_SYS_MBAR)
Macpaul Lindfd70642011-04-27 16:28:35 +0000226 print_num("mbar", bd->bi_mbar_base);
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -0500227#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000228 print_str("cpufreq", strmhz(buf, bd->bi_intfreq));
229 print_str("busfreq", strmhz(buf, bd->bi_busfreq));
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -0500230#ifdef CONFIG_PCI
Macpaul Lindfd70642011-04-27 16:28:35 +0000231 print_str("pcifreq", strmhz(buf, bd->bi_pcifreq));
TsiChung Liewf6afe722007-06-18 13:50:13 -0500232#endif
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -0500233#ifdef CONFIG_EXTRA_CLOCK
Macpaul Lindfd70642011-04-27 16:28:35 +0000234 print_str("flbfreq", strmhz(buf, bd->bi_flbfreq));
235 print_str("inpfreq", strmhz(buf, bd->bi_inpfreq));
236 print_str("vcofreq", strmhz(buf, bd->bi_vcofreq));
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -0500237#endif
Stefan Roeseaddc4472007-08-18 14:37:52 +0200238#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500239 print_eth(0);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500240#if defined(CONFIG_HAS_ETH1)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500241 print_eth(1);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500242#endif
TsiChung Liewf6afe722007-06-18 13:50:13 -0500243#if defined(CONFIG_HAS_ETH2)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500244 print_eth(2);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500245#endif
TsiChung Liewf6afe722007-06-18 13:50:13 -0500246#if defined(CONFIG_HAS_ETH3)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500247 print_eth(3);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500248#endif
249
Macpaul Lindfd70642011-04-27 16:28:35 +0000250 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Stefan Roeseaddc4472007-08-18 14:37:52 +0200251#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000252 printf("baudrate = %ld bps\n", bd->bi_baudrate);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500253
254 return 0;
255}
256
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500257#elif defined(CONFIG_BLACKFIN)
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200258
Mike Frysingera2672072008-10-20 16:15:04 -0400259static void print_str(const char *, const char *);
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500260
Wolfgang Denk6262d0212010-06-28 22:00:46 +0200261int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500262{
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500263 bd_t *bd = gd->bd;
Mike Frysingera2672072008-10-20 16:15:04 -0400264 char buf[32];
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500265
266 printf("U-Boot = %s\n", bd->bi_r_version);
267 printf("CPU = %s\n", bd->bi_cpu);
268 printf("Board = %s\n", bd->bi_board_name);
Macpaul Lindfd70642011-04-27 16:28:35 +0000269 print_str("VCO", strmhz(buf, bd->bi_vco));
270 print_str("CCLK", strmhz(buf, bd->bi_cclk));
271 print_str("SCLK", strmhz(buf, bd->bi_sclk));
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500272
Macpaul Lindfd70642011-04-27 16:28:35 +0000273 print_num("boot_params", (ulong)bd->bi_boot_params);
274 print_num("memstart", (ulong)bd->bi_memstart);
275 print_lnum("memsize", (u64)bd->bi_memsize);
276 print_num("flashstart", (ulong)bd->bi_flashstart);
277 print_num("flashsize", (ulong)bd->bi_flashsize);
278 print_num("flashoffset", (ulong)bd->bi_flashoffset);
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500279
Mike Frysinger9335cc72009-02-11 18:50:10 -0500280 print_eth(0);
Mike Frysingerd5695f42009-02-17 00:00:53 -0500281 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
282 printf("baudrate = %d bps\n", bd->bi_baudrate);
Mike Frysingerf443d3c2008-02-04 19:26:55 -0500283
284 return 0;
285}
286
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200287#elif defined(CONFIG_MIPS)
wdenk57b2d802003-06-27 21:31:46 +0000288
Macpaul Lindfd70642011-04-27 16:28:35 +0000289int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk57b2d802003-06-27 21:31:46 +0000290{
wdenk57b2d802003-06-27 21:31:46 +0000291 bd_t *bd = gd->bd;
292
Macpaul Lindfd70642011-04-27 16:28:35 +0000293 print_num("boot_params", (ulong)bd->bi_boot_params);
294 print_num("memstart", (ulong)bd->bi_memstart);
295 print_lnum("memsize", (u64)bd->bi_memsize);
296 print_num("flashstart", (ulong)bd->bi_flashstart);
297 print_num("flashsize", (ulong)bd->bi_flashsize);
298 print_num("flashoffset", (ulong)bd->bi_flashoffset);
wdenk57b2d802003-06-27 21:31:46 +0000299
Mike Frysinger9335cc72009-02-11 18:50:10 -0500300 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000301 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
302 printf("baudrate = %d bps\n", bd->bi_baudrate);
wdenk57b2d802003-06-27 21:31:46 +0000303
304 return 0;
305}
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200306
307#elif defined(CONFIG_AVR32)
308
Macpaul Lindfd70642011-04-27 16:28:35 +0000309int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200310{
311 bd_t *bd = gd->bd;
312
Macpaul Lindfd70642011-04-27 16:28:35 +0000313 print_num("boot_params", (ulong)bd->bi_boot_params);
314 print_num("memstart", (ulong)bd->bi_memstart);
315 print_lnum("memsize", (u64)bd->bi_memsize);
316 print_num("flashstart", (ulong)bd->bi_flashstart);
317 print_num("flashsize", (ulong)bd->bi_flashsize);
318 print_num("flashoffset", (ulong)bd->bi_flashoffset);
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200319
320 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000321 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
322 printf("baudrate = %lu bps\n", bd->bi_baudrate);
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200323
324 return 0;
325}
wdenk57b2d802003-06-27 21:31:46 +0000326
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200327#elif defined(CONFIG_ARM)
wdenk57b2d802003-06-27 21:31:46 +0000328
Macpaul Lindfd70642011-04-27 16:28:35 +0000329int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk57b2d802003-06-27 21:31:46 +0000330{
wdenk57b2d802003-06-27 21:31:46 +0000331 int i;
332 bd_t *bd = gd->bd;
333
Macpaul Lindfd70642011-04-27 16:28:35 +0000334 print_num("arch_number", bd->bi_arch_number);
335 print_num("boot_params", (ulong)bd->bi_boot_params);
wdenk57b2d802003-06-27 21:31:46 +0000336
Macpaul Lindfd70642011-04-27 16:28:35 +0000337 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
wdenk57b2d802003-06-27 21:31:46 +0000338 print_num("DRAM bank", i);
339 print_num("-> start", bd->bi_dram[i].start);
340 print_num("-> size", bd->bi_dram[i].size);
341 }
342
Hebbare6c85282007-12-18 16:03:07 -0800343#if defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500344 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000345 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Hebbare6c85282007-12-18 16:03:07 -0800346#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000347 printf("baudrate = %d bps\n", bd->bi_baudrate);
Aneesh Vecee9c82011-06-16 23:30:48 +0000348#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
Macpaul Lindfd70642011-04-27 16:28:35 +0000349 print_num("TLB addr", gd->tlb_addr);
Heiko Schocheraeb29912010-09-17 13:10:39 +0200350#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000351 print_num("relocaddr", gd->relocaddr);
352 print_num("reloc off", gd->reloc_off);
353 print_num("irq_sp", gd->irq_sp); /* irq stack pointer */
354 print_num("sp start ", gd->start_addr_sp);
355 print_num("FB base ", gd->fb_base);
wdenk57b2d802003-06-27 21:31:46 +0000356 return 0;
357}
358
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900359#elif defined(CONFIG_SH)
360
Macpaul Lindfd70642011-04-27 16:28:35 +0000361int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900362{
363 bd_t *bd = gd->bd;
Macpaul Lindfd70642011-04-27 16:28:35 +0000364 print_num("mem start ", (ulong)bd->bi_memstart);
365 print_lnum("mem size ", (u64)bd->bi_memsize);
366 print_num("flash start ", (ulong)bd->bi_flashstart);
367 print_num("flash size ", (ulong)bd->bi_flashsize);
368 print_num("flash offset ", (ulong)bd->bi_flashoffset);
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900369
370#if defined(CONFIG_CMD_NET)
371 print_eth(0);
Macpaul Lindfd70642011-04-27 16:28:35 +0000372 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900373#endif
Macpaul Lindfd70642011-04-27 16:28:35 +0000374 printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
Nobuhiro Iwamatsu3da00e62010-07-22 16:05:32 +0900375 return 0;
376}
377
Graeme Russ14917a92010-08-22 16:25:58 +1000378#elif defined(CONFIG_X86)
379
380static void print_str(const char *, const char *);
381
Macpaul Lindfd70642011-04-27 16:28:35 +0000382int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Graeme Russ14917a92010-08-22 16:25:58 +1000383{
384 int i;
385 bd_t *bd = gd->bd;
386 char buf[32];
387
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);
397 print_str("cpufreq", strmhz(buf, bd->bi_intfreq));
398 print_str("busfreq", strmhz(buf, 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);
409 print_str("ethspeed", strmhz(buf, 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
Reinhard Meyer0f8337b2010-06-06 19:01:59 +0200416#else
417 #error "a case for this architecture does not exist!"
418#endif
wdenk57b2d802003-06-27 21:31:46 +0000419
420static void print_num(const char *name, ulong value)
421{
Macpaul Lindfd70642011-04-27 16:28:35 +0000422 printf("%-12s= 0x%08lX\n", name, value);
wdenk57b2d802003-06-27 21:31:46 +0000423}
424
Philippe De Muyter004a6ff2009-09-21 22:20:29 -0600425#if !(defined(CONFIG_ARM) || defined(CONFIG_M68K)) || defined(CONFIG_CMD_NET)
Mike Frysinger9335cc72009-02-11 18:50:10 -0500426static void print_eth(int idx)
427{
428 char name[10], *val;
429 if (idx)
430 sprintf(name, "eth%iaddr", idx);
431 else
432 strcpy(name, "ethaddr");
433 val = getenv(name);
434 if (!val)
435 val = "(not set)";
436 printf("%-12s= %s\n", name, val);
437}
Wolfgang Denk770a1882009-03-29 00:54:21 +0100438#endif
Mike Frysinger9335cc72009-02-11 18:50:10 -0500439
Graeme Russ14917a92010-08-22 16:25:58 +1000440#if (!defined(CONFIG_ARM) && !defined(CONFIG_X86))
Becky Brucea36601e2008-06-09 20:37:16 -0500441static void print_lnum(const char *name, u64 value)
442{
Macpaul Lindfd70642011-04-27 16:28:35 +0000443 printf("%-12s= 0x%.8llX\n", name, value);
Becky Brucea36601e2008-06-09 20:37:16 -0500444}
445#endif
446
Macpaul Lindfd70642011-04-27 16:28:35 +0000447#if defined(CONFIG_PPC) || \
448 defined(CONFIG_M68K) || \
449 defined(CONFIG_BLACKFIN) || \
450 defined(CONFIG_X86)
wdenk57b2d802003-06-27 21:31:46 +0000451static void print_str(const char *name, const char *str)
452{
Macpaul Lindfd70642011-04-27 16:28:35 +0000453 printf("%-12s= %6s MHz\n", name, str);
wdenk57b2d802003-06-27 21:31:46 +0000454}
455#endif /* CONFIG_PPC */
456
457
458/* -------------------------------------------------------------------- */
459
wdenkf287a242003-07-01 21:06:45 +0000460U_BOOT_CMD(
461 bdinfo, 1, 1, do_bdinfo,
Peter Tyserdfb72b82009-01-27 18:03:12 -0600462 "print Board Info structure",
Wolfgang Denkc54781c2009-05-24 17:06:54 +0200463 ""
wdenk57b2d802003-06-27 21:31:46 +0000464);