blob: bba73746097757f969bdb7a7e8ed335b6073fb2d [file] [log] [blame]
wdenk8bde7f72003-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>
wdenk8bde7f72003-06-27 21:31:46 +000029
Wolfgang Denkd87080b2006-03-31 18:32:53 +020030DECLARE_GLOBAL_DATA_PTR;
wdenk8bde7f72003-06-27 21:31:46 +000031
wdenk8bde7f72003-06-27 21:31:46 +000032static void print_num(const char *, ulong);
33
Philippe De Muyter116095e2009-09-21 22:20:29 -060034#if !(defined(CONFIG_ARM) || defined(CONFIG_M68K)) || defined(CONFIG_CMD_NET)
Mike Frysingerde2dff62009-02-11 18:50:10 -050035static void print_eth(int idx);
Wolfgang Denk26e42cb2009-03-29 00:54:21 +010036#endif
Mike Frysingerde2dff62009-02-11 18:50:10 -050037
Graeme Russa806ee62010-08-22 16:25:58 +100038#if (!defined(CONFIG_ARM) && !defined(CONFIG_X86))
Becky Bruceb57ca3e2008-06-09 20:37:16 -050039static void print_lnum(const char *, u64);
Reinhard Meyerc99ea792010-06-06 19:01:59 +020040#endif
wdenk8bde7f72003-06-27 21:31:46 +000041
Reinhard Meyerc99ea792010-06-06 19:01:59 +020042#if defined(CONFIG_PPC)
wdenk8bde7f72003-06-27 21:31:46 +000043static void print_str(const char *, const char *);
44
Wolfgang Denk54841ab2010-06-28 22:00:46 +020045int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk8bde7f72003-06-27 21:31:46 +000046{
wdenk8bde7f72003-06-27 21:31:46 +000047 bd_t *bd = gd->bd;
48 char buf[32];
49
50#ifdef DEBUG
51 print_num ("bd address", (ulong)bd );
52#endif
53 print_num ("memstart", bd->bi_memstart );
Becky Bruceb57ca3e2008-06-09 20:37:16 -050054 print_lnum ("memsize", bd->bi_memsize );
wdenk8bde7f72003-06-27 21:31:46 +000055 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 );
wdenk97d80fc2004-06-09 00:34:46 +000060#if defined(CONFIG_5xx) || defined(CONFIG_8xx) || \
61 defined(CONFIG_8260) || defined(CONFIG_E500)
wdenk8bde7f72003-06-27 21:31:46 +000062 print_num ("immr_base", bd->bi_immr_base );
63#endif
64 print_num ("bootflags", bd->bi_bootflags );
wdenk97d80fc2004-06-09 00:34:46 +000065#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \
Michal Simek9fea65a2008-06-24 09:54:09 +020066 defined(CONFIG_405EP) || defined(CONFIG_XILINX_405) || \
Marian Balakowicz6c5879f2006-06-30 16:30:46 +020067 defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
Stefan Roese887e2ec2006-09-07 11:51:23 +020068 defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
69 defined(CONFIG_440SP) || defined(CONFIG_440SPE)
wdenk8bde7f72003-06-27 21:31:46 +000070 print_str ("procfreq", strmhz(buf, bd->bi_procfreq));
wdenk983fda82004-10-28 00:09:35 +000071 print_str ("plb_busfreq", strmhz(buf, bd->bi_plb_busfreq));
Michal Simek9fea65a2008-06-24 09:54:09 +020072#if defined(CONFIG_405GP) || defined(CONFIG_405EP) || defined(CONFIG_XILINX_405) || \
Stefan Roese887e2ec2006-09-07 11:51:23 +020073 defined(CONFIG_440EP) || defined(CONFIG_440GR) || defined(CONFIG_440SPE) || \
74 defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
wdenk983fda82004-10-28 00:09:35 +000075 print_str ("pci_busfreq", strmhz(buf, bd->bi_pci_busfreq));
wdenk8bde7f72003-06-27 21:31:46 +000076#endif
Michal Simek9fea65a2008-06-24 09:54:09 +020077#else /* ! CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
Jon Loeliger9c4c5ae2005-07-23 10:37:35 -050078#if defined(CONFIG_CPM2)
wdenk8bde7f72003-06-27 21:31:46 +000079 print_str ("vco", strmhz(buf, bd->bi_vco));
80 print_str ("sccfreq", strmhz(buf, bd->bi_sccfreq));
81 print_str ("brgfreq", strmhz(buf, bd->bi_brgfreq));
82#endif
83 print_str ("intfreq", strmhz(buf, bd->bi_intfreq));
Jon Loeliger9c4c5ae2005-07-23 10:37:35 -050084#if defined(CONFIG_CPM2)
wdenk8bde7f72003-06-27 21:31:46 +000085 print_str ("cpmfreq", strmhz(buf, bd->bi_cpmfreq));
86#endif
87 print_str ("busfreq", strmhz(buf, bd->bi_busfreq));
Michal Simek9fea65a2008-06-24 09:54:09 +020088#endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
wdenk983fda82004-10-28 00:09:35 +000089#if defined(CONFIG_MPC8220)
90 print_str ("inpfreq", strmhz(buf, bd->bi_inpfreq));
91 print_str ("flbfreq", strmhz(buf, bd->bi_flbfreq));
92 print_str ("pcifreq", strmhz(buf, bd->bi_pcifreq));
93 print_str ("vcofreq", strmhz(buf, bd->bi_vcofreq));
94 print_str ("pevfreq", strmhz(buf, bd->bi_pevfreq));
95#endif
wdenk03f5c552004-10-10 21:21:55 +000096
Mike Frysingerde2dff62009-02-11 18:50:10 -050097 print_eth(0);
wdenke2ffd592004-12-31 09:32:47 +000098#if defined(CONFIG_HAS_ETH1)
Mike Frysingerde2dff62009-02-11 18:50:10 -050099 print_eth(1);
wdenk03f5c552004-10-10 21:21:55 +0000100#endif
wdenke2ffd592004-12-31 09:32:47 +0000101#if defined(CONFIG_HAS_ETH2)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500102 print_eth(2);
wdenk42d1f032003-10-15 23:53:47 +0000103#endif
wdenke2ffd592004-12-31 09:32:47 +0000104#if defined(CONFIG_HAS_ETH3)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500105 print_eth(3);
wdenk03f5c552004-10-10 21:21:55 +0000106#endif
richardretanubunc68a05f2008-09-29 18:28:23 -0400107#if defined(CONFIG_HAS_ETH4)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500108 print_eth(4);
richardretanubunc68a05f2008-09-29 18:28:23 -0400109#endif
richardretanubunc68a05f2008-09-29 18:28:23 -0400110#if defined(CONFIG_HAS_ETH5)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500111 print_eth(5);
richardretanubunc68a05f2008-09-29 18:28:23 -0400112#endif
113
wdenk8bde7f72003-06-27 21:31:46 +0000114#ifdef CONFIG_HERMES
115 print_str ("ethspeed", strmhz(buf, bd->bi_ethspeed));
116#endif
Mike Frysingerb6446b62009-02-17 00:00:53 -0500117 printf ("IP addr = %pI4\n", &bd->bi_ip_addr);
118 printf ("baudrate = %6ld bps\n", bd->bi_baudrate );
Richard Retanubun4b993272010-01-15 10:06:06 -0500119 print_num ("relocaddr", gd->relocaddr);
wdenk8bde7f72003-06-27 21:31:46 +0000120 return 0;
121}
122
Reinhard Meyerc99ea792010-06-06 19:01:59 +0200123#elif defined(CONFIG_NIOS2)
wdenk5c952cf2004-10-10 21:27:30 +0000124
Wolfgang Denk54841ab2010-06-28 22:00:46 +0200125int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk5c952cf2004-10-10 21:27:30 +0000126{
wdenk5c952cf2004-10-10 21:27:30 +0000127 bd_t *bd = gd->bd;
128
129 print_num ("mem start", (ulong)bd->bi_memstart);
Becky Bruceb57ca3e2008-06-09 20:37:16 -0500130 print_lnum ("mem size", (u64)bd->bi_memsize);
wdenk5c952cf2004-10-10 21:27:30 +0000131 print_num ("flash start", (ulong)bd->bi_flashstart);
132 print_num ("flash size", (ulong)bd->bi_flashsize);
133 print_num ("flash offset", (ulong)bd->bi_flashoffset);
134
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200135#if defined(CONFIG_SYS_SRAM_BASE)
wdenk5c952cf2004-10-10 21:27:30 +0000136 print_num ("sram start", (ulong)bd->bi_sramstart);
137 print_num ("sram size", (ulong)bd->bi_sramsize);
138#endif
139
Jon Loeliger90253172007-07-10 11:02:44 -0500140#if defined(CONFIG_CMD_NET)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500141 print_eth(0);
Mike Frysingerb6446b62009-02-17 00:00:53 -0500142 printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
wdenk5c952cf2004-10-10 21:27:30 +0000143#endif
144
Mike Frysingerb6446b62009-02-17 00:00:53 -0500145 printf ("baudrate = %ld bps\n", bd->bi_baudrate);
wdenk5c952cf2004-10-10 21:27:30 +0000146
147 return 0;
148}
Reinhard Meyerc99ea792010-06-06 19:01:59 +0200149
150#elif defined(CONFIG_MICROBLAZE)
Michal Simekcfc67112007-03-11 13:48:24 +0100151
Wolfgang Denk54841ab2010-06-28 22:00:46 +0200152int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Michal Simekcfc67112007-03-11 13:48:24 +0100153{
Michal Simekcfc67112007-03-11 13:48:24 +0100154 bd_t *bd = gd->bd;
155 print_num ("mem start ", (ulong)bd->bi_memstart);
Becky Bruceb57ca3e2008-06-09 20:37:16 -0500156 print_lnum ("mem size ", (u64)bd->bi_memsize);
Michal Simekcfc67112007-03-11 13:48:24 +0100157 print_num ("flash start ", (ulong)bd->bi_flashstart);
158 print_num ("flash size ", (ulong)bd->bi_flashsize);
159 print_num ("flash offset ", (ulong)bd->bi_flashoffset);
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200160#if defined(CONFIG_SYS_SRAM_BASE)
Michal Simekcfc67112007-03-11 13:48:24 +0100161 print_num ("sram start ", (ulong)bd->bi_sramstart);
162 print_num ("sram size ", (ulong)bd->bi_sramsize);
163#endif
Jon Loeliger90253172007-07-10 11:02:44 -0500164#if defined(CONFIG_CMD_NET)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500165 print_eth(0);
Mike Frysingerb6446b62009-02-17 00:00:53 -0500166 printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
Michal Simekcfc67112007-03-11 13:48:24 +0100167#endif
Mike Frysingerb6446b62009-02-17 00:00:53 -0500168 printf ("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
Michal Simekcfc67112007-03-11 13:48:24 +0100169 return 0;
170}
wdenk4a551702003-10-08 23:26:14 +0000171
Reinhard Meyerc99ea792010-06-06 19:01:59 +0200172#elif defined(CONFIG_SPARC)
173
Wolfgang Denk54841ab2010-06-28 22:00:46 +0200174int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
Daniel Hellstrom00ab32c2008-03-26 22:36:03 +0100175{
176 bd_t *bd = gd->bd;
Daniel Hellstrom00ab32c2008-03-26 22:36:03 +0100177
178#ifdef DEBUG
179 print_num("bd address ", (ulong) bd);
180#endif
181 print_num("memstart ", bd->bi_memstart);
Becky Bruceb57ca3e2008-06-09 20:37:16 -0500182 print_lnum("memsize ", bd->bi_memsize);
Daniel Hellstrom00ab32c2008-03-26 22:36:03 +0100183 print_num("flashstart ", bd->bi_flashstart);
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200184 print_num("CONFIG_SYS_MONITOR_BASE ", CONFIG_SYS_MONITOR_BASE);
Jean-Christophe PLAGNIOL-VILLARD0e8d1582008-09-10 22:48:06 +0200185 print_num("CONFIG_ENV_ADDR ", CONFIG_ENV_ADDR);
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200186 printf("CONFIG_SYS_RELOC_MONITOR_BASE = 0x%lx (%d)\n", CONFIG_SYS_RELOC_MONITOR_BASE,
187 CONFIG_SYS_MONITOR_LEN);
188 printf("CONFIG_SYS_MALLOC_BASE = 0x%lx (%d)\n", CONFIG_SYS_MALLOC_BASE,
189 CONFIG_SYS_MALLOC_LEN);
190 printf("CONFIG_SYS_INIT_SP_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_INIT_SP_OFFSET,
191 CONFIG_SYS_STACK_SIZE);
192 printf("CONFIG_SYS_PROM_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_PROM_OFFSET,
193 CONFIG_SYS_PROM_SIZE);
194 printf("CONFIG_SYS_GBL_DATA_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET,
Wolfgang Denk25ddd1f2010-10-26 14:34:52 +0200195 GENERATED_GBL_DATA_SIZE);
Daniel Hellstrom00ab32c2008-03-26 22:36:03 +0100196
197#if defined(CONFIG_CMD_NET)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500198 print_eth(0);
Mike Frysingerb6446b62009-02-17 00:00:53 -0500199 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Daniel Hellstrom00ab32c2008-03-26 22:36:03 +0100200#endif
Mike Frysingerb6446b62009-02-17 00:00:53 -0500201 printf("baudrate = %6ld bps\n", bd->bi_baudrate);
Daniel Hellstrom00ab32c2008-03-26 22:36:03 +0100202 return 0;
203}
204
Reinhard Meyerc99ea792010-06-06 19:01:59 +0200205#elif defined(CONFIG_M68K)
206
TsiChungLiew8ae158c2007-08-16 15:05:11 -0500207static void print_str(const char *, const char *);
TsiChung Liew8e585f02007-06-18 13:50:13 -0500208
Wolfgang Denk54841ab2010-06-28 22:00:46 +0200209int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
TsiChung Liew8e585f02007-06-18 13:50:13 -0500210{
TsiChung Liew8e585f02007-06-18 13:50:13 -0500211 bd_t *bd = gd->bd;
TsiChungLiew8ae158c2007-08-16 15:05:11 -0500212 char buf[32];
213
TsiChung Liew8e585f02007-06-18 13:50:13 -0500214 print_num ("memstart", (ulong)bd->bi_memstart);
Becky Bruceb57ca3e2008-06-09 20:37:16 -0500215 print_lnum ("memsize", (u64)bd->bi_memsize);
TsiChung Liew8e585f02007-06-18 13:50:13 -0500216 print_num ("flashstart", (ulong)bd->bi_flashstart);
217 print_num ("flashsize", (ulong)bd->bi_flashsize);
218 print_num ("flashoffset", (ulong)bd->bi_flashoffset);
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200219#if defined(CONFIG_SYS_INIT_RAM_ADDR)
TsiChungLiew8ae158c2007-08-16 15:05:11 -0500220 print_num ("sramstart", (ulong)bd->bi_sramstart);
221 print_num ("sramsize", (ulong)bd->bi_sramsize);
TsiChung Liew8e585f02007-06-18 13:50:13 -0500222#endif
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200223#if defined(CONFIG_SYS_MBAR)
TsiChungLiew8ae158c2007-08-16 15:05:11 -0500224 print_num ("mbar", bd->bi_mbar_base);
TsiChung Liew8e585f02007-06-18 13:50:13 -0500225#endif
Richard Retanubunee73cc52009-01-23 09:45:34 -0500226 print_str ("cpufreq", strmhz(buf, bd->bi_intfreq));
TsiChungLiew8ae158c2007-08-16 15:05:11 -0500227 print_str ("busfreq", strmhz(buf, bd->bi_busfreq));
228#ifdef CONFIG_PCI
229 print_str ("pcifreq", strmhz(buf, bd->bi_pcifreq));
230#endif
231#ifdef CONFIG_EXTRA_CLOCK
232 print_str ("flbfreq", strmhz(buf, bd->bi_flbfreq));
233 print_str ("inpfreq", strmhz(buf, bd->bi_inpfreq));
234 print_str ("vcofreq", strmhz(buf, bd->bi_vcofreq));
235#endif
Stefan Roese26667b72007-08-18 14:37:52 +0200236#if defined(CONFIG_CMD_NET)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500237 print_eth(0);
TsiChung Liew8e585f02007-06-18 13:50:13 -0500238#if defined(CONFIG_HAS_ETH1)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500239 print_eth(1);
TsiChung Liew8e585f02007-06-18 13:50:13 -0500240#endif
TsiChung Liew8e585f02007-06-18 13:50:13 -0500241#if defined(CONFIG_HAS_ETH2)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500242 print_eth(2);
TsiChung Liew8e585f02007-06-18 13:50:13 -0500243#endif
TsiChung Liew8e585f02007-06-18 13:50:13 -0500244#if defined(CONFIG_HAS_ETH3)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500245 print_eth(3);
TsiChung Liew8e585f02007-06-18 13:50:13 -0500246#endif
247
Mike Frysingerb6446b62009-02-17 00:00:53 -0500248 printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
Stefan Roese26667b72007-08-18 14:37:52 +0200249#endif
Mike Frysingerb6446b62009-02-17 00:00:53 -0500250 printf ("baudrate = %ld bps\n", bd->bi_baudrate);
TsiChung Liew8e585f02007-06-18 13:50:13 -0500251
252 return 0;
253}
254
Mike Frysinger8dc48d72008-02-04 19:26:55 -0500255#elif defined(CONFIG_BLACKFIN)
Reinhard Meyerc99ea792010-06-06 19:01:59 +0200256
Mike Frysinger6dadc912008-10-20 16:15:04 -0400257static void print_str(const char *, const char *);
Mike Frysinger8dc48d72008-02-04 19:26:55 -0500258
Wolfgang Denk54841ab2010-06-28 22:00:46 +0200259int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Mike Frysinger8dc48d72008-02-04 19:26:55 -0500260{
Mike Frysinger8dc48d72008-02-04 19:26:55 -0500261 bd_t *bd = gd->bd;
Mike Frysinger6dadc912008-10-20 16:15:04 -0400262 char buf[32];
Mike Frysinger8dc48d72008-02-04 19:26:55 -0500263
264 printf("U-Boot = %s\n", bd->bi_r_version);
265 printf("CPU = %s\n", bd->bi_cpu);
266 printf("Board = %s\n", bd->bi_board_name);
Mike Frysinger6dadc912008-10-20 16:15:04 -0400267 print_str("VCO", strmhz(buf, bd->bi_vco));
268 print_str("CCLK", strmhz(buf, bd->bi_cclk));
269 print_str("SCLK", strmhz(buf, bd->bi_sclk));
Mike Frysinger8dc48d72008-02-04 19:26:55 -0500270
271 print_num("boot_params", (ulong)bd->bi_boot_params);
272 print_num("memstart", (ulong)bd->bi_memstart);
Becky Bruceb57ca3e2008-06-09 20:37:16 -0500273 print_lnum("memsize", (u64)bd->bi_memsize);
Mike Frysinger8dc48d72008-02-04 19:26:55 -0500274 print_num("flashstart", (ulong)bd->bi_flashstart);
275 print_num("flashsize", (ulong)bd->bi_flashsize);
276 print_num("flashoffset", (ulong)bd->bi_flashoffset);
277
Mike Frysingerde2dff62009-02-11 18:50:10 -0500278 print_eth(0);
Mike Frysingerb6446b62009-02-17 00:00:53 -0500279 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
280 printf("baudrate = %d bps\n", bd->bi_baudrate);
Mike Frysinger8dc48d72008-02-04 19:26:55 -0500281
282 return 0;
283}
284
Reinhard Meyerc99ea792010-06-06 19:01:59 +0200285#elif defined(CONFIG_MIPS)
wdenk8bde7f72003-06-27 21:31:46 +0000286
Wolfgang Denk54841ab2010-06-28 22:00:46 +0200287int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk8bde7f72003-06-27 21:31:46 +0000288{
wdenk8bde7f72003-06-27 21:31:46 +0000289 bd_t *bd = gd->bd;
290
291 print_num ("boot_params", (ulong)bd->bi_boot_params);
292 print_num ("memstart", (ulong)bd->bi_memstart);
Becky Bruceb57ca3e2008-06-09 20:37:16 -0500293 print_lnum ("memsize", (u64)bd->bi_memsize);
wdenk8bde7f72003-06-27 21:31:46 +0000294 print_num ("flashstart", (ulong)bd->bi_flashstart);
295 print_num ("flashsize", (ulong)bd->bi_flashsize);
296 print_num ("flashoffset", (ulong)bd->bi_flashoffset);
297
Mike Frysingerde2dff62009-02-11 18:50:10 -0500298 print_eth(0);
Mike Frysingerb6446b62009-02-17 00:00:53 -0500299 printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
300 printf ("baudrate = %d bps\n", bd->bi_baudrate);
wdenk8bde7f72003-06-27 21:31:46 +0000301
302 return 0;
303}
wdenk8bde7f72003-06-27 21:31:46 +0000304
Reinhard Meyerc99ea792010-06-06 19:01:59 +0200305#elif defined(CONFIG_AVR32)
306
307int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
308{
309 bd_t *bd = gd->bd;
310
311 print_num ("boot_params", (ulong)bd->bi_boot_params);
312 print_num ("memstart", (ulong)bd->bi_memstart);
313 print_lnum ("memsize", (u64)bd->bi_memsize);
314 print_num ("flashstart", (ulong)bd->bi_flashstart);
315 print_num ("flashsize", (ulong)bd->bi_flashsize);
316 print_num ("flashoffset", (ulong)bd->bi_flashoffset);
317
318 print_eth(0);
319 printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
320 printf ("baudrate = %lu bps\n", bd->bi_baudrate);
321
322 return 0;
323}
324
325#elif defined(CONFIG_ARM)
wdenk8bde7f72003-06-27 21:31:46 +0000326
Wolfgang Denk54841ab2010-06-28 22:00:46 +0200327int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk8bde7f72003-06-27 21:31:46 +0000328{
wdenk8bde7f72003-06-27 21:31:46 +0000329 int i;
330 bd_t *bd = gd->bd;
331
332 print_num ("arch_number", bd->bi_arch_number);
wdenk8bde7f72003-06-27 21:31:46 +0000333 print_num ("boot_params", (ulong)bd->bi_boot_params);
334
335 for (i=0; i<CONFIG_NR_DRAM_BANKS; ++i) {
336 print_num("DRAM bank", i);
337 print_num("-> start", bd->bi_dram[i].start);
338 print_num("-> size", bd->bi_dram[i].size);
339 }
340
Hebbara41dbbd2007-12-18 16:03:07 -0800341#if defined(CONFIG_CMD_NET)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500342 print_eth(0);
Mike Frysingerb6446b62009-02-17 00:00:53 -0500343 printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
Hebbara41dbbd2007-12-18 16:03:07 -0800344#endif
Mike Frysingerb6446b62009-02-17 00:00:53 -0500345 printf ("baudrate = %d bps\n", bd->bi_baudrate);
Heiko Schocherf1d2b312010-09-17 13:10:39 +0200346#if !(defined(CONFIG_SYS_NO_ICACHE) && defined(CONFIG_SYS_NO_DCACHE))
347 print_num ("TLB addr", gd->tlb_addr);
348#endif
349 print_num ("relocaddr", gd->relocaddr);
350 print_num ("reloc off", gd->reloc_off);
351 print_num ("irq_sp", gd->irq_sp); /* irq stack pointer */
352 print_num ("sp start ", gd->start_addr_sp);
353 print_num ("FB base ", gd->fb_base);
wdenk8bde7f72003-06-27 21:31:46 +0000354 return 0;
355}
356
Nobuhiro Iwamatsuebd0d062010-07-22 16:05:32 +0900357#elif defined(CONFIG_SH)
358
359int do_bdinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
360{
361 bd_t *bd = gd->bd;
362 print_num ("mem start ", (ulong)bd->bi_memstart);
363 print_lnum ("mem size ", (u64)bd->bi_memsize);
364 print_num ("flash start ", (ulong)bd->bi_flashstart);
365 print_num ("flash size ", (ulong)bd->bi_flashsize);
366 print_num ("flash offset ", (ulong)bd->bi_flashoffset);
367
368#if defined(CONFIG_CMD_NET)
369 print_eth(0);
370 printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
371#endif
372 printf ("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
373 return 0;
374}
375
Graeme Russa806ee62010-08-22 16:25:58 +1000376#elif defined(CONFIG_X86)
377
378static void print_str(const char *, const char *);
379
380int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
381{
382 int i;
383 bd_t *bd = gd->bd;
384 char buf[32];
385
Graeme Russa806ee62010-08-22 16:25:58 +1000386 print_num ("boot_params", (ulong)bd->bi_boot_params);
387 print_num ("bi_memstart", bd->bi_memstart);
388 print_num ("bi_memsize", bd->bi_memsize);
389 print_num ("bi_flashstart", bd->bi_flashstart);
390 print_num ("bi_flashsize", bd->bi_flashsize);
391 print_num ("bi_flashoffset", bd->bi_flashoffset);
392 print_num ("bi_sramstart", bd->bi_sramstart);
393 print_num ("bi_sramsize", bd->bi_sramsize);
394 print_num ("bi_bootflags", bd->bi_bootflags);
395 print_str ("cpufreq", strmhz(buf, bd->bi_intfreq));
396 print_str ("busfreq", strmhz(buf, bd->bi_busfreq));
397
398 for (i=0; i<CONFIG_NR_DRAM_BANKS; ++i) {
399 print_num("DRAM bank", i);
400 print_num("-> start", bd->bi_dram[i].start);
401 print_num("-> size", bd->bi_dram[i].size);
402 }
403
404#if defined(CONFIG_CMD_NET)
405 print_eth(0);
406 printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
407 print_str ("ethspeed", strmhz(buf, bd->bi_ethspeed));
408#endif
409 printf ("baudrate = %d bps\n", bd->bi_baudrate);
410
411 return 0;
412}
413
Reinhard Meyerc99ea792010-06-06 19:01:59 +0200414#else
415 #error "a case for this architecture does not exist!"
416#endif
wdenk8bde7f72003-06-27 21:31:46 +0000417
418static void print_num(const char *name, ulong value)
419{
420 printf ("%-12s= 0x%08lX\n", name, value);
421}
422
Philippe De Muyter116095e2009-09-21 22:20:29 -0600423#if !(defined(CONFIG_ARM) || defined(CONFIG_M68K)) || defined(CONFIG_CMD_NET)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500424static void print_eth(int idx)
425{
426 char name[10], *val;
427 if (idx)
428 sprintf(name, "eth%iaddr", idx);
429 else
430 strcpy(name, "ethaddr");
431 val = getenv(name);
432 if (!val)
433 val = "(not set)";
434 printf("%-12s= %s\n", name, val);
435}
Wolfgang Denk26e42cb2009-03-29 00:54:21 +0100436#endif
Mike Frysingerde2dff62009-02-11 18:50:10 -0500437
Graeme Russa806ee62010-08-22 16:25:58 +1000438#if (!defined(CONFIG_ARM) && !defined(CONFIG_X86))
Becky Bruceb57ca3e2008-06-09 20:37:16 -0500439static void print_lnum(const char *name, u64 value)
440{
441 printf ("%-12s= 0x%.8llX\n", name, value);
442}
443#endif
444
Graeme Russa806ee62010-08-22 16:25:58 +1000445#if defined(CONFIG_PPC) || \
446 defined(CONFIG_M68K) || \
447 defined(CONFIG_BLACKFIN) || \
448 defined(CONFIG_X86)
wdenk8bde7f72003-06-27 21:31:46 +0000449static void print_str(const char *name, const char *str)
450{
451 printf ("%-12s= %6s MHz\n", name, str);
452}
453#endif /* CONFIG_PPC */
454
455
456/* -------------------------------------------------------------------- */
457
wdenk0d498392003-07-01 21:06:45 +0000458U_BOOT_CMD(
459 bdinfo, 1, 1, do_bdinfo,
Peter Tyser2fb26042009-01-27 18:03:12 -0600460 "print Board Info structure",
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200461 ""
wdenk8bde7f72003-06-27 21:31:46 +0000462);