wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 1 | /* |
| 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> |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 29 | |
Wolfgang Denk | d87080b | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 30 | DECLARE_GLOBAL_DATA_PTR; |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 31 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 32 | static void print_num(const char *, ulong); |
| 33 | |
Philippe De Muyter | 116095e | 2009-09-21 22:20:29 -0600 | [diff] [blame] | 34 | #if !(defined(CONFIG_ARM) || defined(CONFIG_M68K)) || defined(CONFIG_CMD_NET) |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 35 | static void print_eth(int idx); |
Wolfgang Denk | 26e42cb | 2009-03-29 00:54:21 +0100 | [diff] [blame] | 36 | #endif |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 37 | |
Graeme Russ | a806ee6 | 2010-08-22 16:25:58 +1000 | [diff] [blame] | 38 | #if (!defined(CONFIG_ARM) && !defined(CONFIG_X86)) |
Becky Bruce | b57ca3e | 2008-06-09 20:37:16 -0500 | [diff] [blame] | 39 | static void print_lnum(const char *, u64); |
Reinhard Meyer | c99ea79 | 2010-06-06 19:01:59 +0200 | [diff] [blame] | 40 | #endif |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 41 | |
Reinhard Meyer | c99ea79 | 2010-06-06 19:01:59 +0200 | [diff] [blame] | 42 | #if defined(CONFIG_PPC) |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 43 | static void print_str(const char *, const char *); |
| 44 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 45 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 46 | { |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 47 | bd_t *bd = gd->bd; |
| 48 | char buf[32]; |
| 49 | |
| 50 | #ifdef DEBUG |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 51 | print_num("bd address", (ulong)bd); |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 52 | #endif |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 53 | 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); |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 63 | #endif |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 64 | 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)); |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 78 | #endif |
Michal Simek | 9fea65a | 2008-06-24 09:54:09 +0200 | [diff] [blame] | 79 | #else /* ! CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */ |
Jon Loeliger | 9c4c5ae | 2005-07-23 10:37:35 -0500 | [diff] [blame] | 80 | #if defined(CONFIG_CPM2) |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 81 | 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)); |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 84 | #endif |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 85 | print_str("intfreq", strmhz(buf, bd->bi_intfreq)); |
Jon Loeliger | 9c4c5ae | 2005-07-23 10:37:35 -0500 | [diff] [blame] | 86 | #if defined(CONFIG_CPM2) |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 87 | print_str("cpmfreq", strmhz(buf, bd->bi_cpmfreq)); |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 88 | #endif |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 89 | print_str("busfreq", strmhz(buf, bd->bi_busfreq)); |
Michal Simek | 9fea65a | 2008-06-24 09:54:09 +0200 | [diff] [blame] | 90 | #endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_405, CONFIG_440EP CONFIG_440GR */ |
wdenk | 983fda8 | 2004-10-28 00:09:35 +0000 | [diff] [blame] | 91 | #if defined(CONFIG_MPC8220) |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 92 | 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)); |
wdenk | 983fda8 | 2004-10-28 00:09:35 +0000 | [diff] [blame] | 97 | #endif |
wdenk | 03f5c55 | 2004-10-10 21:21:55 +0000 | [diff] [blame] | 98 | |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 99 | print_eth(0); |
wdenk | e2ffd59 | 2004-12-31 09:32:47 +0000 | [diff] [blame] | 100 | #if defined(CONFIG_HAS_ETH1) |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 101 | print_eth(1); |
wdenk | 03f5c55 | 2004-10-10 21:21:55 +0000 | [diff] [blame] | 102 | #endif |
wdenk | e2ffd59 | 2004-12-31 09:32:47 +0000 | [diff] [blame] | 103 | #if defined(CONFIG_HAS_ETH2) |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 104 | print_eth(2); |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 105 | #endif |
wdenk | e2ffd59 | 2004-12-31 09:32:47 +0000 | [diff] [blame] | 106 | #if defined(CONFIG_HAS_ETH3) |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 107 | print_eth(3); |
wdenk | 03f5c55 | 2004-10-10 21:21:55 +0000 | [diff] [blame] | 108 | #endif |
richardretanubun | c68a05f | 2008-09-29 18:28:23 -0400 | [diff] [blame] | 109 | #if defined(CONFIG_HAS_ETH4) |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 110 | print_eth(4); |
richardretanubun | c68a05f | 2008-09-29 18:28:23 -0400 | [diff] [blame] | 111 | #endif |
richardretanubun | c68a05f | 2008-09-29 18:28:23 -0400 | [diff] [blame] | 112 | #if defined(CONFIG_HAS_ETH5) |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 113 | print_eth(5); |
richardretanubun | c68a05f | 2008-09-29 18:28:23 -0400 | [diff] [blame] | 114 | #endif |
| 115 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 116 | #ifdef CONFIG_HERMES |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 117 | print_str("ethspeed", strmhz(buf, bd->bi_ethspeed)); |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 118 | #endif |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 119 | printf("IP addr = %pI4\n", &bd->bi_ip_addr); |
| 120 | printf("baudrate = %6ld bps\n", bd->bi_baudrate); |
| 121 | print_num("relocaddr", gd->relocaddr); |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 122 | return 0; |
| 123 | } |
| 124 | |
Reinhard Meyer | c99ea79 | 2010-06-06 19:01:59 +0200 | [diff] [blame] | 125 | #elif defined(CONFIG_NIOS2) |
wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 126 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 127 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 128 | { |
wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 129 | bd_t *bd = gd->bd; |
| 130 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 131 | 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); |
wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 136 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 137 | #if defined(CONFIG_SYS_SRAM_BASE) |
wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 138 | print_num ("sram start", (ulong)bd->bi_sramstart); |
| 139 | print_num ("sram size", (ulong)bd->bi_sramsize); |
| 140 | #endif |
| 141 | |
Jon Loeliger | 9025317 | 2007-07-10 11:02:44 -0500 | [diff] [blame] | 142 | #if defined(CONFIG_CMD_NET) |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 143 | print_eth(0); |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 144 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 145 | #endif |
| 146 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 147 | printf("baudrate = %ld bps\n", bd->bi_baudrate); |
wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 148 | |
| 149 | return 0; |
| 150 | } |
Reinhard Meyer | c99ea79 | 2010-06-06 19:01:59 +0200 | [diff] [blame] | 151 | |
| 152 | #elif defined(CONFIG_MICROBLAZE) |
Michal Simek | cfc6711 | 2007-03-11 13:48:24 +0100 | [diff] [blame] | 153 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 154 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
Michal Simek | cfc6711 | 2007-03-11 13:48:24 +0100 | [diff] [blame] | 155 | { |
Michal Simek | cfc6711 | 2007-03-11 13:48:24 +0100 | [diff] [blame] | 156 | bd_t *bd = gd->bd; |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 157 | 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-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 162 | #if defined(CONFIG_SYS_SRAM_BASE) |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 163 | print_num("sram start ", (ulong)bd->bi_sramstart); |
| 164 | print_num("sram size ", (ulong)bd->bi_sramsize); |
Michal Simek | cfc6711 | 2007-03-11 13:48:24 +0100 | [diff] [blame] | 165 | #endif |
Jon Loeliger | 9025317 | 2007-07-10 11:02:44 -0500 | [diff] [blame] | 166 | #if defined(CONFIG_CMD_NET) |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 167 | print_eth(0); |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 168 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
Michal Simek | cfc6711 | 2007-03-11 13:48:24 +0100 | [diff] [blame] | 169 | #endif |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 170 | printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate); |
Michal Simek | cfc6711 | 2007-03-11 13:48:24 +0100 | [diff] [blame] | 171 | return 0; |
| 172 | } |
wdenk | 4a55170 | 2003-10-08 23:26:14 +0000 | [diff] [blame] | 173 | |
Reinhard Meyer | c99ea79 | 2010-06-06 19:01:59 +0200 | [diff] [blame] | 174 | #elif defined(CONFIG_SPARC) |
| 175 | |
Wolfgang Denk | 54841ab | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 176 | int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) |
Daniel Hellstrom | 00ab32c | 2008-03-26 22:36:03 +0100 | [diff] [blame] | 177 | { |
| 178 | bd_t *bd = gd->bd; |
Daniel Hellstrom | 00ab32c | 2008-03-26 22:36:03 +0100 | [diff] [blame] | 179 | |
| 180 | #ifdef DEBUG |
| 181 | print_num("bd address ", (ulong) bd); |
| 182 | #endif |
| 183 | print_num("memstart ", bd->bi_memstart); |
Becky Bruce | b57ca3e | 2008-06-09 20:37:16 -0500 | [diff] [blame] | 184 | print_lnum("memsize ", bd->bi_memsize); |
Daniel Hellstrom | 00ab32c | 2008-03-26 22:36:03 +0100 | [diff] [blame] | 185 | print_num("flashstart ", bd->bi_flashstart); |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 186 | print_num("CONFIG_SYS_MONITOR_BASE ", CONFIG_SYS_MONITOR_BASE); |
Jean-Christophe PLAGNIOL-VILLARD | 0e8d158 | 2008-09-10 22:48:06 +0200 | [diff] [blame] | 187 | print_num("CONFIG_ENV_ADDR ", CONFIG_ENV_ADDR); |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 188 | 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 Denk | 25ddd1f | 2010-10-26 14:34:52 +0200 | [diff] [blame] | 197 | GENERATED_GBL_DATA_SIZE); |
Daniel Hellstrom | 00ab32c | 2008-03-26 22:36:03 +0100 | [diff] [blame] | 198 | |
| 199 | #if defined(CONFIG_CMD_NET) |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 200 | print_eth(0); |
Mike Frysinger | b6446b6 | 2009-02-17 00:00:53 -0500 | [diff] [blame] | 201 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
Daniel Hellstrom | 00ab32c | 2008-03-26 22:36:03 +0100 | [diff] [blame] | 202 | #endif |
Mike Frysinger | b6446b6 | 2009-02-17 00:00:53 -0500 | [diff] [blame] | 203 | printf("baudrate = %6ld bps\n", bd->bi_baudrate); |
Daniel Hellstrom | 00ab32c | 2008-03-26 22:36:03 +0100 | [diff] [blame] | 204 | return 0; |
| 205 | } |
| 206 | |
Reinhard Meyer | c99ea79 | 2010-06-06 19:01:59 +0200 | [diff] [blame] | 207 | #elif defined(CONFIG_M68K) |
| 208 | |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 209 | static void print_str(const char *, const char *); |
TsiChung Liew | 8e585f0 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 210 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 211 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
TsiChung Liew | 8e585f0 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 212 | { |
TsiChung Liew | 8e585f0 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 213 | bd_t *bd = gd->bd; |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 214 | char buf[32]; |
| 215 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 216 | 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-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 221 | #if defined(CONFIG_SYS_INIT_RAM_ADDR) |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 222 | print_num("sramstart", (ulong)bd->bi_sramstart); |
| 223 | print_num("sramsize", (ulong)bd->bi_sramsize); |
TsiChung Liew | 8e585f0 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 224 | #endif |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 225 | #if defined(CONFIG_SYS_MBAR) |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 226 | print_num("mbar", bd->bi_mbar_base); |
TsiChung Liew | 8e585f0 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 227 | #endif |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 228 | print_str("cpufreq", strmhz(buf, bd->bi_intfreq)); |
| 229 | print_str("busfreq", strmhz(buf, bd->bi_busfreq)); |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 230 | #ifdef CONFIG_PCI |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 231 | print_str("pcifreq", strmhz(buf, bd->bi_pcifreq)); |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 232 | #endif |
| 233 | #ifdef CONFIG_EXTRA_CLOCK |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 234 | 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)); |
TsiChungLiew | 8ae158c | 2007-08-16 15:05:11 -0500 | [diff] [blame] | 237 | #endif |
Stefan Roese | 26667b7 | 2007-08-18 14:37:52 +0200 | [diff] [blame] | 238 | #if defined(CONFIG_CMD_NET) |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 239 | print_eth(0); |
TsiChung Liew | 8e585f0 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 240 | #if defined(CONFIG_HAS_ETH1) |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 241 | print_eth(1); |
TsiChung Liew | 8e585f0 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 242 | #endif |
TsiChung Liew | 8e585f0 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 243 | #if defined(CONFIG_HAS_ETH2) |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 244 | print_eth(2); |
TsiChung Liew | 8e585f0 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 245 | #endif |
TsiChung Liew | 8e585f0 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 246 | #if defined(CONFIG_HAS_ETH3) |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 247 | print_eth(3); |
TsiChung Liew | 8e585f0 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 248 | #endif |
| 249 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 250 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
Stefan Roese | 26667b7 | 2007-08-18 14:37:52 +0200 | [diff] [blame] | 251 | #endif |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 252 | printf("baudrate = %ld bps\n", bd->bi_baudrate); |
TsiChung Liew | 8e585f0 | 2007-06-18 13:50:13 -0500 | [diff] [blame] | 253 | |
| 254 | return 0; |
| 255 | } |
| 256 | |
Mike Frysinger | 8dc48d7 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 257 | #elif defined(CONFIG_BLACKFIN) |
Reinhard Meyer | c99ea79 | 2010-06-06 19:01:59 +0200 | [diff] [blame] | 258 | |
Mike Frysinger | 6dadc91 | 2008-10-20 16:15:04 -0400 | [diff] [blame] | 259 | static void print_str(const char *, const char *); |
Mike Frysinger | 8dc48d7 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 260 | |
Wolfgang Denk | 54841ab | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 261 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
Mike Frysinger | 8dc48d7 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 262 | { |
Mike Frysinger | 8dc48d7 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 263 | bd_t *bd = gd->bd; |
Mike Frysinger | 6dadc91 | 2008-10-20 16:15:04 -0400 | [diff] [blame] | 264 | char buf[32]; |
Mike Frysinger | 8dc48d7 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 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); |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 269 | 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 Frysinger | 8dc48d7 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 272 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 273 | 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 Frysinger | 8dc48d7 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 279 | |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 280 | print_eth(0); |
Mike Frysinger | b6446b6 | 2009-02-17 00:00:53 -0500 | [diff] [blame] | 281 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
| 282 | printf("baudrate = %d bps\n", bd->bi_baudrate); |
Mike Frysinger | 8dc48d7 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 283 | |
| 284 | return 0; |
| 285 | } |
| 286 | |
Reinhard Meyer | c99ea79 | 2010-06-06 19:01:59 +0200 | [diff] [blame] | 287 | #elif defined(CONFIG_MIPS) |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 288 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 289 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 290 | { |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 291 | bd_t *bd = gd->bd; |
| 292 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 293 | 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); |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 299 | |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 300 | print_eth(0); |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 301 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
| 302 | printf("baudrate = %d bps\n", bd->bi_baudrate); |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 303 | |
| 304 | return 0; |
| 305 | } |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 306 | |
Reinhard Meyer | c99ea79 | 2010-06-06 19:01:59 +0200 | [diff] [blame] | 307 | #elif defined(CONFIG_AVR32) |
| 308 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 309 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
Reinhard Meyer | c99ea79 | 2010-06-06 19:01:59 +0200 | [diff] [blame] | 310 | { |
| 311 | bd_t *bd = gd->bd; |
| 312 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 313 | 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 Meyer | c99ea79 | 2010-06-06 19:01:59 +0200 | [diff] [blame] | 319 | |
| 320 | print_eth(0); |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 321 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
| 322 | printf("baudrate = %lu bps\n", bd->bi_baudrate); |
Reinhard Meyer | c99ea79 | 2010-06-06 19:01:59 +0200 | [diff] [blame] | 323 | |
| 324 | return 0; |
| 325 | } |
| 326 | |
| 327 | #elif defined(CONFIG_ARM) |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 328 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 329 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 330 | { |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 331 | int i; |
| 332 | bd_t *bd = gd->bd; |
| 333 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 334 | print_num("arch_number", bd->bi_arch_number); |
| 335 | print_num("boot_params", (ulong)bd->bi_boot_params); |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 336 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 337 | for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) { |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 338 | 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 | |
Hebbar | a41dbbd | 2007-12-18 16:03:07 -0800 | [diff] [blame] | 343 | #if defined(CONFIG_CMD_NET) |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 344 | print_eth(0); |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 345 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
Hebbar | a41dbbd | 2007-12-18 16:03:07 -0800 | [diff] [blame] | 346 | #endif |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 347 | printf("baudrate = %d bps\n", bd->bi_baudrate); |
Heiko Schocher | f1d2b31 | 2010-09-17 13:10:39 +0200 | [diff] [blame] | 348 | #if !(defined(CONFIG_SYS_NO_ICACHE) && defined(CONFIG_SYS_NO_DCACHE)) |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 349 | print_num("TLB addr", gd->tlb_addr); |
Heiko Schocher | f1d2b31 | 2010-09-17 13:10:39 +0200 | [diff] [blame] | 350 | #endif |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 351 | 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); |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 356 | return 0; |
| 357 | } |
| 358 | |
Nobuhiro Iwamatsu | ebd0d06 | 2010-07-22 16:05:32 +0900 | [diff] [blame] | 359 | #elif defined(CONFIG_SH) |
| 360 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 361 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
Nobuhiro Iwamatsu | ebd0d06 | 2010-07-22 16:05:32 +0900 | [diff] [blame] | 362 | { |
| 363 | bd_t *bd = gd->bd; |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 364 | 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 Iwamatsu | ebd0d06 | 2010-07-22 16:05:32 +0900 | [diff] [blame] | 369 | |
| 370 | #if defined(CONFIG_CMD_NET) |
| 371 | print_eth(0); |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 372 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
Nobuhiro Iwamatsu | ebd0d06 | 2010-07-22 16:05:32 +0900 | [diff] [blame] | 373 | #endif |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 374 | printf("baudrate = %ld bps\n", (ulong)bd->bi_baudrate); |
Nobuhiro Iwamatsu | ebd0d06 | 2010-07-22 16:05:32 +0900 | [diff] [blame] | 375 | return 0; |
| 376 | } |
| 377 | |
Graeme Russ | a806ee6 | 2010-08-22 16:25:58 +1000 | [diff] [blame] | 378 | #elif defined(CONFIG_X86) |
| 379 | |
| 380 | static void print_str(const char *, const char *); |
| 381 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 382 | int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
Graeme Russ | a806ee6 | 2010-08-22 16:25:58 +1000 | [diff] [blame] | 383 | { |
| 384 | int i; |
| 385 | bd_t *bd = gd->bd; |
| 386 | char buf[32]; |
| 387 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 388 | 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 Russ | a806ee6 | 2010-08-22 16:25:58 +1000 | [diff] [blame] | 399 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 400 | for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) { |
Graeme Russ | a806ee6 | 2010-08-22 16:25:58 +1000 | [diff] [blame] | 401 | 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 Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 408 | printf("ip_addr = %pI4\n", &bd->bi_ip_addr); |
| 409 | print_str("ethspeed", strmhz(buf, bd->bi_ethspeed)); |
Graeme Russ | a806ee6 | 2010-08-22 16:25:58 +1000 | [diff] [blame] | 410 | #endif |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 411 | printf("baudrate = %d bps\n", bd->bi_baudrate); |
Graeme Russ | a806ee6 | 2010-08-22 16:25:58 +1000 | [diff] [blame] | 412 | |
| 413 | return 0; |
| 414 | } |
| 415 | |
Reinhard Meyer | c99ea79 | 2010-06-06 19:01:59 +0200 | [diff] [blame] | 416 | #else |
| 417 | #error "a case for this architecture does not exist!" |
| 418 | #endif |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 419 | |
| 420 | static void print_num(const char *name, ulong value) |
| 421 | { |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 422 | printf("%-12s= 0x%08lX\n", name, value); |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 423 | } |
| 424 | |
Philippe De Muyter | 116095e | 2009-09-21 22:20:29 -0600 | [diff] [blame] | 425 | #if !(defined(CONFIG_ARM) || defined(CONFIG_M68K)) || defined(CONFIG_CMD_NET) |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 426 | static 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 Denk | 26e42cb | 2009-03-29 00:54:21 +0100 | [diff] [blame] | 438 | #endif |
Mike Frysinger | de2dff6 | 2009-02-11 18:50:10 -0500 | [diff] [blame] | 439 | |
Graeme Russ | a806ee6 | 2010-08-22 16:25:58 +1000 | [diff] [blame] | 440 | #if (!defined(CONFIG_ARM) && !defined(CONFIG_X86)) |
Becky Bruce | b57ca3e | 2008-06-09 20:37:16 -0500 | [diff] [blame] | 441 | static void print_lnum(const char *name, u64 value) |
| 442 | { |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 443 | printf("%-12s= 0x%.8llX\n", name, value); |
Becky Bruce | b57ca3e | 2008-06-09 20:37:16 -0500 | [diff] [blame] | 444 | } |
| 445 | #endif |
| 446 | |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 447 | #if defined(CONFIG_PPC) || \ |
| 448 | defined(CONFIG_M68K) || \ |
| 449 | defined(CONFIG_BLACKFIN) || \ |
| 450 | defined(CONFIG_X86) |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 451 | static void print_str(const char *name, const char *str) |
| 452 | { |
Macpaul Lin | 5902e8f | 2011-04-27 16:28:35 +0000 | [diff] [blame] | 453 | printf("%-12s= %6s MHz\n", name, str); |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 454 | } |
| 455 | #endif /* CONFIG_PPC */ |
| 456 | |
| 457 | |
| 458 | /* -------------------------------------------------------------------- */ |
| 459 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 460 | U_BOOT_CMD( |
| 461 | bdinfo, 1, 1, do_bdinfo, |
Peter Tyser | 2fb2604 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 462 | "print Board Info structure", |
Wolfgang Denk | a89c33d | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 463 | "" |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 464 | ); |