blob: 688b2382a7d59ccb95d7926e3123bc5882b3fa4e [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
Simon Glass6fcc3be2011-09-17 06:48:47 +000034#if !(defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_SANDBOX)) \
35 || defined(CONFIG_CMD_NET)
36#define HAVE_PRINT_ETH
Mike Frysingerde2dff62009-02-11 18:50:10 -050037static void print_eth(int idx);
Wolfgang Denk26e42cb2009-03-29 00:54:21 +010038#endif
Mike Frysingerde2dff62009-02-11 18:50:10 -050039
Simon Glass6fcc3be2011-09-17 06:48:47 +000040#if (!defined(CONFIG_ARM) && !defined(CONFIG_X86) && !defined(CONFIG_SANDBOX))
41#define HAVE_PRINT_LNUM
Becky Bruceb57ca3e2008-06-09 20:37:16 -050042static void print_lnum(const char *, u64);
Reinhard Meyerc99ea792010-06-06 19:01:59 +020043#endif
wdenk8bde7f72003-06-27 21:31:46 +000044
Reinhard Meyerc99ea792010-06-06 19:01:59 +020045#if defined(CONFIG_PPC)
Timur Tabi0c277ef2011-10-05 17:08:07 -050046static void print_mhz(const char *, unsigned long);
wdenk8bde7f72003-06-27 21:31:46 +000047
Macpaul Lin5902e8f2011-04-27 16:28:35 +000048int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk8bde7f72003-06-27 21:31:46 +000049{
wdenk8bde7f72003-06-27 21:31:46 +000050 bd_t *bd = gd->bd;
wdenk8bde7f72003-06-27 21:31:46 +000051
52#ifdef DEBUG
Macpaul Lin5902e8f2011-04-27 16:28:35 +000053 print_num("bd address", (ulong)bd);
wdenk8bde7f72003-06-27 21:31:46 +000054#endif
Macpaul Lin5902e8f2011-04-27 16:28:35 +000055 print_num("memstart", bd->bi_memstart);
56 print_lnum("memsize", bd->bi_memsize);
57 print_num("flashstart", bd->bi_flashstart);
58 print_num("flashsize", bd->bi_flashsize);
59 print_num("flashoffset", bd->bi_flashoffset);
60 print_num("sramstart", bd->bi_sramstart);
61 print_num("sramsize", bd->bi_sramsize);
62#if defined(CONFIG_5xx) || defined(CONFIG_8xx) || \
63 defined(CONFIG_8260) || defined(CONFIG_E500)
64 print_num("immr_base", bd->bi_immr_base);
wdenk8bde7f72003-06-27 21:31:46 +000065#endif
Macpaul Lin5902e8f2011-04-27 16:28:35 +000066 print_num("bootflags", bd->bi_bootflags);
67#if defined(CONFIG_405CR) || defined(CONFIG_405EP) || \
68 defined(CONFIG_405GP) || \
69 defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
70 defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \
71 defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \
72 defined(CONFIG_XILINX_405)
Timur Tabi0c277ef2011-10-05 17:08:07 -050073 print_mhz("procfreq", bd->bi_procfreq);
74 print_mhz("plb_busfreq", bd->bi_plb_busfreq);
Macpaul Lin5902e8f2011-04-27 16:28:35 +000075#if defined(CONFIG_405EP) || defined(CONFIG_405GP) || \
76 defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
77 defined(CONFIG_440GR) || defined(CONFIG_440GRX) || \
78 defined(CONFIG_440SPE) || defined(CONFIG_XILINX_405)
Timur Tabi0c277ef2011-10-05 17:08:07 -050079 print_mhz("pci_busfreq", bd->bi_pci_busfreq);
wdenk8bde7f72003-06-27 21:31:46 +000080#endif
Michal Simek9fea65a2008-06-24 09:54:09 +020081#else /* ! CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
Jon Loeliger9c4c5ae2005-07-23 10:37:35 -050082#if defined(CONFIG_CPM2)
Timur Tabi0c277ef2011-10-05 17:08:07 -050083 print_mhz("vco", bd->bi_vco);
84 print_mhz("sccfreq", bd->bi_sccfreq);
85 print_mhz("brgfreq", bd->bi_brgfreq);
wdenk8bde7f72003-06-27 21:31:46 +000086#endif
Timur Tabi0c277ef2011-10-05 17:08:07 -050087 print_mhz("intfreq", bd->bi_intfreq);
Jon Loeliger9c4c5ae2005-07-23 10:37:35 -050088#if defined(CONFIG_CPM2)
Timur Tabi0c277ef2011-10-05 17:08:07 -050089 print_mhz("cpmfreq", bd->bi_cpmfreq);
wdenk8bde7f72003-06-27 21:31:46 +000090#endif
Timur Tabi0c277ef2011-10-05 17:08:07 -050091 print_mhz("busfreq", bd->bi_busfreq);
Michal Simek9fea65a2008-06-24 09:54:09 +020092#endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */
wdenk983fda82004-10-28 00:09:35 +000093#if defined(CONFIG_MPC8220)
Timur Tabi0c277ef2011-10-05 17:08:07 -050094 print_mhz("inpfreq", bd->bi_inpfreq);
95 print_mhz("flbfreq", bd->bi_flbfreq);
96 print_mhz("pcifreq", bd->bi_pcifreq);
97 print_mhz("vcofreq", bd->bi_vcofreq);
98 print_mhz("pevfreq", bd->bi_pevfreq);
wdenk983fda82004-10-28 00:09:35 +000099#endif
wdenk03f5c552004-10-10 21:21:55 +0000100
Mike Frysingerde2dff62009-02-11 18:50:10 -0500101 print_eth(0);
wdenke2ffd592004-12-31 09:32:47 +0000102#if defined(CONFIG_HAS_ETH1)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500103 print_eth(1);
wdenk03f5c552004-10-10 21:21:55 +0000104#endif
wdenke2ffd592004-12-31 09:32:47 +0000105#if defined(CONFIG_HAS_ETH2)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500106 print_eth(2);
wdenk42d1f032003-10-15 23:53:47 +0000107#endif
wdenke2ffd592004-12-31 09:32:47 +0000108#if defined(CONFIG_HAS_ETH3)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500109 print_eth(3);
wdenk03f5c552004-10-10 21:21:55 +0000110#endif
richardretanubunc68a05f2008-09-29 18:28:23 -0400111#if defined(CONFIG_HAS_ETH4)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500112 print_eth(4);
richardretanubunc68a05f2008-09-29 18:28:23 -0400113#endif
richardretanubunc68a05f2008-09-29 18:28:23 -0400114#if defined(CONFIG_HAS_ETH5)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500115 print_eth(5);
richardretanubunc68a05f2008-09-29 18:28:23 -0400116#endif
117
wdenk8bde7f72003-06-27 21:31:46 +0000118#ifdef CONFIG_HERMES
Timur Tabi0c277ef2011-10-05 17:08:07 -0500119 print_mhz("ethspeed", bd->bi_ethspeed);
wdenk8bde7f72003-06-27 21:31:46 +0000120#endif
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000121 printf("IP addr = %pI4\n", &bd->bi_ip_addr);
122 printf("baudrate = %6ld bps\n", bd->bi_baudrate);
123 print_num("relocaddr", gd->relocaddr);
wdenk8bde7f72003-06-27 21:31:46 +0000124 return 0;
125}
126
Reinhard Meyerc99ea792010-06-06 19:01:59 +0200127#elif defined(CONFIG_NIOS2)
wdenk5c952cf2004-10-10 21:27:30 +0000128
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000129int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk5c952cf2004-10-10 21:27:30 +0000130{
wdenk5c952cf2004-10-10 21:27:30 +0000131 bd_t *bd = gd->bd;
132
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000133 print_num("mem start", (ulong)bd->bi_memstart);
134 print_lnum("mem size", (u64)bd->bi_memsize);
135 print_num("flash start", (ulong)bd->bi_flashstart);
136 print_num("flash size", (ulong)bd->bi_flashsize);
137 print_num("flash offset", (ulong)bd->bi_flashoffset);
wdenk5c952cf2004-10-10 21:27:30 +0000138
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200139#if defined(CONFIG_SYS_SRAM_BASE)
wdenk5c952cf2004-10-10 21:27:30 +0000140 print_num ("sram start", (ulong)bd->bi_sramstart);
141 print_num ("sram size", (ulong)bd->bi_sramsize);
142#endif
143
Jon Loeliger90253172007-07-10 11:02:44 -0500144#if defined(CONFIG_CMD_NET)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500145 print_eth(0);
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000146 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
wdenk5c952cf2004-10-10 21:27:30 +0000147#endif
148
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000149 printf("baudrate = %ld bps\n", bd->bi_baudrate);
wdenk5c952cf2004-10-10 21:27:30 +0000150
151 return 0;
152}
Reinhard Meyerc99ea792010-06-06 19:01:59 +0200153
154#elif defined(CONFIG_MICROBLAZE)
Michal Simekcfc67112007-03-11 13:48:24 +0100155
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000156int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Michal Simekcfc67112007-03-11 13:48:24 +0100157{
Michal Simekcfc67112007-03-11 13:48:24 +0100158 bd_t *bd = gd->bd;
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000159 print_num("mem start ", (ulong)bd->bi_memstart);
160 print_lnum("mem size ", (u64)bd->bi_memsize);
161 print_num("flash start ", (ulong)bd->bi_flashstart);
162 print_num("flash size ", (ulong)bd->bi_flashsize);
163 print_num("flash offset ", (ulong)bd->bi_flashoffset);
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200164#if defined(CONFIG_SYS_SRAM_BASE)
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000165 print_num("sram start ", (ulong)bd->bi_sramstart);
166 print_num("sram size ", (ulong)bd->bi_sramsize);
Michal Simekcfc67112007-03-11 13:48:24 +0100167#endif
Jon Loeliger90253172007-07-10 11:02:44 -0500168#if defined(CONFIG_CMD_NET)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500169 print_eth(0);
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000170 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Michal Simekcfc67112007-03-11 13:48:24 +0100171#endif
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000172 printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
Michal Simekcfc67112007-03-11 13:48:24 +0100173 return 0;
174}
wdenk4a551702003-10-08 23:26:14 +0000175
Reinhard Meyerc99ea792010-06-06 19:01:59 +0200176#elif defined(CONFIG_SPARC)
177
Wolfgang Denk54841ab2010-06-28 22:00:46 +0200178int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
Daniel Hellstrom00ab32c2008-03-26 22:36:03 +0100179{
180 bd_t *bd = gd->bd;
Daniel Hellstrom00ab32c2008-03-26 22:36:03 +0100181
182#ifdef DEBUG
183 print_num("bd address ", (ulong) bd);
184#endif
185 print_num("memstart ", bd->bi_memstart);
Becky Bruceb57ca3e2008-06-09 20:37:16 -0500186 print_lnum("memsize ", bd->bi_memsize);
Daniel Hellstrom00ab32c2008-03-26 22:36:03 +0100187 print_num("flashstart ", bd->bi_flashstart);
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200188 print_num("CONFIG_SYS_MONITOR_BASE ", CONFIG_SYS_MONITOR_BASE);
Jean-Christophe PLAGNIOL-VILLARD0e8d1582008-09-10 22:48:06 +0200189 print_num("CONFIG_ENV_ADDR ", CONFIG_ENV_ADDR);
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200190 printf("CONFIG_SYS_RELOC_MONITOR_BASE = 0x%lx (%d)\n", CONFIG_SYS_RELOC_MONITOR_BASE,
191 CONFIG_SYS_MONITOR_LEN);
192 printf("CONFIG_SYS_MALLOC_BASE = 0x%lx (%d)\n", CONFIG_SYS_MALLOC_BASE,
193 CONFIG_SYS_MALLOC_LEN);
194 printf("CONFIG_SYS_INIT_SP_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_INIT_SP_OFFSET,
195 CONFIG_SYS_STACK_SIZE);
196 printf("CONFIG_SYS_PROM_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_PROM_OFFSET,
197 CONFIG_SYS_PROM_SIZE);
198 printf("CONFIG_SYS_GBL_DATA_OFFSET = 0x%lx (%d)\n", CONFIG_SYS_GBL_DATA_OFFSET,
Wolfgang Denk25ddd1f2010-10-26 14:34:52 +0200199 GENERATED_GBL_DATA_SIZE);
Daniel Hellstrom00ab32c2008-03-26 22:36:03 +0100200
201#if defined(CONFIG_CMD_NET)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500202 print_eth(0);
Mike Frysingerb6446b62009-02-17 00:00:53 -0500203 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Daniel Hellstrom00ab32c2008-03-26 22:36:03 +0100204#endif
Mike Frysingerb6446b62009-02-17 00:00:53 -0500205 printf("baudrate = %6ld bps\n", bd->bi_baudrate);
Daniel Hellstrom00ab32c2008-03-26 22:36:03 +0100206 return 0;
207}
208
Reinhard Meyerc99ea792010-06-06 19:01:59 +0200209#elif defined(CONFIG_M68K)
210
Timur Tabi0c277ef2011-10-05 17:08:07 -0500211static void print_mhz(const char *, unsigned long);
TsiChung Liew8e585f02007-06-18 13:50:13 -0500212
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000213int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
TsiChung Liew8e585f02007-06-18 13:50:13 -0500214{
TsiChung Liew8e585f02007-06-18 13:50:13 -0500215 bd_t *bd = gd->bd;
TsiChungLiew8ae158c2007-08-16 15:05:11 -0500216
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000217 print_num("memstart", (ulong)bd->bi_memstart);
218 print_lnum("memsize", (u64)bd->bi_memsize);
219 print_num("flashstart", (ulong)bd->bi_flashstart);
220 print_num("flashsize", (ulong)bd->bi_flashsize);
221 print_num("flashoffset", (ulong)bd->bi_flashoffset);
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200222#if defined(CONFIG_SYS_INIT_RAM_ADDR)
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000223 print_num("sramstart", (ulong)bd->bi_sramstart);
224 print_num("sramsize", (ulong)bd->bi_sramsize);
TsiChung Liew8e585f02007-06-18 13:50:13 -0500225#endif
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200226#if defined(CONFIG_SYS_MBAR)
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000227 print_num("mbar", bd->bi_mbar_base);
TsiChung Liew8e585f02007-06-18 13:50:13 -0500228#endif
Timur Tabi0c277ef2011-10-05 17:08:07 -0500229 print_mhz("cpufreq", bd->bi_intfreq);
230 print_mhz("busfreq", bd->bi_busfreq);
TsiChungLiew8ae158c2007-08-16 15:05:11 -0500231#ifdef CONFIG_PCI
Timur Tabi0c277ef2011-10-05 17:08:07 -0500232 print_mhz("pcifreq", bd->bi_pcifreq);
TsiChungLiew8ae158c2007-08-16 15:05:11 -0500233#endif
234#ifdef CONFIG_EXTRA_CLOCK
Timur Tabi0c277ef2011-10-05 17:08:07 -0500235 print_mhz("flbfreq", bd->bi_flbfreq);
236 print_mhz("inpfreq", bd->bi_inpfreq);
237 print_mhz("vcofreq", bd->bi_vcofreq);
TsiChungLiew8ae158c2007-08-16 15:05:11 -0500238#endif
Stefan Roese26667b72007-08-18 14:37:52 +0200239#if defined(CONFIG_CMD_NET)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500240 print_eth(0);
TsiChung Liew8e585f02007-06-18 13:50:13 -0500241#if defined(CONFIG_HAS_ETH1)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500242 print_eth(1);
TsiChung Liew8e585f02007-06-18 13:50:13 -0500243#endif
TsiChung Liew8e585f02007-06-18 13:50:13 -0500244#if defined(CONFIG_HAS_ETH2)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500245 print_eth(2);
TsiChung Liew8e585f02007-06-18 13:50:13 -0500246#endif
TsiChung Liew8e585f02007-06-18 13:50:13 -0500247#if defined(CONFIG_HAS_ETH3)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500248 print_eth(3);
TsiChung Liew8e585f02007-06-18 13:50:13 -0500249#endif
250
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000251 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Stefan Roese26667b72007-08-18 14:37:52 +0200252#endif
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000253 printf("baudrate = %ld bps\n", bd->bi_baudrate);
TsiChung Liew8e585f02007-06-18 13:50:13 -0500254
255 return 0;
256}
257
Mike Frysinger8dc48d72008-02-04 19:26:55 -0500258#elif defined(CONFIG_BLACKFIN)
Reinhard Meyerc99ea792010-06-06 19:01:59 +0200259
Timur Tabi0c277ef2011-10-05 17:08:07 -0500260static void print_mhz(const char *, unsigned long);
Mike Frysinger8dc48d72008-02-04 19:26:55 -0500261
Wolfgang Denk54841ab2010-06-28 22:00:46 +0200262int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Mike Frysinger8dc48d72008-02-04 19:26:55 -0500263{
Mike Frysinger8dc48d72008-02-04 19:26:55 -0500264 bd_t *bd = gd->bd;
265
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);
Timur Tabi0c277ef2011-10-05 17:08:07 -0500269 print_mhz("VCO", bd->bi_vco);
270 print_mhz("CCLK", bd->bi_cclk);
271 print_mhz("SCLK", bd->bi_sclk);
Mike Frysinger8dc48d72008-02-04 19:26:55 -0500272
Macpaul Lin5902e8f2011-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 Frysinger8dc48d72008-02-04 19:26:55 -0500279
Mike Frysingerde2dff62009-02-11 18:50:10 -0500280 print_eth(0);
Mike Frysingerb6446b62009-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 Frysinger8dc48d72008-02-04 19:26:55 -0500283
284 return 0;
285}
286
Reinhard Meyerc99ea792010-06-06 19:01:59 +0200287#elif defined(CONFIG_MIPS)
wdenk8bde7f72003-06-27 21:31:46 +0000288
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000289int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk8bde7f72003-06-27 21:31:46 +0000290{
wdenk8bde7f72003-06-27 21:31:46 +0000291 bd_t *bd = gd->bd;
292
Macpaul Lin5902e8f2011-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);
wdenk8bde7f72003-06-27 21:31:46 +0000299
Mike Frysingerde2dff62009-02-11 18:50:10 -0500300 print_eth(0);
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000301 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
302 printf("baudrate = %d bps\n", bd->bi_baudrate);
wdenk8bde7f72003-06-27 21:31:46 +0000303
304 return 0;
305}
wdenk8bde7f72003-06-27 21:31:46 +0000306
Reinhard Meyerc99ea792010-06-06 19:01:59 +0200307#elif defined(CONFIG_AVR32)
308
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000309int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Reinhard Meyerc99ea792010-06-06 19:01:59 +0200310{
311 bd_t *bd = gd->bd;
312
Macpaul Lin5902e8f2011-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 Meyerc99ea792010-06-06 19:01:59 +0200319
320 print_eth(0);
Macpaul Lin5902e8f2011-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 Meyerc99ea792010-06-06 19:01:59 +0200323
324 return 0;
325}
326
327#elif defined(CONFIG_ARM)
wdenk8bde7f72003-06-27 21:31:46 +0000328
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000329int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
wdenk8bde7f72003-06-27 21:31:46 +0000330{
wdenk8bde7f72003-06-27 21:31:46 +0000331 int i;
332 bd_t *bd = gd->bd;
333
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000334 print_num("arch_number", bd->bi_arch_number);
335 print_num("boot_params", (ulong)bd->bi_boot_params);
wdenk8bde7f72003-06-27 21:31:46 +0000336
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000337 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
wdenk8bde7f72003-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
Hebbara41dbbd2007-12-18 16:03:07 -0800343#if defined(CONFIG_CMD_NET)
Mike Frysingerde2dff62009-02-11 18:50:10 -0500344 print_eth(0);
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000345 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Hebbara41dbbd2007-12-18 16:03:07 -0800346#endif
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000347 printf("baudrate = %d bps\n", bd->bi_baudrate);
Aneesh Ve47f2db2011-06-16 23:30:48 +0000348#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000349 print_num("TLB addr", gd->tlb_addr);
Heiko Schocherf1d2b312010-09-17 13:10:39 +0200350#endif
Macpaul Lin5902e8f2011-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);
wdenk8bde7f72003-06-27 21:31:46 +0000356 return 0;
357}
358
Nobuhiro Iwamatsuebd0d062010-07-22 16:05:32 +0900359#elif defined(CONFIG_SH)
360
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000361int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Nobuhiro Iwamatsuebd0d062010-07-22 16:05:32 +0900362{
363 bd_t *bd = gd->bd;
Macpaul Lin5902e8f2011-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 Iwamatsuebd0d062010-07-22 16:05:32 +0900369
370#if defined(CONFIG_CMD_NET)
371 print_eth(0);
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000372 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Nobuhiro Iwamatsuebd0d062010-07-22 16:05:32 +0900373#endif
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000374 printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
Nobuhiro Iwamatsuebd0d062010-07-22 16:05:32 +0900375 return 0;
376}
377
Graeme Russa806ee62010-08-22 16:25:58 +1000378#elif defined(CONFIG_X86)
379
Timur Tabi0c277ef2011-10-05 17:08:07 -0500380static void print_mhz(const char *, unsigned long);
Graeme Russa806ee62010-08-22 16:25:58 +1000381
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000382int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
Graeme Russa806ee62010-08-22 16:25:58 +1000383{
384 int i;
385 bd_t *bd = gd->bd;
Graeme Russa806ee62010-08-22 16:25:58 +1000386
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000387 print_num("boot_params", (ulong)bd->bi_boot_params);
388 print_num("bi_memstart", bd->bi_memstart);
389 print_num("bi_memsize", bd->bi_memsize);
390 print_num("bi_flashstart", bd->bi_flashstart);
391 print_num("bi_flashsize", bd->bi_flashsize);
392 print_num("bi_flashoffset", bd->bi_flashoffset);
393 print_num("bi_sramstart", bd->bi_sramstart);
394 print_num("bi_sramsize", bd->bi_sramsize);
395 print_num("bi_bootflags", bd->bi_bootflags);
Timur Tabi0c277ef2011-10-05 17:08:07 -0500396 print_mhz("cpufreq", bd->bi_intfreq);
397 print_mhz("busfreq", bd->bi_busfreq);
Graeme Russa806ee62010-08-22 16:25:58 +1000398
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000399 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
Graeme Russa806ee62010-08-22 16:25:58 +1000400 print_num("DRAM bank", i);
401 print_num("-> start", bd->bi_dram[i].start);
402 print_num("-> size", bd->bi_dram[i].size);
403 }
404
405#if defined(CONFIG_CMD_NET)
406 print_eth(0);
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000407 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
Timur Tabi0c277ef2011-10-05 17:08:07 -0500408 print_mhz("ethspeed", bd->bi_ethspeed);
Graeme Russa806ee62010-08-22 16:25:58 +1000409#endif
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000410 printf("baudrate = %d bps\n", bd->bi_baudrate);
Graeme Russa806ee62010-08-22 16:25:58 +1000411
412 return 0;
413}
414
Simon Glass6fcc3be2011-09-17 06:48:47 +0000415#elif defined(CONFIG_SANDBOX)
416
417int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
418{
419 int i;
420 bd_t *bd = gd->bd;
421
422 print_num("boot_params", (ulong)bd->bi_boot_params);
423
424 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
425 print_num("DRAM bank", i);
426 print_num("-> start", bd->bi_dram[i].start);
427 print_num("-> size", bd->bi_dram[i].size);
428 }
429
430#if defined(CONFIG_CMD_NET)
431 print_eth(0);
432 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
433#endif
434 print_num("FB base ", gd->fb_base);
435 return 0;
436}
437
Macpaul Lin64d61462011-10-19 20:41:09 +0000438#elif defined(CONFIG_NDS32)
439
440int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
441{
442 int i;
443 bd_t *bd = gd->bd;
444
445 print_num("arch_number", bd->bi_arch_number);
446 print_num("boot_params", (ulong)bd->bi_boot_params);
447
448 for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
449 print_num("DRAM bank", i);
450 print_num("-> start", bd->bi_dram[i].start);
451 print_num("-> size", bd->bi_dram[i].size);
452 }
453
454#if defined(CONFIG_CMD_NET)
455 print_eth(0);
456 printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
457#endif
458 printf("baudrate = %d bps\n", bd->bi_baudrate);
459
460 return 0;
461}
462
Reinhard Meyerc99ea792010-06-06 19:01:59 +0200463#else
464 #error "a case for this architecture does not exist!"
465#endif
wdenk8bde7f72003-06-27 21:31:46 +0000466
467static void print_num(const char *name, ulong value)
468{
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000469 printf("%-12s= 0x%08lX\n", name, value);
wdenk8bde7f72003-06-27 21:31:46 +0000470}
471
Simon Glass6fcc3be2011-09-17 06:48:47 +0000472#ifdef HAVE_PRINT_ETH
Mike Frysingerde2dff62009-02-11 18:50:10 -0500473static void print_eth(int idx)
474{
475 char name[10], *val;
476 if (idx)
477 sprintf(name, "eth%iaddr", idx);
478 else
479 strcpy(name, "ethaddr");
480 val = getenv(name);
481 if (!val)
482 val = "(not set)";
483 printf("%-12s= %s\n", name, val);
484}
Wolfgang Denk26e42cb2009-03-29 00:54:21 +0100485#endif
Mike Frysingerde2dff62009-02-11 18:50:10 -0500486
Simon Glass6fcc3be2011-09-17 06:48:47 +0000487#ifdef HAVE_PRINT_LNUM
Becky Bruceb57ca3e2008-06-09 20:37:16 -0500488static void print_lnum(const char *name, u64 value)
489{
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000490 printf("%-12s= 0x%.8llX\n", name, value);
Becky Bruceb57ca3e2008-06-09 20:37:16 -0500491}
492#endif
493
Macpaul Lin5902e8f2011-04-27 16:28:35 +0000494#if defined(CONFIG_PPC) || \
495 defined(CONFIG_M68K) || \
496 defined(CONFIG_BLACKFIN) || \
497 defined(CONFIG_X86)
Timur Tabi0c277ef2011-10-05 17:08:07 -0500498static void print_mhz(const char *name, unsigned long hz)
wdenk8bde7f72003-06-27 21:31:46 +0000499{
Timur Tabi0c277ef2011-10-05 17:08:07 -0500500 char buf[32];
501
502 printf("%-12s= %6s MHz\n", name, strmhz(buf, hz));
wdenk8bde7f72003-06-27 21:31:46 +0000503}
504#endif /* CONFIG_PPC */
505
506
507/* -------------------------------------------------------------------- */
508
wdenk0d498392003-07-01 21:06:45 +0000509U_BOOT_CMD(
510 bdinfo, 1, 1, do_bdinfo,
Peter Tyser2fb26042009-01-27 18:03:12 -0600511 "print Board Info structure",
Wolfgang Denka89c33d2009-05-24 17:06:54 +0200512 ""
wdenk8bde7f72003-06-27 21:31:46 +0000513);