Commit adcc5705991ce3162fc204da9a673d9fe2cc5bf0
cmd_mem.c: Update 'iteration_limit' to unsigned long
With e37f1eb we now use strict_strtoul() in do_mem_mtest() and this gives us a warning: ../include/vsprintf.h:38:5: note: expected 'long unsigned int *' but argument is of type 'int *' Signed-off-by: Tom Rini <trini@konsulko.com>
Showing 1 changed file with 1 additions and 1 deletions Inline Diff
1 | /* | 1 | /* |
2 | * (C) Copyright 2000 | 2 | * (C) Copyright 2000 |
3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
4 | * | 4 | * |
5 | * SPDX-License-Identifier: GPL-2.0+ | 5 | * SPDX-License-Identifier: GPL-2.0+ |
6 | */ | 6 | */ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Memory Functions | 9 | * Memory Functions |
10 | * | 10 | * |
11 | * Copied from FADS ROM, Dan Malek (dmalek@jlc.net) | 11 | * Copied from FADS ROM, Dan Malek (dmalek@jlc.net) |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <common.h> | 14 | #include <common.h> |
15 | #include <bootretry.h> | 15 | #include <bootretry.h> |
16 | #include <cli.h> | 16 | #include <cli.h> |
17 | #include <command.h> | 17 | #include <command.h> |
18 | #ifdef CONFIG_HAS_DATAFLASH | 18 | #ifdef CONFIG_HAS_DATAFLASH |
19 | #include <dataflash.h> | 19 | #include <dataflash.h> |
20 | #endif | 20 | #endif |
21 | #include <hash.h> | 21 | #include <hash.h> |
22 | #include <inttypes.h> | 22 | #include <inttypes.h> |
23 | #include <watchdog.h> | 23 | #include <watchdog.h> |
24 | #include <asm/io.h> | 24 | #include <asm/io.h> |
25 | #include <linux/compiler.h> | 25 | #include <linux/compiler.h> |
26 | 26 | ||
27 | DECLARE_GLOBAL_DATA_PTR; | 27 | DECLARE_GLOBAL_DATA_PTR; |
28 | 28 | ||
29 | #ifndef CONFIG_SYS_MEMTEST_SCRATCH | 29 | #ifndef CONFIG_SYS_MEMTEST_SCRATCH |
30 | #define CONFIG_SYS_MEMTEST_SCRATCH 0 | 30 | #define CONFIG_SYS_MEMTEST_SCRATCH 0 |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | static int mod_mem(cmd_tbl_t *, int, int, int, char * const []); | 33 | static int mod_mem(cmd_tbl_t *, int, int, int, char * const []); |
34 | 34 | ||
35 | /* Display values from last command. | 35 | /* Display values from last command. |
36 | * Memory modify remembered values are different from display memory. | 36 | * Memory modify remembered values are different from display memory. |
37 | */ | 37 | */ |
38 | static uint dp_last_addr, dp_last_size; | 38 | static uint dp_last_addr, dp_last_size; |
39 | static uint dp_last_length = 0x40; | 39 | static uint dp_last_length = 0x40; |
40 | static uint mm_last_addr, mm_last_size; | 40 | static uint mm_last_addr, mm_last_size; |
41 | 41 | ||
42 | static ulong base_address = 0; | 42 | static ulong base_address = 0; |
43 | 43 | ||
44 | /* Memory Display | 44 | /* Memory Display |
45 | * | 45 | * |
46 | * Syntax: | 46 | * Syntax: |
47 | * md{.b, .w, .l, .q} {addr} {len} | 47 | * md{.b, .w, .l, .q} {addr} {len} |
48 | */ | 48 | */ |
49 | #define DISP_LINE_LEN 16 | 49 | #define DISP_LINE_LEN 16 |
50 | static int do_mem_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | 50 | static int do_mem_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
51 | { | 51 | { |
52 | ulong addr, length; | 52 | ulong addr, length; |
53 | #if defined(CONFIG_HAS_DATAFLASH) | 53 | #if defined(CONFIG_HAS_DATAFLASH) |
54 | ulong nbytes, linebytes; | 54 | ulong nbytes, linebytes; |
55 | #endif | 55 | #endif |
56 | int size; | 56 | int size; |
57 | int rc = 0; | 57 | int rc = 0; |
58 | 58 | ||
59 | /* We use the last specified parameters, unless new ones are | 59 | /* We use the last specified parameters, unless new ones are |
60 | * entered. | 60 | * entered. |
61 | */ | 61 | */ |
62 | addr = dp_last_addr; | 62 | addr = dp_last_addr; |
63 | size = dp_last_size; | 63 | size = dp_last_size; |
64 | length = dp_last_length; | 64 | length = dp_last_length; |
65 | 65 | ||
66 | if (argc < 2) | 66 | if (argc < 2) |
67 | return CMD_RET_USAGE; | 67 | return CMD_RET_USAGE; |
68 | 68 | ||
69 | if ((flag & CMD_FLAG_REPEAT) == 0) { | 69 | if ((flag & CMD_FLAG_REPEAT) == 0) { |
70 | /* New command specified. Check for a size specification. | 70 | /* New command specified. Check for a size specification. |
71 | * Defaults to long if no or incorrect specification. | 71 | * Defaults to long if no or incorrect specification. |
72 | */ | 72 | */ |
73 | if ((size = cmd_get_data_size(argv[0], 4)) < 0) | 73 | if ((size = cmd_get_data_size(argv[0], 4)) < 0) |
74 | return 1; | 74 | return 1; |
75 | 75 | ||
76 | /* Address is specified since argc > 1 | 76 | /* Address is specified since argc > 1 |
77 | */ | 77 | */ |
78 | addr = simple_strtoul(argv[1], NULL, 16); | 78 | addr = simple_strtoul(argv[1], NULL, 16); |
79 | addr += base_address; | 79 | addr += base_address; |
80 | 80 | ||
81 | /* If another parameter, it is the length to display. | 81 | /* If another parameter, it is the length to display. |
82 | * Length is the number of objects, not number of bytes. | 82 | * Length is the number of objects, not number of bytes. |
83 | */ | 83 | */ |
84 | if (argc > 2) | 84 | if (argc > 2) |
85 | length = simple_strtoul(argv[2], NULL, 16); | 85 | length = simple_strtoul(argv[2], NULL, 16); |
86 | } | 86 | } |
87 | 87 | ||
88 | #if defined(CONFIG_HAS_DATAFLASH) | 88 | #if defined(CONFIG_HAS_DATAFLASH) |
89 | /* Print the lines. | 89 | /* Print the lines. |
90 | * | 90 | * |
91 | * We buffer all read data, so we can make sure data is read only | 91 | * We buffer all read data, so we can make sure data is read only |
92 | * once, and all accesses are with the specified bus width. | 92 | * once, and all accesses are with the specified bus width. |
93 | */ | 93 | */ |
94 | nbytes = length * size; | 94 | nbytes = length * size; |
95 | do { | 95 | do { |
96 | char linebuf[DISP_LINE_LEN]; | 96 | char linebuf[DISP_LINE_LEN]; |
97 | void* p; | 97 | void* p; |
98 | linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes; | 98 | linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes; |
99 | 99 | ||
100 | rc = read_dataflash(addr, (linebytes/size)*size, linebuf); | 100 | rc = read_dataflash(addr, (linebytes/size)*size, linebuf); |
101 | p = (rc == DATAFLASH_OK) ? linebuf : (void*)addr; | 101 | p = (rc == DATAFLASH_OK) ? linebuf : (void*)addr; |
102 | print_buffer(addr, p, size, linebytes/size, DISP_LINE_LEN/size); | 102 | print_buffer(addr, p, size, linebytes/size, DISP_LINE_LEN/size); |
103 | 103 | ||
104 | nbytes -= linebytes; | 104 | nbytes -= linebytes; |
105 | addr += linebytes; | 105 | addr += linebytes; |
106 | if (ctrlc()) { | 106 | if (ctrlc()) { |
107 | rc = 1; | 107 | rc = 1; |
108 | break; | 108 | break; |
109 | } | 109 | } |
110 | } while (nbytes > 0); | 110 | } while (nbytes > 0); |
111 | #else | 111 | #else |
112 | 112 | ||
113 | # if defined(CONFIG_BLACKFIN) | 113 | # if defined(CONFIG_BLACKFIN) |
114 | /* See if we're trying to display L1 inst */ | 114 | /* See if we're trying to display L1 inst */ |
115 | if (addr_bfin_on_chip_mem(addr)) { | 115 | if (addr_bfin_on_chip_mem(addr)) { |
116 | char linebuf[DISP_LINE_LEN]; | 116 | char linebuf[DISP_LINE_LEN]; |
117 | ulong linebytes, nbytes = length * size; | 117 | ulong linebytes, nbytes = length * size; |
118 | do { | 118 | do { |
119 | linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes; | 119 | linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes; |
120 | memcpy(linebuf, (void *)addr, linebytes); | 120 | memcpy(linebuf, (void *)addr, linebytes); |
121 | print_buffer(addr, linebuf, size, linebytes/size, DISP_LINE_LEN/size); | 121 | print_buffer(addr, linebuf, size, linebytes/size, DISP_LINE_LEN/size); |
122 | 122 | ||
123 | nbytes -= linebytes; | 123 | nbytes -= linebytes; |
124 | addr += linebytes; | 124 | addr += linebytes; |
125 | if (ctrlc()) { | 125 | if (ctrlc()) { |
126 | rc = 1; | 126 | rc = 1; |
127 | break; | 127 | break; |
128 | } | 128 | } |
129 | } while (nbytes > 0); | 129 | } while (nbytes > 0); |
130 | } else | 130 | } else |
131 | # endif | 131 | # endif |
132 | 132 | ||
133 | { | 133 | { |
134 | ulong bytes = size * length; | 134 | ulong bytes = size * length; |
135 | const void *buf = map_sysmem(addr, bytes); | 135 | const void *buf = map_sysmem(addr, bytes); |
136 | 136 | ||
137 | /* Print the lines. */ | 137 | /* Print the lines. */ |
138 | print_buffer(addr, buf, size, length, DISP_LINE_LEN / size); | 138 | print_buffer(addr, buf, size, length, DISP_LINE_LEN / size); |
139 | addr += bytes; | 139 | addr += bytes; |
140 | unmap_sysmem(buf); | 140 | unmap_sysmem(buf); |
141 | } | 141 | } |
142 | #endif | 142 | #endif |
143 | 143 | ||
144 | dp_last_addr = addr; | 144 | dp_last_addr = addr; |
145 | dp_last_length = length; | 145 | dp_last_length = length; |
146 | dp_last_size = size; | 146 | dp_last_size = size; |
147 | return (rc); | 147 | return (rc); |
148 | } | 148 | } |
149 | 149 | ||
150 | static int do_mem_mm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | 150 | static int do_mem_mm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
151 | { | 151 | { |
152 | return mod_mem (cmdtp, 1, flag, argc, argv); | 152 | return mod_mem (cmdtp, 1, flag, argc, argv); |
153 | } | 153 | } |
154 | static int do_mem_nm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | 154 | static int do_mem_nm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
155 | { | 155 | { |
156 | return mod_mem (cmdtp, 0, flag, argc, argv); | 156 | return mod_mem (cmdtp, 0, flag, argc, argv); |
157 | } | 157 | } |
158 | 158 | ||
159 | static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | 159 | static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
160 | { | 160 | { |
161 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 161 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
162 | u64 writeval; | 162 | u64 writeval; |
163 | #else | 163 | #else |
164 | ulong writeval; | 164 | ulong writeval; |
165 | #endif | 165 | #endif |
166 | ulong addr, count; | 166 | ulong addr, count; |
167 | int size; | 167 | int size; |
168 | void *buf; | 168 | void *buf; |
169 | ulong bytes; | 169 | ulong bytes; |
170 | 170 | ||
171 | if ((argc < 3) || (argc > 4)) | 171 | if ((argc < 3) || (argc > 4)) |
172 | return CMD_RET_USAGE; | 172 | return CMD_RET_USAGE; |
173 | 173 | ||
174 | /* Check for size specification. | 174 | /* Check for size specification. |
175 | */ | 175 | */ |
176 | if ((size = cmd_get_data_size(argv[0], 4)) < 1) | 176 | if ((size = cmd_get_data_size(argv[0], 4)) < 1) |
177 | return 1; | 177 | return 1; |
178 | 178 | ||
179 | /* Address is specified since argc > 1 | 179 | /* Address is specified since argc > 1 |
180 | */ | 180 | */ |
181 | addr = simple_strtoul(argv[1], NULL, 16); | 181 | addr = simple_strtoul(argv[1], NULL, 16); |
182 | addr += base_address; | 182 | addr += base_address; |
183 | 183 | ||
184 | /* Get the value to write. | 184 | /* Get the value to write. |
185 | */ | 185 | */ |
186 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 186 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
187 | writeval = simple_strtoull(argv[2], NULL, 16); | 187 | writeval = simple_strtoull(argv[2], NULL, 16); |
188 | #else | 188 | #else |
189 | writeval = simple_strtoul(argv[2], NULL, 16); | 189 | writeval = simple_strtoul(argv[2], NULL, 16); |
190 | #endif | 190 | #endif |
191 | 191 | ||
192 | /* Count ? */ | 192 | /* Count ? */ |
193 | if (argc == 4) { | 193 | if (argc == 4) { |
194 | count = simple_strtoul(argv[3], NULL, 16); | 194 | count = simple_strtoul(argv[3], NULL, 16); |
195 | } else { | 195 | } else { |
196 | count = 1; | 196 | count = 1; |
197 | } | 197 | } |
198 | 198 | ||
199 | bytes = size * count; | 199 | bytes = size * count; |
200 | buf = map_sysmem(addr, bytes); | 200 | buf = map_sysmem(addr, bytes); |
201 | while (count-- > 0) { | 201 | while (count-- > 0) { |
202 | if (size == 4) | 202 | if (size == 4) |
203 | *((u32 *)buf) = (u32)writeval; | 203 | *((u32 *)buf) = (u32)writeval; |
204 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 204 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
205 | else if (size == 8) | 205 | else if (size == 8) |
206 | *((u64 *)buf) = (u64)writeval; | 206 | *((u64 *)buf) = (u64)writeval; |
207 | #endif | 207 | #endif |
208 | else if (size == 2) | 208 | else if (size == 2) |
209 | *((u16 *)buf) = (u16)writeval; | 209 | *((u16 *)buf) = (u16)writeval; |
210 | else | 210 | else |
211 | *((u8 *)buf) = (u8)writeval; | 211 | *((u8 *)buf) = (u8)writeval; |
212 | buf += size; | 212 | buf += size; |
213 | } | 213 | } |
214 | unmap_sysmem(buf); | 214 | unmap_sysmem(buf); |
215 | return 0; | 215 | return 0; |
216 | } | 216 | } |
217 | 217 | ||
218 | #ifdef CONFIG_MX_CYCLIC | 218 | #ifdef CONFIG_MX_CYCLIC |
219 | static int do_mem_mdc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | 219 | static int do_mem_mdc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
220 | { | 220 | { |
221 | int i; | 221 | int i; |
222 | ulong count; | 222 | ulong count; |
223 | 223 | ||
224 | if (argc < 4) | 224 | if (argc < 4) |
225 | return CMD_RET_USAGE; | 225 | return CMD_RET_USAGE; |
226 | 226 | ||
227 | count = simple_strtoul(argv[3], NULL, 10); | 227 | count = simple_strtoul(argv[3], NULL, 10); |
228 | 228 | ||
229 | for (;;) { | 229 | for (;;) { |
230 | do_mem_md (NULL, 0, 3, argv); | 230 | do_mem_md (NULL, 0, 3, argv); |
231 | 231 | ||
232 | /* delay for <count> ms... */ | 232 | /* delay for <count> ms... */ |
233 | for (i=0; i<count; i++) | 233 | for (i=0; i<count; i++) |
234 | udelay (1000); | 234 | udelay (1000); |
235 | 235 | ||
236 | /* check for ctrl-c to abort... */ | 236 | /* check for ctrl-c to abort... */ |
237 | if (ctrlc()) { | 237 | if (ctrlc()) { |
238 | puts("Abort\n"); | 238 | puts("Abort\n"); |
239 | return 0; | 239 | return 0; |
240 | } | 240 | } |
241 | } | 241 | } |
242 | 242 | ||
243 | return 0; | 243 | return 0; |
244 | } | 244 | } |
245 | 245 | ||
246 | static int do_mem_mwc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | 246 | static int do_mem_mwc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
247 | { | 247 | { |
248 | int i; | 248 | int i; |
249 | ulong count; | 249 | ulong count; |
250 | 250 | ||
251 | if (argc < 4) | 251 | if (argc < 4) |
252 | return CMD_RET_USAGE; | 252 | return CMD_RET_USAGE; |
253 | 253 | ||
254 | count = simple_strtoul(argv[3], NULL, 10); | 254 | count = simple_strtoul(argv[3], NULL, 10); |
255 | 255 | ||
256 | for (;;) { | 256 | for (;;) { |
257 | do_mem_mw (NULL, 0, 3, argv); | 257 | do_mem_mw (NULL, 0, 3, argv); |
258 | 258 | ||
259 | /* delay for <count> ms... */ | 259 | /* delay for <count> ms... */ |
260 | for (i=0; i<count; i++) | 260 | for (i=0; i<count; i++) |
261 | udelay (1000); | 261 | udelay (1000); |
262 | 262 | ||
263 | /* check for ctrl-c to abort... */ | 263 | /* check for ctrl-c to abort... */ |
264 | if (ctrlc()) { | 264 | if (ctrlc()) { |
265 | puts("Abort\n"); | 265 | puts("Abort\n"); |
266 | return 0; | 266 | return 0; |
267 | } | 267 | } |
268 | } | 268 | } |
269 | 269 | ||
270 | return 0; | 270 | return 0; |
271 | } | 271 | } |
272 | #endif /* CONFIG_MX_CYCLIC */ | 272 | #endif /* CONFIG_MX_CYCLIC */ |
273 | 273 | ||
274 | static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | 274 | static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
275 | { | 275 | { |
276 | ulong addr1, addr2, count, ngood, bytes; | 276 | ulong addr1, addr2, count, ngood, bytes; |
277 | int size; | 277 | int size; |
278 | int rcode = 0; | 278 | int rcode = 0; |
279 | const char *type; | 279 | const char *type; |
280 | const void *buf1, *buf2, *base; | 280 | const void *buf1, *buf2, *base; |
281 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 281 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
282 | u64 word1, word2; | 282 | u64 word1, word2; |
283 | #else | 283 | #else |
284 | ulong word1, word2; | 284 | ulong word1, word2; |
285 | #endif | 285 | #endif |
286 | 286 | ||
287 | if (argc != 4) | 287 | if (argc != 4) |
288 | return CMD_RET_USAGE; | 288 | return CMD_RET_USAGE; |
289 | 289 | ||
290 | /* Check for size specification. | 290 | /* Check for size specification. |
291 | */ | 291 | */ |
292 | if ((size = cmd_get_data_size(argv[0], 4)) < 0) | 292 | if ((size = cmd_get_data_size(argv[0], 4)) < 0) |
293 | return 1; | 293 | return 1; |
294 | type = size == 8 ? "double word" : | 294 | type = size == 8 ? "double word" : |
295 | size == 4 ? "word" : | 295 | size == 4 ? "word" : |
296 | size == 2 ? "halfword" : "byte"; | 296 | size == 2 ? "halfword" : "byte"; |
297 | 297 | ||
298 | addr1 = simple_strtoul(argv[1], NULL, 16); | 298 | addr1 = simple_strtoul(argv[1], NULL, 16); |
299 | addr1 += base_address; | 299 | addr1 += base_address; |
300 | 300 | ||
301 | addr2 = simple_strtoul(argv[2], NULL, 16); | 301 | addr2 = simple_strtoul(argv[2], NULL, 16); |
302 | addr2 += base_address; | 302 | addr2 += base_address; |
303 | 303 | ||
304 | count = simple_strtoul(argv[3], NULL, 16); | 304 | count = simple_strtoul(argv[3], NULL, 16); |
305 | 305 | ||
306 | #ifdef CONFIG_HAS_DATAFLASH | 306 | #ifdef CONFIG_HAS_DATAFLASH |
307 | if (addr_dataflash(addr1) | addr_dataflash(addr2)){ | 307 | if (addr_dataflash(addr1) | addr_dataflash(addr2)){ |
308 | puts ("Comparison with DataFlash space not supported.\n\r"); | 308 | puts ("Comparison with DataFlash space not supported.\n\r"); |
309 | return 0; | 309 | return 0; |
310 | } | 310 | } |
311 | #endif | 311 | #endif |
312 | 312 | ||
313 | #ifdef CONFIG_BLACKFIN | 313 | #ifdef CONFIG_BLACKFIN |
314 | if (addr_bfin_on_chip_mem(addr1) || addr_bfin_on_chip_mem(addr2)) { | 314 | if (addr_bfin_on_chip_mem(addr1) || addr_bfin_on_chip_mem(addr2)) { |
315 | puts ("Comparison with L1 instruction memory not supported.\n\r"); | 315 | puts ("Comparison with L1 instruction memory not supported.\n\r"); |
316 | return 0; | 316 | return 0; |
317 | } | 317 | } |
318 | #endif | 318 | #endif |
319 | 319 | ||
320 | bytes = size * count; | 320 | bytes = size * count; |
321 | base = buf1 = map_sysmem(addr1, bytes); | 321 | base = buf1 = map_sysmem(addr1, bytes); |
322 | buf2 = map_sysmem(addr2, bytes); | 322 | buf2 = map_sysmem(addr2, bytes); |
323 | for (ngood = 0; ngood < count; ++ngood) { | 323 | for (ngood = 0; ngood < count; ++ngood) { |
324 | if (size == 4) { | 324 | if (size == 4) { |
325 | word1 = *(u32 *)buf1; | 325 | word1 = *(u32 *)buf1; |
326 | word2 = *(u32 *)buf2; | 326 | word2 = *(u32 *)buf2; |
327 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 327 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
328 | } else if (size == 8) { | 328 | } else if (size == 8) { |
329 | word1 = *(u64 *)buf1; | 329 | word1 = *(u64 *)buf1; |
330 | word2 = *(u64 *)buf2; | 330 | word2 = *(u64 *)buf2; |
331 | #endif | 331 | #endif |
332 | } else if (size == 2) { | 332 | } else if (size == 2) { |
333 | word1 = *(u16 *)buf1; | 333 | word1 = *(u16 *)buf1; |
334 | word2 = *(u16 *)buf2; | 334 | word2 = *(u16 *)buf2; |
335 | } else { | 335 | } else { |
336 | word1 = *(u8 *)buf1; | 336 | word1 = *(u8 *)buf1; |
337 | word2 = *(u8 *)buf2; | 337 | word2 = *(u8 *)buf2; |
338 | } | 338 | } |
339 | if (word1 != word2) { | 339 | if (word1 != word2) { |
340 | ulong offset = buf1 - base; | 340 | ulong offset = buf1 - base; |
341 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 341 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
342 | printf("%s at 0x%p (%#0*"PRIx64") != %s at 0x%p (%#0*" | 342 | printf("%s at 0x%p (%#0*"PRIx64") != %s at 0x%p (%#0*" |
343 | PRIx64 ")\n", | 343 | PRIx64 ")\n", |
344 | type, (void *)(addr1 + offset), size, word1, | 344 | type, (void *)(addr1 + offset), size, word1, |
345 | type, (void *)(addr2 + offset), size, word2); | 345 | type, (void *)(addr2 + offset), size, word2); |
346 | #else | 346 | #else |
347 | printf("%s at 0x%08lx (%#0*lx) != %s at 0x%08lx (%#0*lx)\n", | 347 | printf("%s at 0x%08lx (%#0*lx) != %s at 0x%08lx (%#0*lx)\n", |
348 | type, (ulong)(addr1 + offset), size, word1, | 348 | type, (ulong)(addr1 + offset), size, word1, |
349 | type, (ulong)(addr2 + offset), size, word2); | 349 | type, (ulong)(addr2 + offset), size, word2); |
350 | #endif | 350 | #endif |
351 | rcode = 1; | 351 | rcode = 1; |
352 | break; | 352 | break; |
353 | } | 353 | } |
354 | 354 | ||
355 | buf1 += size; | 355 | buf1 += size; |
356 | buf2 += size; | 356 | buf2 += size; |
357 | 357 | ||
358 | /* reset watchdog from time to time */ | 358 | /* reset watchdog from time to time */ |
359 | if ((ngood % (64 << 10)) == 0) | 359 | if ((ngood % (64 << 10)) == 0) |
360 | WATCHDOG_RESET(); | 360 | WATCHDOG_RESET(); |
361 | } | 361 | } |
362 | unmap_sysmem(buf1); | 362 | unmap_sysmem(buf1); |
363 | unmap_sysmem(buf2); | 363 | unmap_sysmem(buf2); |
364 | 364 | ||
365 | printf("Total of %ld %s(s) were the same\n", ngood, type); | 365 | printf("Total of %ld %s(s) were the same\n", ngood, type); |
366 | return rcode; | 366 | return rcode; |
367 | } | 367 | } |
368 | 368 | ||
369 | static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | 369 | static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
370 | { | 370 | { |
371 | ulong addr, dest, count, bytes; | 371 | ulong addr, dest, count, bytes; |
372 | int size; | 372 | int size; |
373 | const void *src; | 373 | const void *src; |
374 | void *buf; | 374 | void *buf; |
375 | 375 | ||
376 | if (argc != 4) | 376 | if (argc != 4) |
377 | return CMD_RET_USAGE; | 377 | return CMD_RET_USAGE; |
378 | 378 | ||
379 | /* Check for size specification. | 379 | /* Check for size specification. |
380 | */ | 380 | */ |
381 | if ((size = cmd_get_data_size(argv[0], 4)) < 0) | 381 | if ((size = cmd_get_data_size(argv[0], 4)) < 0) |
382 | return 1; | 382 | return 1; |
383 | 383 | ||
384 | addr = simple_strtoul(argv[1], NULL, 16); | 384 | addr = simple_strtoul(argv[1], NULL, 16); |
385 | addr += base_address; | 385 | addr += base_address; |
386 | 386 | ||
387 | dest = simple_strtoul(argv[2], NULL, 16); | 387 | dest = simple_strtoul(argv[2], NULL, 16); |
388 | dest += base_address; | 388 | dest += base_address; |
389 | 389 | ||
390 | count = simple_strtoul(argv[3], NULL, 16); | 390 | count = simple_strtoul(argv[3], NULL, 16); |
391 | 391 | ||
392 | if (count == 0) { | 392 | if (count == 0) { |
393 | puts ("Zero length ???\n"); | 393 | puts ("Zero length ???\n"); |
394 | return 1; | 394 | return 1; |
395 | } | 395 | } |
396 | 396 | ||
397 | #ifndef CONFIG_SYS_NO_FLASH | 397 | #ifndef CONFIG_SYS_NO_FLASH |
398 | /* check if we are copying to Flash */ | 398 | /* check if we are copying to Flash */ |
399 | if ( (addr2info(dest) != NULL) | 399 | if ( (addr2info(dest) != NULL) |
400 | #ifdef CONFIG_HAS_DATAFLASH | 400 | #ifdef CONFIG_HAS_DATAFLASH |
401 | && (!addr_dataflash(dest)) | 401 | && (!addr_dataflash(dest)) |
402 | #endif | 402 | #endif |
403 | ) { | 403 | ) { |
404 | int rc; | 404 | int rc; |
405 | 405 | ||
406 | puts ("Copy to Flash... "); | 406 | puts ("Copy to Flash... "); |
407 | 407 | ||
408 | rc = flash_write ((char *)addr, dest, count*size); | 408 | rc = flash_write ((char *)addr, dest, count*size); |
409 | if (rc != 0) { | 409 | if (rc != 0) { |
410 | flash_perror (rc); | 410 | flash_perror (rc); |
411 | return (1); | 411 | return (1); |
412 | } | 412 | } |
413 | puts ("done\n"); | 413 | puts ("done\n"); |
414 | return 0; | 414 | return 0; |
415 | } | 415 | } |
416 | #endif | 416 | #endif |
417 | 417 | ||
418 | #ifdef CONFIG_HAS_DATAFLASH | 418 | #ifdef CONFIG_HAS_DATAFLASH |
419 | /* Check if we are copying from RAM or Flash to DataFlash */ | 419 | /* Check if we are copying from RAM or Flash to DataFlash */ |
420 | if (addr_dataflash(dest) && !addr_dataflash(addr)){ | 420 | if (addr_dataflash(dest) && !addr_dataflash(addr)){ |
421 | int rc; | 421 | int rc; |
422 | 422 | ||
423 | puts ("Copy to DataFlash... "); | 423 | puts ("Copy to DataFlash... "); |
424 | 424 | ||
425 | rc = write_dataflash (dest, addr, count*size); | 425 | rc = write_dataflash (dest, addr, count*size); |
426 | 426 | ||
427 | if (rc != 1) { | 427 | if (rc != 1) { |
428 | dataflash_perror (rc); | 428 | dataflash_perror (rc); |
429 | return (1); | 429 | return (1); |
430 | } | 430 | } |
431 | puts ("done\n"); | 431 | puts ("done\n"); |
432 | return 0; | 432 | return 0; |
433 | } | 433 | } |
434 | 434 | ||
435 | /* Check if we are copying from DataFlash to RAM */ | 435 | /* Check if we are copying from DataFlash to RAM */ |
436 | if (addr_dataflash(addr) && !addr_dataflash(dest) | 436 | if (addr_dataflash(addr) && !addr_dataflash(dest) |
437 | #ifndef CONFIG_SYS_NO_FLASH | 437 | #ifndef CONFIG_SYS_NO_FLASH |
438 | && (addr2info(dest) == NULL) | 438 | && (addr2info(dest) == NULL) |
439 | #endif | 439 | #endif |
440 | ){ | 440 | ){ |
441 | int rc; | 441 | int rc; |
442 | rc = read_dataflash(addr, count * size, (char *) dest); | 442 | rc = read_dataflash(addr, count * size, (char *) dest); |
443 | if (rc != 1) { | 443 | if (rc != 1) { |
444 | dataflash_perror (rc); | 444 | dataflash_perror (rc); |
445 | return (1); | 445 | return (1); |
446 | } | 446 | } |
447 | return 0; | 447 | return 0; |
448 | } | 448 | } |
449 | 449 | ||
450 | if (addr_dataflash(addr) && addr_dataflash(dest)){ | 450 | if (addr_dataflash(addr) && addr_dataflash(dest)){ |
451 | puts ("Unsupported combination of source/destination.\n\r"); | 451 | puts ("Unsupported combination of source/destination.\n\r"); |
452 | return 1; | 452 | return 1; |
453 | } | 453 | } |
454 | #endif | 454 | #endif |
455 | 455 | ||
456 | #ifdef CONFIG_BLACKFIN | 456 | #ifdef CONFIG_BLACKFIN |
457 | /* See if we're copying to/from L1 inst */ | 457 | /* See if we're copying to/from L1 inst */ |
458 | if (addr_bfin_on_chip_mem(dest) || addr_bfin_on_chip_mem(addr)) { | 458 | if (addr_bfin_on_chip_mem(dest) || addr_bfin_on_chip_mem(addr)) { |
459 | memcpy((void *)dest, (void *)addr, count * size); | 459 | memcpy((void *)dest, (void *)addr, count * size); |
460 | return 0; | 460 | return 0; |
461 | } | 461 | } |
462 | #endif | 462 | #endif |
463 | 463 | ||
464 | bytes = size * count; | 464 | bytes = size * count; |
465 | buf = map_sysmem(dest, bytes); | 465 | buf = map_sysmem(dest, bytes); |
466 | src = map_sysmem(addr, bytes); | 466 | src = map_sysmem(addr, bytes); |
467 | while (count-- > 0) { | 467 | while (count-- > 0) { |
468 | if (size == 4) | 468 | if (size == 4) |
469 | *((u32 *)buf) = *((u32 *)src); | 469 | *((u32 *)buf) = *((u32 *)src); |
470 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 470 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
471 | else if (size == 8) | 471 | else if (size == 8) |
472 | *((u64 *)buf) = *((u64 *)src); | 472 | *((u64 *)buf) = *((u64 *)src); |
473 | #endif | 473 | #endif |
474 | else if (size == 2) | 474 | else if (size == 2) |
475 | *((u16 *)buf) = *((u16 *)src); | 475 | *((u16 *)buf) = *((u16 *)src); |
476 | else | 476 | else |
477 | *((u8 *)buf) = *((u8 *)src); | 477 | *((u8 *)buf) = *((u8 *)src); |
478 | src += size; | 478 | src += size; |
479 | buf += size; | 479 | buf += size; |
480 | 480 | ||
481 | /* reset watchdog from time to time */ | 481 | /* reset watchdog from time to time */ |
482 | if ((count % (64 << 10)) == 0) | 482 | if ((count % (64 << 10)) == 0) |
483 | WATCHDOG_RESET(); | 483 | WATCHDOG_RESET(); |
484 | } | 484 | } |
485 | unmap_sysmem(buf); | 485 | unmap_sysmem(buf); |
486 | unmap_sysmem(src); | 486 | unmap_sysmem(src); |
487 | 487 | ||
488 | return 0; | 488 | return 0; |
489 | } | 489 | } |
490 | 490 | ||
491 | static int do_mem_base(cmd_tbl_t *cmdtp, int flag, int argc, | 491 | static int do_mem_base(cmd_tbl_t *cmdtp, int flag, int argc, |
492 | char * const argv[]) | 492 | char * const argv[]) |
493 | { | 493 | { |
494 | if (argc > 1) { | 494 | if (argc > 1) { |
495 | /* Set new base address. | 495 | /* Set new base address. |
496 | */ | 496 | */ |
497 | base_address = simple_strtoul(argv[1], NULL, 16); | 497 | base_address = simple_strtoul(argv[1], NULL, 16); |
498 | } | 498 | } |
499 | /* Print the current base address. | 499 | /* Print the current base address. |
500 | */ | 500 | */ |
501 | printf("Base Address: 0x%08lx\n", base_address); | 501 | printf("Base Address: 0x%08lx\n", base_address); |
502 | return 0; | 502 | return 0; |
503 | } | 503 | } |
504 | 504 | ||
505 | static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc, | 505 | static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc, |
506 | char * const argv[]) | 506 | char * const argv[]) |
507 | { | 507 | { |
508 | ulong addr, length, i, bytes; | 508 | ulong addr, length, i, bytes; |
509 | int size; | 509 | int size; |
510 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 510 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
511 | volatile u64 *llp; | 511 | volatile u64 *llp; |
512 | #endif | 512 | #endif |
513 | volatile u32 *longp; | 513 | volatile u32 *longp; |
514 | volatile u16 *shortp; | 514 | volatile u16 *shortp; |
515 | volatile u8 *cp; | 515 | volatile u8 *cp; |
516 | const void *buf; | 516 | const void *buf; |
517 | 517 | ||
518 | if (argc < 3) | 518 | if (argc < 3) |
519 | return CMD_RET_USAGE; | 519 | return CMD_RET_USAGE; |
520 | 520 | ||
521 | /* | 521 | /* |
522 | * Check for a size specification. | 522 | * Check for a size specification. |
523 | * Defaults to long if no or incorrect specification. | 523 | * Defaults to long if no or incorrect specification. |
524 | */ | 524 | */ |
525 | if ((size = cmd_get_data_size(argv[0], 4)) < 0) | 525 | if ((size = cmd_get_data_size(argv[0], 4)) < 0) |
526 | return 1; | 526 | return 1; |
527 | 527 | ||
528 | /* Address is always specified. | 528 | /* Address is always specified. |
529 | */ | 529 | */ |
530 | addr = simple_strtoul(argv[1], NULL, 16); | 530 | addr = simple_strtoul(argv[1], NULL, 16); |
531 | 531 | ||
532 | /* Length is the number of objects, not number of bytes. | 532 | /* Length is the number of objects, not number of bytes. |
533 | */ | 533 | */ |
534 | length = simple_strtoul(argv[2], NULL, 16); | 534 | length = simple_strtoul(argv[2], NULL, 16); |
535 | 535 | ||
536 | bytes = size * length; | 536 | bytes = size * length; |
537 | buf = map_sysmem(addr, bytes); | 537 | buf = map_sysmem(addr, bytes); |
538 | 538 | ||
539 | /* We want to optimize the loops to run as fast as possible. | 539 | /* We want to optimize the loops to run as fast as possible. |
540 | * If we have only one object, just run infinite loops. | 540 | * If we have only one object, just run infinite loops. |
541 | */ | 541 | */ |
542 | if (length == 1) { | 542 | if (length == 1) { |
543 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 543 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
544 | if (size == 8) { | 544 | if (size == 8) { |
545 | llp = (u64 *)buf; | 545 | llp = (u64 *)buf; |
546 | for (;;) | 546 | for (;;) |
547 | i = *llp; | 547 | i = *llp; |
548 | } | 548 | } |
549 | #endif | 549 | #endif |
550 | if (size == 4) { | 550 | if (size == 4) { |
551 | longp = (u32 *)buf; | 551 | longp = (u32 *)buf; |
552 | for (;;) | 552 | for (;;) |
553 | i = *longp; | 553 | i = *longp; |
554 | } | 554 | } |
555 | if (size == 2) { | 555 | if (size == 2) { |
556 | shortp = (u16 *)buf; | 556 | shortp = (u16 *)buf; |
557 | for (;;) | 557 | for (;;) |
558 | i = *shortp; | 558 | i = *shortp; |
559 | } | 559 | } |
560 | cp = (u8 *)buf; | 560 | cp = (u8 *)buf; |
561 | for (;;) | 561 | for (;;) |
562 | i = *cp; | 562 | i = *cp; |
563 | } | 563 | } |
564 | 564 | ||
565 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 565 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
566 | if (size == 8) { | 566 | if (size == 8) { |
567 | for (;;) { | 567 | for (;;) { |
568 | llp = (u64 *)buf; | 568 | llp = (u64 *)buf; |
569 | i = length; | 569 | i = length; |
570 | while (i-- > 0) | 570 | while (i-- > 0) |
571 | *llp++; | 571 | *llp++; |
572 | } | 572 | } |
573 | } | 573 | } |
574 | #endif | 574 | #endif |
575 | if (size == 4) { | 575 | if (size == 4) { |
576 | for (;;) { | 576 | for (;;) { |
577 | longp = (u32 *)buf; | 577 | longp = (u32 *)buf; |
578 | i = length; | 578 | i = length; |
579 | while (i-- > 0) | 579 | while (i-- > 0) |
580 | *longp++; | 580 | *longp++; |
581 | } | 581 | } |
582 | } | 582 | } |
583 | if (size == 2) { | 583 | if (size == 2) { |
584 | for (;;) { | 584 | for (;;) { |
585 | shortp = (u16 *)buf; | 585 | shortp = (u16 *)buf; |
586 | i = length; | 586 | i = length; |
587 | while (i-- > 0) | 587 | while (i-- > 0) |
588 | *shortp++; | 588 | *shortp++; |
589 | } | 589 | } |
590 | } | 590 | } |
591 | for (;;) { | 591 | for (;;) { |
592 | cp = (u8 *)buf; | 592 | cp = (u8 *)buf; |
593 | i = length; | 593 | i = length; |
594 | while (i-- > 0) | 594 | while (i-- > 0) |
595 | *cp++; | 595 | *cp++; |
596 | } | 596 | } |
597 | unmap_sysmem(buf); | 597 | unmap_sysmem(buf); |
598 | 598 | ||
599 | return 0; | 599 | return 0; |
600 | } | 600 | } |
601 | 601 | ||
602 | #ifdef CONFIG_LOOPW | 602 | #ifdef CONFIG_LOOPW |
603 | static int do_mem_loopw(cmd_tbl_t *cmdtp, int flag, int argc, | 603 | static int do_mem_loopw(cmd_tbl_t *cmdtp, int flag, int argc, |
604 | char * const argv[]) | 604 | char * const argv[]) |
605 | { | 605 | { |
606 | ulong addr, length, i, bytes; | 606 | ulong addr, length, i, bytes; |
607 | int size; | 607 | int size; |
608 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 608 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
609 | volatile u64 *llp; | 609 | volatile u64 *llp; |
610 | u64 data; | 610 | u64 data; |
611 | #else | 611 | #else |
612 | ulong data; | 612 | ulong data; |
613 | #endif | 613 | #endif |
614 | volatile u32 *longp; | 614 | volatile u32 *longp; |
615 | volatile u16 *shortp; | 615 | volatile u16 *shortp; |
616 | volatile u8 *cp; | 616 | volatile u8 *cp; |
617 | void *buf; | 617 | void *buf; |
618 | 618 | ||
619 | if (argc < 4) | 619 | if (argc < 4) |
620 | return CMD_RET_USAGE; | 620 | return CMD_RET_USAGE; |
621 | 621 | ||
622 | /* | 622 | /* |
623 | * Check for a size specification. | 623 | * Check for a size specification. |
624 | * Defaults to long if no or incorrect specification. | 624 | * Defaults to long if no or incorrect specification. |
625 | */ | 625 | */ |
626 | if ((size = cmd_get_data_size(argv[0], 4)) < 0) | 626 | if ((size = cmd_get_data_size(argv[0], 4)) < 0) |
627 | return 1; | 627 | return 1; |
628 | 628 | ||
629 | /* Address is always specified. | 629 | /* Address is always specified. |
630 | */ | 630 | */ |
631 | addr = simple_strtoul(argv[1], NULL, 16); | 631 | addr = simple_strtoul(argv[1], NULL, 16); |
632 | 632 | ||
633 | /* Length is the number of objects, not number of bytes. | 633 | /* Length is the number of objects, not number of bytes. |
634 | */ | 634 | */ |
635 | length = simple_strtoul(argv[2], NULL, 16); | 635 | length = simple_strtoul(argv[2], NULL, 16); |
636 | 636 | ||
637 | /* data to write */ | 637 | /* data to write */ |
638 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 638 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
639 | data = simple_strtoull(argv[3], NULL, 16); | 639 | data = simple_strtoull(argv[3], NULL, 16); |
640 | #else | 640 | #else |
641 | data = simple_strtoul(argv[3], NULL, 16); | 641 | data = simple_strtoul(argv[3], NULL, 16); |
642 | #endif | 642 | #endif |
643 | 643 | ||
644 | bytes = size * length; | 644 | bytes = size * length; |
645 | buf = map_sysmem(addr, bytes); | 645 | buf = map_sysmem(addr, bytes); |
646 | 646 | ||
647 | /* We want to optimize the loops to run as fast as possible. | 647 | /* We want to optimize the loops to run as fast as possible. |
648 | * If we have only one object, just run infinite loops. | 648 | * If we have only one object, just run infinite loops. |
649 | */ | 649 | */ |
650 | if (length == 1) { | 650 | if (length == 1) { |
651 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 651 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
652 | if (size == 8) { | 652 | if (size == 8) { |
653 | llp = (u64 *)buf; | 653 | llp = (u64 *)buf; |
654 | for (;;) | 654 | for (;;) |
655 | *llp = data; | 655 | *llp = data; |
656 | } | 656 | } |
657 | #endif | 657 | #endif |
658 | if (size == 4) { | 658 | if (size == 4) { |
659 | longp = (u32 *)buf; | 659 | longp = (u32 *)buf; |
660 | for (;;) | 660 | for (;;) |
661 | *longp = data; | 661 | *longp = data; |
662 | } | 662 | } |
663 | if (size == 2) { | 663 | if (size == 2) { |
664 | shortp = (u16 *)buf; | 664 | shortp = (u16 *)buf; |
665 | for (;;) | 665 | for (;;) |
666 | *shortp = data; | 666 | *shortp = data; |
667 | } | 667 | } |
668 | cp = (u8 *)buf; | 668 | cp = (u8 *)buf; |
669 | for (;;) | 669 | for (;;) |
670 | *cp = data; | 670 | *cp = data; |
671 | } | 671 | } |
672 | 672 | ||
673 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 673 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
674 | if (size == 8) { | 674 | if (size == 8) { |
675 | for (;;) { | 675 | for (;;) { |
676 | llp = (u64 *)buf; | 676 | llp = (u64 *)buf; |
677 | i = length; | 677 | i = length; |
678 | while (i-- > 0) | 678 | while (i-- > 0) |
679 | *llp++ = data; | 679 | *llp++ = data; |
680 | } | 680 | } |
681 | } | 681 | } |
682 | #endif | 682 | #endif |
683 | if (size == 4) { | 683 | if (size == 4) { |
684 | for (;;) { | 684 | for (;;) { |
685 | longp = (u32 *)buf; | 685 | longp = (u32 *)buf; |
686 | i = length; | 686 | i = length; |
687 | while (i-- > 0) | 687 | while (i-- > 0) |
688 | *longp++ = data; | 688 | *longp++ = data; |
689 | } | 689 | } |
690 | } | 690 | } |
691 | if (size == 2) { | 691 | if (size == 2) { |
692 | for (;;) { | 692 | for (;;) { |
693 | shortp = (u16 *)buf; | 693 | shortp = (u16 *)buf; |
694 | i = length; | 694 | i = length; |
695 | while (i-- > 0) | 695 | while (i-- > 0) |
696 | *shortp++ = data; | 696 | *shortp++ = data; |
697 | } | 697 | } |
698 | } | 698 | } |
699 | for (;;) { | 699 | for (;;) { |
700 | cp = (u8 *)buf; | 700 | cp = (u8 *)buf; |
701 | i = length; | 701 | i = length; |
702 | while (i-- > 0) | 702 | while (i-- > 0) |
703 | *cp++ = data; | 703 | *cp++ = data; |
704 | } | 704 | } |
705 | } | 705 | } |
706 | #endif /* CONFIG_LOOPW */ | 706 | #endif /* CONFIG_LOOPW */ |
707 | 707 | ||
708 | #ifdef CONFIG_CMD_MEMTEST | 708 | #ifdef CONFIG_CMD_MEMTEST |
709 | static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, | 709 | static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr, |
710 | vu_long *dummy) | 710 | vu_long *dummy) |
711 | { | 711 | { |
712 | vu_long *addr; | 712 | vu_long *addr; |
713 | ulong errs = 0; | 713 | ulong errs = 0; |
714 | ulong val, readback; | 714 | ulong val, readback; |
715 | int j; | 715 | int j; |
716 | vu_long offset; | 716 | vu_long offset; |
717 | vu_long test_offset; | 717 | vu_long test_offset; |
718 | vu_long pattern; | 718 | vu_long pattern; |
719 | vu_long temp; | 719 | vu_long temp; |
720 | vu_long anti_pattern; | 720 | vu_long anti_pattern; |
721 | vu_long num_words; | 721 | vu_long num_words; |
722 | static const ulong bitpattern[] = { | 722 | static const ulong bitpattern[] = { |
723 | 0x00000001, /* single bit */ | 723 | 0x00000001, /* single bit */ |
724 | 0x00000003, /* two adjacent bits */ | 724 | 0x00000003, /* two adjacent bits */ |
725 | 0x00000007, /* three adjacent bits */ | 725 | 0x00000007, /* three adjacent bits */ |
726 | 0x0000000F, /* four adjacent bits */ | 726 | 0x0000000F, /* four adjacent bits */ |
727 | 0x00000005, /* two non-adjacent bits */ | 727 | 0x00000005, /* two non-adjacent bits */ |
728 | 0x00000015, /* three non-adjacent bits */ | 728 | 0x00000015, /* three non-adjacent bits */ |
729 | 0x00000055, /* four non-adjacent bits */ | 729 | 0x00000055, /* four non-adjacent bits */ |
730 | 0xaaaaaaaa, /* alternating 1/0 */ | 730 | 0xaaaaaaaa, /* alternating 1/0 */ |
731 | }; | 731 | }; |
732 | 732 | ||
733 | num_words = (end_addr - start_addr) / sizeof(vu_long); | 733 | num_words = (end_addr - start_addr) / sizeof(vu_long); |
734 | 734 | ||
735 | /* | 735 | /* |
736 | * Data line test: write a pattern to the first | 736 | * Data line test: write a pattern to the first |
737 | * location, write the 1's complement to a 'parking' | 737 | * location, write the 1's complement to a 'parking' |
738 | * address (changes the state of the data bus so a | 738 | * address (changes the state of the data bus so a |
739 | * floating bus doesn't give a false OK), and then | 739 | * floating bus doesn't give a false OK), and then |
740 | * read the value back. Note that we read it back | 740 | * read the value back. Note that we read it back |
741 | * into a variable because the next time we read it, | 741 | * into a variable because the next time we read it, |
742 | * it might be right (been there, tough to explain to | 742 | * it might be right (been there, tough to explain to |
743 | * the quality guys why it prints a failure when the | 743 | * the quality guys why it prints a failure when the |
744 | * "is" and "should be" are obviously the same in the | 744 | * "is" and "should be" are obviously the same in the |
745 | * error message). | 745 | * error message). |
746 | * | 746 | * |
747 | * Rather than exhaustively testing, we test some | 747 | * Rather than exhaustively testing, we test some |
748 | * patterns by shifting '1' bits through a field of | 748 | * patterns by shifting '1' bits through a field of |
749 | * '0's and '0' bits through a field of '1's (i.e. | 749 | * '0's and '0' bits through a field of '1's (i.e. |
750 | * pattern and ~pattern). | 750 | * pattern and ~pattern). |
751 | */ | 751 | */ |
752 | addr = buf; | 752 | addr = buf; |
753 | for (j = 0; j < sizeof(bitpattern) / sizeof(bitpattern[0]); j++) { | 753 | for (j = 0; j < sizeof(bitpattern) / sizeof(bitpattern[0]); j++) { |
754 | val = bitpattern[j]; | 754 | val = bitpattern[j]; |
755 | for (; val != 0; val <<= 1) { | 755 | for (; val != 0; val <<= 1) { |
756 | *addr = val; | 756 | *addr = val; |
757 | *dummy = ~val; /* clear the test data off the bus */ | 757 | *dummy = ~val; /* clear the test data off the bus */ |
758 | readback = *addr; | 758 | readback = *addr; |
759 | if (readback != val) { | 759 | if (readback != val) { |
760 | printf("FAILURE (data line): " | 760 | printf("FAILURE (data line): " |
761 | "expected %08lx, actual %08lx\n", | 761 | "expected %08lx, actual %08lx\n", |
762 | val, readback); | 762 | val, readback); |
763 | errs++; | 763 | errs++; |
764 | if (ctrlc()) | 764 | if (ctrlc()) |
765 | return -1; | 765 | return -1; |
766 | } | 766 | } |
767 | *addr = ~val; | 767 | *addr = ~val; |
768 | *dummy = val; | 768 | *dummy = val; |
769 | readback = *addr; | 769 | readback = *addr; |
770 | if (readback != ~val) { | 770 | if (readback != ~val) { |
771 | printf("FAILURE (data line): " | 771 | printf("FAILURE (data line): " |
772 | "Is %08lx, should be %08lx\n", | 772 | "Is %08lx, should be %08lx\n", |
773 | readback, ~val); | 773 | readback, ~val); |
774 | errs++; | 774 | errs++; |
775 | if (ctrlc()) | 775 | if (ctrlc()) |
776 | return -1; | 776 | return -1; |
777 | } | 777 | } |
778 | } | 778 | } |
779 | } | 779 | } |
780 | 780 | ||
781 | /* | 781 | /* |
782 | * Based on code whose Original Author and Copyright | 782 | * Based on code whose Original Author and Copyright |
783 | * information follows: Copyright (c) 1998 by Michael | 783 | * information follows: Copyright (c) 1998 by Michael |
784 | * Barr. This software is placed into the public | 784 | * Barr. This software is placed into the public |
785 | * domain and may be used for any purpose. However, | 785 | * domain and may be used for any purpose. However, |
786 | * this notice must not be changed or removed and no | 786 | * this notice must not be changed or removed and no |
787 | * warranty is either expressed or implied by its | 787 | * warranty is either expressed or implied by its |
788 | * publication or distribution. | 788 | * publication or distribution. |
789 | */ | 789 | */ |
790 | 790 | ||
791 | /* | 791 | /* |
792 | * Address line test | 792 | * Address line test |
793 | 793 | ||
794 | * Description: Test the address bus wiring in a | 794 | * Description: Test the address bus wiring in a |
795 | * memory region by performing a walking | 795 | * memory region by performing a walking |
796 | * 1's test on the relevant bits of the | 796 | * 1's test on the relevant bits of the |
797 | * address and checking for aliasing. | 797 | * address and checking for aliasing. |
798 | * This test will find single-bit | 798 | * This test will find single-bit |
799 | * address failures such as stuck-high, | 799 | * address failures such as stuck-high, |
800 | * stuck-low, and shorted pins. The base | 800 | * stuck-low, and shorted pins. The base |
801 | * address and size of the region are | 801 | * address and size of the region are |
802 | * selected by the caller. | 802 | * selected by the caller. |
803 | 803 | ||
804 | * Notes: For best results, the selected base | 804 | * Notes: For best results, the selected base |
805 | * address should have enough LSB 0's to | 805 | * address should have enough LSB 0's to |
806 | * guarantee single address bit changes. | 806 | * guarantee single address bit changes. |
807 | * For example, to test a 64-Kbyte | 807 | * For example, to test a 64-Kbyte |
808 | * region, select a base address on a | 808 | * region, select a base address on a |
809 | * 64-Kbyte boundary. Also, select the | 809 | * 64-Kbyte boundary. Also, select the |
810 | * region size as a power-of-two if at | 810 | * region size as a power-of-two if at |
811 | * all possible. | 811 | * all possible. |
812 | * | 812 | * |
813 | * Returns: 0 if the test succeeds, 1 if the test fails. | 813 | * Returns: 0 if the test succeeds, 1 if the test fails. |
814 | */ | 814 | */ |
815 | pattern = (vu_long) 0xaaaaaaaa; | 815 | pattern = (vu_long) 0xaaaaaaaa; |
816 | anti_pattern = (vu_long) 0x55555555; | 816 | anti_pattern = (vu_long) 0x55555555; |
817 | 817 | ||
818 | debug("%s:%d: length = 0x%.8lx\n", __func__, __LINE__, num_words); | 818 | debug("%s:%d: length = 0x%.8lx\n", __func__, __LINE__, num_words); |
819 | /* | 819 | /* |
820 | * Write the default pattern at each of the | 820 | * Write the default pattern at each of the |
821 | * power-of-two offsets. | 821 | * power-of-two offsets. |
822 | */ | 822 | */ |
823 | for (offset = 1; offset < num_words; offset <<= 1) | 823 | for (offset = 1; offset < num_words; offset <<= 1) |
824 | addr[offset] = pattern; | 824 | addr[offset] = pattern; |
825 | 825 | ||
826 | /* | 826 | /* |
827 | * Check for address bits stuck high. | 827 | * Check for address bits stuck high. |
828 | */ | 828 | */ |
829 | test_offset = 0; | 829 | test_offset = 0; |
830 | addr[test_offset] = anti_pattern; | 830 | addr[test_offset] = anti_pattern; |
831 | 831 | ||
832 | for (offset = 1; offset < num_words; offset <<= 1) { | 832 | for (offset = 1; offset < num_words; offset <<= 1) { |
833 | temp = addr[offset]; | 833 | temp = addr[offset]; |
834 | if (temp != pattern) { | 834 | if (temp != pattern) { |
835 | printf("\nFAILURE: Address bit stuck high @ 0x%.8lx:" | 835 | printf("\nFAILURE: Address bit stuck high @ 0x%.8lx:" |
836 | " expected 0x%.8lx, actual 0x%.8lx\n", | 836 | " expected 0x%.8lx, actual 0x%.8lx\n", |
837 | start_addr + offset*sizeof(vu_long), | 837 | start_addr + offset*sizeof(vu_long), |
838 | pattern, temp); | 838 | pattern, temp); |
839 | errs++; | 839 | errs++; |
840 | if (ctrlc()) | 840 | if (ctrlc()) |
841 | return -1; | 841 | return -1; |
842 | } | 842 | } |
843 | } | 843 | } |
844 | addr[test_offset] = pattern; | 844 | addr[test_offset] = pattern; |
845 | WATCHDOG_RESET(); | 845 | WATCHDOG_RESET(); |
846 | 846 | ||
847 | /* | 847 | /* |
848 | * Check for addr bits stuck low or shorted. | 848 | * Check for addr bits stuck low or shorted. |
849 | */ | 849 | */ |
850 | for (test_offset = 1; test_offset < num_words; test_offset <<= 1) { | 850 | for (test_offset = 1; test_offset < num_words; test_offset <<= 1) { |
851 | addr[test_offset] = anti_pattern; | 851 | addr[test_offset] = anti_pattern; |
852 | 852 | ||
853 | for (offset = 1; offset < num_words; offset <<= 1) { | 853 | for (offset = 1; offset < num_words; offset <<= 1) { |
854 | temp = addr[offset]; | 854 | temp = addr[offset]; |
855 | if ((temp != pattern) && (offset != test_offset)) { | 855 | if ((temp != pattern) && (offset != test_offset)) { |
856 | printf("\nFAILURE: Address bit stuck low or" | 856 | printf("\nFAILURE: Address bit stuck low or" |
857 | " shorted @ 0x%.8lx: expected 0x%.8lx," | 857 | " shorted @ 0x%.8lx: expected 0x%.8lx," |
858 | " actual 0x%.8lx\n", | 858 | " actual 0x%.8lx\n", |
859 | start_addr + offset*sizeof(vu_long), | 859 | start_addr + offset*sizeof(vu_long), |
860 | pattern, temp); | 860 | pattern, temp); |
861 | errs++; | 861 | errs++; |
862 | if (ctrlc()) | 862 | if (ctrlc()) |
863 | return -1; | 863 | return -1; |
864 | } | 864 | } |
865 | } | 865 | } |
866 | addr[test_offset] = pattern; | 866 | addr[test_offset] = pattern; |
867 | } | 867 | } |
868 | 868 | ||
869 | /* | 869 | /* |
870 | * Description: Test the integrity of a physical | 870 | * Description: Test the integrity of a physical |
871 | * memory device by performing an | 871 | * memory device by performing an |
872 | * increment/decrement test over the | 872 | * increment/decrement test over the |
873 | * entire region. In the process every | 873 | * entire region. In the process every |
874 | * storage bit in the device is tested | 874 | * storage bit in the device is tested |
875 | * as a zero and a one. The base address | 875 | * as a zero and a one. The base address |
876 | * and the size of the region are | 876 | * and the size of the region are |
877 | * selected by the caller. | 877 | * selected by the caller. |
878 | * | 878 | * |
879 | * Returns: 0 if the test succeeds, 1 if the test fails. | 879 | * Returns: 0 if the test succeeds, 1 if the test fails. |
880 | */ | 880 | */ |
881 | num_words++; | 881 | num_words++; |
882 | 882 | ||
883 | /* | 883 | /* |
884 | * Fill memory with a known pattern. | 884 | * Fill memory with a known pattern. |
885 | */ | 885 | */ |
886 | for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) { | 886 | for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) { |
887 | WATCHDOG_RESET(); | 887 | WATCHDOG_RESET(); |
888 | addr[offset] = pattern; | 888 | addr[offset] = pattern; |
889 | } | 889 | } |
890 | 890 | ||
891 | /* | 891 | /* |
892 | * Check each location and invert it for the second pass. | 892 | * Check each location and invert it for the second pass. |
893 | */ | 893 | */ |
894 | for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) { | 894 | for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) { |
895 | WATCHDOG_RESET(); | 895 | WATCHDOG_RESET(); |
896 | temp = addr[offset]; | 896 | temp = addr[offset]; |
897 | if (temp != pattern) { | 897 | if (temp != pattern) { |
898 | printf("\nFAILURE (read/write) @ 0x%.8lx:" | 898 | printf("\nFAILURE (read/write) @ 0x%.8lx:" |
899 | " expected 0x%.8lx, actual 0x%.8lx)\n", | 899 | " expected 0x%.8lx, actual 0x%.8lx)\n", |
900 | start_addr + offset*sizeof(vu_long), | 900 | start_addr + offset*sizeof(vu_long), |
901 | pattern, temp); | 901 | pattern, temp); |
902 | errs++; | 902 | errs++; |
903 | if (ctrlc()) | 903 | if (ctrlc()) |
904 | return -1; | 904 | return -1; |
905 | } | 905 | } |
906 | 906 | ||
907 | anti_pattern = ~pattern; | 907 | anti_pattern = ~pattern; |
908 | addr[offset] = anti_pattern; | 908 | addr[offset] = anti_pattern; |
909 | } | 909 | } |
910 | 910 | ||
911 | /* | 911 | /* |
912 | * Check each location for the inverted pattern and zero it. | 912 | * Check each location for the inverted pattern and zero it. |
913 | */ | 913 | */ |
914 | for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) { | 914 | for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) { |
915 | WATCHDOG_RESET(); | 915 | WATCHDOG_RESET(); |
916 | anti_pattern = ~pattern; | 916 | anti_pattern = ~pattern; |
917 | temp = addr[offset]; | 917 | temp = addr[offset]; |
918 | if (temp != anti_pattern) { | 918 | if (temp != anti_pattern) { |
919 | printf("\nFAILURE (read/write): @ 0x%.8lx:" | 919 | printf("\nFAILURE (read/write): @ 0x%.8lx:" |
920 | " expected 0x%.8lx, actual 0x%.8lx)\n", | 920 | " expected 0x%.8lx, actual 0x%.8lx)\n", |
921 | start_addr + offset*sizeof(vu_long), | 921 | start_addr + offset*sizeof(vu_long), |
922 | anti_pattern, temp); | 922 | anti_pattern, temp); |
923 | errs++; | 923 | errs++; |
924 | if (ctrlc()) | 924 | if (ctrlc()) |
925 | return -1; | 925 | return -1; |
926 | } | 926 | } |
927 | addr[offset] = 0; | 927 | addr[offset] = 0; |
928 | } | 928 | } |
929 | 929 | ||
930 | return 0; | 930 | return 0; |
931 | } | 931 | } |
932 | 932 | ||
933 | static ulong mem_test_quick(vu_long *buf, ulong start_addr, ulong end_addr, | 933 | static ulong mem_test_quick(vu_long *buf, ulong start_addr, ulong end_addr, |
934 | vu_long pattern, int iteration) | 934 | vu_long pattern, int iteration) |
935 | { | 935 | { |
936 | vu_long *end; | 936 | vu_long *end; |
937 | vu_long *addr; | 937 | vu_long *addr; |
938 | ulong errs = 0; | 938 | ulong errs = 0; |
939 | ulong incr, length; | 939 | ulong incr, length; |
940 | ulong val, readback; | 940 | ulong val, readback; |
941 | 941 | ||
942 | /* Alternate the pattern */ | 942 | /* Alternate the pattern */ |
943 | incr = 1; | 943 | incr = 1; |
944 | if (iteration & 1) { | 944 | if (iteration & 1) { |
945 | incr = -incr; | 945 | incr = -incr; |
946 | /* | 946 | /* |
947 | * Flip the pattern each time to make lots of zeros and | 947 | * Flip the pattern each time to make lots of zeros and |
948 | * then, the next time, lots of ones. We decrement | 948 | * then, the next time, lots of ones. We decrement |
949 | * the "negative" patterns and increment the "positive" | 949 | * the "negative" patterns and increment the "positive" |
950 | * patterns to preserve this feature. | 950 | * patterns to preserve this feature. |
951 | */ | 951 | */ |
952 | if (pattern & 0x80000000) | 952 | if (pattern & 0x80000000) |
953 | pattern = -pattern; /* complement & increment */ | 953 | pattern = -pattern; /* complement & increment */ |
954 | else | 954 | else |
955 | pattern = ~pattern; | 955 | pattern = ~pattern; |
956 | } | 956 | } |
957 | length = (end_addr - start_addr) / sizeof(ulong); | 957 | length = (end_addr - start_addr) / sizeof(ulong); |
958 | end = buf + length; | 958 | end = buf + length; |
959 | printf("\rPattern %08lX Writing..." | 959 | printf("\rPattern %08lX Writing..." |
960 | "%12s" | 960 | "%12s" |
961 | "\b\b\b\b\b\b\b\b\b\b", | 961 | "\b\b\b\b\b\b\b\b\b\b", |
962 | pattern, ""); | 962 | pattern, ""); |
963 | 963 | ||
964 | for (addr = buf, val = pattern; addr < end; addr++) { | 964 | for (addr = buf, val = pattern; addr < end; addr++) { |
965 | WATCHDOG_RESET(); | 965 | WATCHDOG_RESET(); |
966 | *addr = val; | 966 | *addr = val; |
967 | val += incr; | 967 | val += incr; |
968 | } | 968 | } |
969 | 969 | ||
970 | puts("Reading..."); | 970 | puts("Reading..."); |
971 | 971 | ||
972 | for (addr = buf, val = pattern; addr < end; addr++) { | 972 | for (addr = buf, val = pattern; addr < end; addr++) { |
973 | WATCHDOG_RESET(); | 973 | WATCHDOG_RESET(); |
974 | readback = *addr; | 974 | readback = *addr; |
975 | if (readback != val) { | 975 | if (readback != val) { |
976 | ulong offset = addr - buf; | 976 | ulong offset = addr - buf; |
977 | 977 | ||
978 | printf("\nMem error @ 0x%08X: " | 978 | printf("\nMem error @ 0x%08X: " |
979 | "found %08lX, expected %08lX\n", | 979 | "found %08lX, expected %08lX\n", |
980 | (uint)(uintptr_t)(start_addr + offset*sizeof(vu_long)), | 980 | (uint)(uintptr_t)(start_addr + offset*sizeof(vu_long)), |
981 | readback, val); | 981 | readback, val); |
982 | errs++; | 982 | errs++; |
983 | if (ctrlc()) | 983 | if (ctrlc()) |
984 | return -1; | 984 | return -1; |
985 | } | 985 | } |
986 | val += incr; | 986 | val += incr; |
987 | } | 987 | } |
988 | 988 | ||
989 | return 0; | 989 | return 0; |
990 | } | 990 | } |
991 | 991 | ||
992 | /* | 992 | /* |
993 | * Perform a memory test. A more complete alternative test can be | 993 | * Perform a memory test. A more complete alternative test can be |
994 | * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until | 994 | * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until |
995 | * interrupted by ctrl-c or by a failure of one of the sub-tests. | 995 | * interrupted by ctrl-c or by a failure of one of the sub-tests. |
996 | */ | 996 | */ |
997 | static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc, | 997 | static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc, |
998 | char * const argv[]) | 998 | char * const argv[]) |
999 | { | 999 | { |
1000 | ulong start, end; | 1000 | ulong start, end; |
1001 | vu_long *buf, *dummy; | 1001 | vu_long *buf, *dummy; |
1002 | int iteration_limit = 0; | 1002 | ulong iteration_limit = 0; |
1003 | int ret; | 1003 | int ret; |
1004 | ulong errs = 0; /* number of errors, or -1 if interrupted */ | 1004 | ulong errs = 0; /* number of errors, or -1 if interrupted */ |
1005 | ulong pattern = 0; | 1005 | ulong pattern = 0; |
1006 | int iteration; | 1006 | int iteration; |
1007 | #if defined(CONFIG_SYS_ALT_MEMTEST) | 1007 | #if defined(CONFIG_SYS_ALT_MEMTEST) |
1008 | const int alt_test = 1; | 1008 | const int alt_test = 1; |
1009 | #else | 1009 | #else |
1010 | const int alt_test = 0; | 1010 | const int alt_test = 0; |
1011 | #endif | 1011 | #endif |
1012 | 1012 | ||
1013 | start = CONFIG_SYS_MEMTEST_START; | 1013 | start = CONFIG_SYS_MEMTEST_START; |
1014 | end = CONFIG_SYS_MEMTEST_END; | 1014 | end = CONFIG_SYS_MEMTEST_END; |
1015 | 1015 | ||
1016 | if (argc > 1) | 1016 | if (argc > 1) |
1017 | if (strict_strtoul(argv[1], 16, &start) < 0) | 1017 | if (strict_strtoul(argv[1], 16, &start) < 0) |
1018 | return CMD_RET_USAGE; | 1018 | return CMD_RET_USAGE; |
1019 | 1019 | ||
1020 | if (argc > 2) | 1020 | if (argc > 2) |
1021 | if (strict_strtoul(argv[2], 16, &end) < 0) | 1021 | if (strict_strtoul(argv[2], 16, &end) < 0) |
1022 | return CMD_RET_USAGE; | 1022 | return CMD_RET_USAGE; |
1023 | 1023 | ||
1024 | if (argc > 3) | 1024 | if (argc > 3) |
1025 | if (strict_strtoul(argv[3], 16, &pattern) < 0) | 1025 | if (strict_strtoul(argv[3], 16, &pattern) < 0) |
1026 | return CMD_RET_USAGE; | 1026 | return CMD_RET_USAGE; |
1027 | 1027 | ||
1028 | if (argc > 4) | 1028 | if (argc > 4) |
1029 | if (strict_strtoul(argv[4], 16, &iteration_limit) < 0) | 1029 | if (strict_strtoul(argv[4], 16, &iteration_limit) < 0) |
1030 | return CMD_RET_USAGE; | 1030 | return CMD_RET_USAGE; |
1031 | 1031 | ||
1032 | if (end < start) { | 1032 | if (end < start) { |
1033 | printf("Refusing to do empty test\n"); | 1033 | printf("Refusing to do empty test\n"); |
1034 | return -1; | 1034 | return -1; |
1035 | } | 1035 | } |
1036 | 1036 | ||
1037 | printf("Testing %08x ... %08x:\n", (uint)start, (uint)end); | 1037 | printf("Testing %08x ... %08x:\n", (uint)start, (uint)end); |
1038 | debug("%s:%d: start %#08lx end %#08lx\n", __func__, __LINE__, | 1038 | debug("%s:%d: start %#08lx end %#08lx\n", __func__, __LINE__, |
1039 | start, end); | 1039 | start, end); |
1040 | 1040 | ||
1041 | buf = map_sysmem(start, end - start); | 1041 | buf = map_sysmem(start, end - start); |
1042 | dummy = map_sysmem(CONFIG_SYS_MEMTEST_SCRATCH, sizeof(vu_long)); | 1042 | dummy = map_sysmem(CONFIG_SYS_MEMTEST_SCRATCH, sizeof(vu_long)); |
1043 | for (iteration = 0; | 1043 | for (iteration = 0; |
1044 | !iteration_limit || iteration < iteration_limit; | 1044 | !iteration_limit || iteration < iteration_limit; |
1045 | iteration++) { | 1045 | iteration++) { |
1046 | if (ctrlc()) { | 1046 | if (ctrlc()) { |
1047 | errs = -1UL; | 1047 | errs = -1UL; |
1048 | break; | 1048 | break; |
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | printf("Iteration: %6d\r", iteration + 1); | 1051 | printf("Iteration: %6d\r", iteration + 1); |
1052 | debug("\n"); | 1052 | debug("\n"); |
1053 | if (alt_test) { | 1053 | if (alt_test) { |
1054 | errs = mem_test_alt(buf, start, end, dummy); | 1054 | errs = mem_test_alt(buf, start, end, dummy); |
1055 | } else { | 1055 | } else { |
1056 | errs = mem_test_quick(buf, start, end, pattern, | 1056 | errs = mem_test_quick(buf, start, end, pattern, |
1057 | iteration); | 1057 | iteration); |
1058 | } | 1058 | } |
1059 | if (errs == -1UL) | 1059 | if (errs == -1UL) |
1060 | break; | 1060 | break; |
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | /* | 1063 | /* |
1064 | * Work-around for eldk-4.2 which gives this warning if we try to | 1064 | * Work-around for eldk-4.2 which gives this warning if we try to |
1065 | * case in the unmap_sysmem() call: | 1065 | * case in the unmap_sysmem() call: |
1066 | * warning: initialization discards qualifiers from pointer target type | 1066 | * warning: initialization discards qualifiers from pointer target type |
1067 | */ | 1067 | */ |
1068 | { | 1068 | { |
1069 | void *vbuf = (void *)buf; | 1069 | void *vbuf = (void *)buf; |
1070 | void *vdummy = (void *)dummy; | 1070 | void *vdummy = (void *)dummy; |
1071 | 1071 | ||
1072 | unmap_sysmem(vbuf); | 1072 | unmap_sysmem(vbuf); |
1073 | unmap_sysmem(vdummy); | 1073 | unmap_sysmem(vdummy); |
1074 | } | 1074 | } |
1075 | 1075 | ||
1076 | if (errs == -1UL) { | 1076 | if (errs == -1UL) { |
1077 | /* Memory test was aborted - write a newline to finish off */ | 1077 | /* Memory test was aborted - write a newline to finish off */ |
1078 | putc('\n'); | 1078 | putc('\n'); |
1079 | ret = 1; | 1079 | ret = 1; |
1080 | } else { | 1080 | } else { |
1081 | printf("Tested %d iteration(s) with %lu errors.\n", | 1081 | printf("Tested %d iteration(s) with %lu errors.\n", |
1082 | iteration, errs); | 1082 | iteration, errs); |
1083 | ret = errs != 0; | 1083 | ret = errs != 0; |
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | return ret; | 1086 | return ret; |
1087 | } | 1087 | } |
1088 | #endif /* CONFIG_CMD_MEMTEST */ | 1088 | #endif /* CONFIG_CMD_MEMTEST */ |
1089 | 1089 | ||
1090 | /* Modify memory. | 1090 | /* Modify memory. |
1091 | * | 1091 | * |
1092 | * Syntax: | 1092 | * Syntax: |
1093 | * mm{.b, .w, .l, .q} {addr} | 1093 | * mm{.b, .w, .l, .q} {addr} |
1094 | * nm{.b, .w, .l, .q} {addr} | 1094 | * nm{.b, .w, .l, .q} {addr} |
1095 | */ | 1095 | */ |
1096 | static int | 1096 | static int |
1097 | mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[]) | 1097 | mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[]) |
1098 | { | 1098 | { |
1099 | ulong addr; | 1099 | ulong addr; |
1100 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 1100 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
1101 | u64 i; | 1101 | u64 i; |
1102 | #else | 1102 | #else |
1103 | ulong i; | 1103 | ulong i; |
1104 | #endif | 1104 | #endif |
1105 | int nbytes, size; | 1105 | int nbytes, size; |
1106 | void *ptr = NULL; | 1106 | void *ptr = NULL; |
1107 | 1107 | ||
1108 | if (argc != 2) | 1108 | if (argc != 2) |
1109 | return CMD_RET_USAGE; | 1109 | return CMD_RET_USAGE; |
1110 | 1110 | ||
1111 | bootretry_reset_cmd_timeout(); /* got a good command to get here */ | 1111 | bootretry_reset_cmd_timeout(); /* got a good command to get here */ |
1112 | /* We use the last specified parameters, unless new ones are | 1112 | /* We use the last specified parameters, unless new ones are |
1113 | * entered. | 1113 | * entered. |
1114 | */ | 1114 | */ |
1115 | addr = mm_last_addr; | 1115 | addr = mm_last_addr; |
1116 | size = mm_last_size; | 1116 | size = mm_last_size; |
1117 | 1117 | ||
1118 | if ((flag & CMD_FLAG_REPEAT) == 0) { | 1118 | if ((flag & CMD_FLAG_REPEAT) == 0) { |
1119 | /* New command specified. Check for a size specification. | 1119 | /* New command specified. Check for a size specification. |
1120 | * Defaults to long if no or incorrect specification. | 1120 | * Defaults to long if no or incorrect specification. |
1121 | */ | 1121 | */ |
1122 | if ((size = cmd_get_data_size(argv[0], 4)) < 0) | 1122 | if ((size = cmd_get_data_size(argv[0], 4)) < 0) |
1123 | return 1; | 1123 | return 1; |
1124 | 1124 | ||
1125 | /* Address is specified since argc > 1 | 1125 | /* Address is specified since argc > 1 |
1126 | */ | 1126 | */ |
1127 | addr = simple_strtoul(argv[1], NULL, 16); | 1127 | addr = simple_strtoul(argv[1], NULL, 16); |
1128 | addr += base_address; | 1128 | addr += base_address; |
1129 | } | 1129 | } |
1130 | 1130 | ||
1131 | #ifdef CONFIG_HAS_DATAFLASH | 1131 | #ifdef CONFIG_HAS_DATAFLASH |
1132 | if (addr_dataflash(addr)){ | 1132 | if (addr_dataflash(addr)){ |
1133 | puts ("Can't modify DataFlash in place. Use cp instead.\n\r"); | 1133 | puts ("Can't modify DataFlash in place. Use cp instead.\n\r"); |
1134 | return 0; | 1134 | return 0; |
1135 | } | 1135 | } |
1136 | #endif | 1136 | #endif |
1137 | 1137 | ||
1138 | #ifdef CONFIG_BLACKFIN | 1138 | #ifdef CONFIG_BLACKFIN |
1139 | if (addr_bfin_on_chip_mem(addr)) { | 1139 | if (addr_bfin_on_chip_mem(addr)) { |
1140 | puts ("Can't modify L1 instruction in place. Use cp instead.\n\r"); | 1140 | puts ("Can't modify L1 instruction in place. Use cp instead.\n\r"); |
1141 | return 0; | 1141 | return 0; |
1142 | } | 1142 | } |
1143 | #endif | 1143 | #endif |
1144 | 1144 | ||
1145 | /* Print the address, followed by value. Then accept input for | 1145 | /* Print the address, followed by value. Then accept input for |
1146 | * the next value. A non-converted value exits. | 1146 | * the next value. A non-converted value exits. |
1147 | */ | 1147 | */ |
1148 | do { | 1148 | do { |
1149 | ptr = map_sysmem(addr, size); | 1149 | ptr = map_sysmem(addr, size); |
1150 | printf("%08lx:", addr); | 1150 | printf("%08lx:", addr); |
1151 | if (size == 4) | 1151 | if (size == 4) |
1152 | printf(" %08x", *((u32 *)ptr)); | 1152 | printf(" %08x", *((u32 *)ptr)); |
1153 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 1153 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
1154 | else if (size == 8) | 1154 | else if (size == 8) |
1155 | printf(" %016" PRIx64, *((u64 *)ptr)); | 1155 | printf(" %016" PRIx64, *((u64 *)ptr)); |
1156 | #endif | 1156 | #endif |
1157 | else if (size == 2) | 1157 | else if (size == 2) |
1158 | printf(" %04x", *((u16 *)ptr)); | 1158 | printf(" %04x", *((u16 *)ptr)); |
1159 | else | 1159 | else |
1160 | printf(" %02x", *((u8 *)ptr)); | 1160 | printf(" %02x", *((u8 *)ptr)); |
1161 | 1161 | ||
1162 | nbytes = cli_readline(" ? "); | 1162 | nbytes = cli_readline(" ? "); |
1163 | if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) { | 1163 | if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) { |
1164 | /* <CR> pressed as only input, don't modify current | 1164 | /* <CR> pressed as only input, don't modify current |
1165 | * location and move to next. "-" pressed will go back. | 1165 | * location and move to next. "-" pressed will go back. |
1166 | */ | 1166 | */ |
1167 | if (incrflag) | 1167 | if (incrflag) |
1168 | addr += nbytes ? -size : size; | 1168 | addr += nbytes ? -size : size; |
1169 | nbytes = 1; | 1169 | nbytes = 1; |
1170 | /* good enough to not time out */ | 1170 | /* good enough to not time out */ |
1171 | bootretry_reset_cmd_timeout(); | 1171 | bootretry_reset_cmd_timeout(); |
1172 | } | 1172 | } |
1173 | #ifdef CONFIG_BOOT_RETRY_TIME | 1173 | #ifdef CONFIG_BOOT_RETRY_TIME |
1174 | else if (nbytes == -2) { | 1174 | else if (nbytes == -2) { |
1175 | break; /* timed out, exit the command */ | 1175 | break; /* timed out, exit the command */ |
1176 | } | 1176 | } |
1177 | #endif | 1177 | #endif |
1178 | else { | 1178 | else { |
1179 | char *endp; | 1179 | char *endp; |
1180 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 1180 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
1181 | i = simple_strtoull(console_buffer, &endp, 16); | 1181 | i = simple_strtoull(console_buffer, &endp, 16); |
1182 | #else | 1182 | #else |
1183 | i = simple_strtoul(console_buffer, &endp, 16); | 1183 | i = simple_strtoul(console_buffer, &endp, 16); |
1184 | #endif | 1184 | #endif |
1185 | nbytes = endp - console_buffer; | 1185 | nbytes = endp - console_buffer; |
1186 | if (nbytes) { | 1186 | if (nbytes) { |
1187 | /* good enough to not time out | 1187 | /* good enough to not time out |
1188 | */ | 1188 | */ |
1189 | bootretry_reset_cmd_timeout(); | 1189 | bootretry_reset_cmd_timeout(); |
1190 | if (size == 4) | 1190 | if (size == 4) |
1191 | *((u32 *)ptr) = i; | 1191 | *((u32 *)ptr) = i; |
1192 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 1192 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
1193 | else if (size == 8) | 1193 | else if (size == 8) |
1194 | *((u64 *)ptr) = i; | 1194 | *((u64 *)ptr) = i; |
1195 | #endif | 1195 | #endif |
1196 | else if (size == 2) | 1196 | else if (size == 2) |
1197 | *((u16 *)ptr) = i; | 1197 | *((u16 *)ptr) = i; |
1198 | else | 1198 | else |
1199 | *((u8 *)ptr) = i; | 1199 | *((u8 *)ptr) = i; |
1200 | if (incrflag) | 1200 | if (incrflag) |
1201 | addr += size; | 1201 | addr += size; |
1202 | } | 1202 | } |
1203 | } | 1203 | } |
1204 | } while (nbytes); | 1204 | } while (nbytes); |
1205 | if (ptr) | 1205 | if (ptr) |
1206 | unmap_sysmem(ptr); | 1206 | unmap_sysmem(ptr); |
1207 | 1207 | ||
1208 | mm_last_addr = addr; | 1208 | mm_last_addr = addr; |
1209 | mm_last_size = size; | 1209 | mm_last_size = size; |
1210 | return 0; | 1210 | return 0; |
1211 | } | 1211 | } |
1212 | 1212 | ||
1213 | #ifdef CONFIG_CMD_CRC32 | 1213 | #ifdef CONFIG_CMD_CRC32 |
1214 | 1214 | ||
1215 | static int do_mem_crc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) | 1215 | static int do_mem_crc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
1216 | { | 1216 | { |
1217 | int flags = 0; | 1217 | int flags = 0; |
1218 | int ac; | 1218 | int ac; |
1219 | char * const *av; | 1219 | char * const *av; |
1220 | 1220 | ||
1221 | if (argc < 3) | 1221 | if (argc < 3) |
1222 | return CMD_RET_USAGE; | 1222 | return CMD_RET_USAGE; |
1223 | 1223 | ||
1224 | av = argv + 1; | 1224 | av = argv + 1; |
1225 | ac = argc - 1; | 1225 | ac = argc - 1; |
1226 | #ifdef CONFIG_HASH_VERIFY | 1226 | #ifdef CONFIG_HASH_VERIFY |
1227 | if (strcmp(*av, "-v") == 0) { | 1227 | if (strcmp(*av, "-v") == 0) { |
1228 | flags |= HASH_FLAG_VERIFY; | 1228 | flags |= HASH_FLAG_VERIFY; |
1229 | av++; | 1229 | av++; |
1230 | ac--; | 1230 | ac--; |
1231 | } | 1231 | } |
1232 | #endif | 1232 | #endif |
1233 | 1233 | ||
1234 | return hash_command("crc32", flags, cmdtp, flag, ac, av); | 1234 | return hash_command("crc32", flags, cmdtp, flag, ac, av); |
1235 | } | 1235 | } |
1236 | 1236 | ||
1237 | #endif | 1237 | #endif |
1238 | 1238 | ||
1239 | /**************************************************/ | 1239 | /**************************************************/ |
1240 | U_BOOT_CMD( | 1240 | U_BOOT_CMD( |
1241 | md, 3, 1, do_mem_md, | 1241 | md, 3, 1, do_mem_md, |
1242 | "memory display", | 1242 | "memory display", |
1243 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 1243 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
1244 | "[.b, .w, .l, .q] address [# of objects]" | 1244 | "[.b, .w, .l, .q] address [# of objects]" |
1245 | #else | 1245 | #else |
1246 | "[.b, .w, .l] address [# of objects]" | 1246 | "[.b, .w, .l] address [# of objects]" |
1247 | #endif | 1247 | #endif |
1248 | ); | 1248 | ); |
1249 | 1249 | ||
1250 | 1250 | ||
1251 | U_BOOT_CMD( | 1251 | U_BOOT_CMD( |
1252 | mm, 2, 1, do_mem_mm, | 1252 | mm, 2, 1, do_mem_mm, |
1253 | "memory modify (auto-incrementing address)", | 1253 | "memory modify (auto-incrementing address)", |
1254 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 1254 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
1255 | "[.b, .w, .l, .q] address" | 1255 | "[.b, .w, .l, .q] address" |
1256 | #else | 1256 | #else |
1257 | "[.b, .w, .l] address" | 1257 | "[.b, .w, .l] address" |
1258 | #endif | 1258 | #endif |
1259 | ); | 1259 | ); |
1260 | 1260 | ||
1261 | 1261 | ||
1262 | U_BOOT_CMD( | 1262 | U_BOOT_CMD( |
1263 | nm, 2, 1, do_mem_nm, | 1263 | nm, 2, 1, do_mem_nm, |
1264 | "memory modify (constant address)", | 1264 | "memory modify (constant address)", |
1265 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 1265 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
1266 | "[.b, .w, .l, .q] address" | 1266 | "[.b, .w, .l, .q] address" |
1267 | #else | 1267 | #else |
1268 | "[.b, .w, .l] address" | 1268 | "[.b, .w, .l] address" |
1269 | #endif | 1269 | #endif |
1270 | ); | 1270 | ); |
1271 | 1271 | ||
1272 | U_BOOT_CMD( | 1272 | U_BOOT_CMD( |
1273 | mw, 4, 1, do_mem_mw, | 1273 | mw, 4, 1, do_mem_mw, |
1274 | "memory write (fill)", | 1274 | "memory write (fill)", |
1275 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 1275 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
1276 | "[.b, .w, .l, .q] address value [count]" | 1276 | "[.b, .w, .l, .q] address value [count]" |
1277 | #else | 1277 | #else |
1278 | "[.b, .w, .l] address value [count]" | 1278 | "[.b, .w, .l] address value [count]" |
1279 | #endif | 1279 | #endif |
1280 | ); | 1280 | ); |
1281 | 1281 | ||
1282 | U_BOOT_CMD( | 1282 | U_BOOT_CMD( |
1283 | cp, 4, 1, do_mem_cp, | 1283 | cp, 4, 1, do_mem_cp, |
1284 | "memory copy", | 1284 | "memory copy", |
1285 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 1285 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
1286 | "[.b, .w, .l, .q] source target count" | 1286 | "[.b, .w, .l, .q] source target count" |
1287 | #else | 1287 | #else |
1288 | "[.b, .w, .l] source target count" | 1288 | "[.b, .w, .l] source target count" |
1289 | #endif | 1289 | #endif |
1290 | ); | 1290 | ); |
1291 | 1291 | ||
1292 | U_BOOT_CMD( | 1292 | U_BOOT_CMD( |
1293 | cmp, 4, 1, do_mem_cmp, | 1293 | cmp, 4, 1, do_mem_cmp, |
1294 | "memory compare", | 1294 | "memory compare", |
1295 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 1295 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
1296 | "[.b, .w, .l, .q] addr1 addr2 count" | 1296 | "[.b, .w, .l, .q] addr1 addr2 count" |
1297 | #else | 1297 | #else |
1298 | "[.b, .w, .l] addr1 addr2 count" | 1298 | "[.b, .w, .l] addr1 addr2 count" |
1299 | #endif | 1299 | #endif |
1300 | ); | 1300 | ); |
1301 | 1301 | ||
1302 | #ifdef CONFIG_CMD_CRC32 | 1302 | #ifdef CONFIG_CMD_CRC32 |
1303 | 1303 | ||
1304 | #ifndef CONFIG_CRC32_VERIFY | 1304 | #ifndef CONFIG_CRC32_VERIFY |
1305 | 1305 | ||
1306 | U_BOOT_CMD( | 1306 | U_BOOT_CMD( |
1307 | crc32, 4, 1, do_mem_crc, | 1307 | crc32, 4, 1, do_mem_crc, |
1308 | "checksum calculation", | 1308 | "checksum calculation", |
1309 | "address count [addr]\n - compute CRC32 checksum [save at addr]" | 1309 | "address count [addr]\n - compute CRC32 checksum [save at addr]" |
1310 | ); | 1310 | ); |
1311 | 1311 | ||
1312 | #else /* CONFIG_CRC32_VERIFY */ | 1312 | #else /* CONFIG_CRC32_VERIFY */ |
1313 | 1313 | ||
1314 | U_BOOT_CMD( | 1314 | U_BOOT_CMD( |
1315 | crc32, 5, 1, do_mem_crc, | 1315 | crc32, 5, 1, do_mem_crc, |
1316 | "checksum calculation", | 1316 | "checksum calculation", |
1317 | "address count [addr]\n - compute CRC32 checksum [save at addr]\n" | 1317 | "address count [addr]\n - compute CRC32 checksum [save at addr]\n" |
1318 | "-v address count crc\n - verify crc of memory area" | 1318 | "-v address count crc\n - verify crc of memory area" |
1319 | ); | 1319 | ); |
1320 | 1320 | ||
1321 | #endif /* CONFIG_CRC32_VERIFY */ | 1321 | #endif /* CONFIG_CRC32_VERIFY */ |
1322 | 1322 | ||
1323 | #endif | 1323 | #endif |
1324 | 1324 | ||
1325 | #ifdef CONFIG_CMD_MEMINFO | 1325 | #ifdef CONFIG_CMD_MEMINFO |
1326 | __weak void board_show_dram(ulong size) | 1326 | __weak void board_show_dram(ulong size) |
1327 | { | 1327 | { |
1328 | puts("DRAM: "); | 1328 | puts("DRAM: "); |
1329 | print_size(size, "\n"); | 1329 | print_size(size, "\n"); |
1330 | } | 1330 | } |
1331 | 1331 | ||
1332 | static int do_mem_info(cmd_tbl_t *cmdtp, int flag, int argc, | 1332 | static int do_mem_info(cmd_tbl_t *cmdtp, int flag, int argc, |
1333 | char * const argv[]) | 1333 | char * const argv[]) |
1334 | { | 1334 | { |
1335 | board_show_dram(gd->ram_size); | 1335 | board_show_dram(gd->ram_size); |
1336 | 1336 | ||
1337 | return 0; | 1337 | return 0; |
1338 | } | 1338 | } |
1339 | #endif | 1339 | #endif |
1340 | 1340 | ||
1341 | U_BOOT_CMD( | 1341 | U_BOOT_CMD( |
1342 | base, 2, 1, do_mem_base, | 1342 | base, 2, 1, do_mem_base, |
1343 | "print or set address offset", | 1343 | "print or set address offset", |
1344 | "\n - print address offset for memory commands\n" | 1344 | "\n - print address offset for memory commands\n" |
1345 | "base off\n - set address offset for memory commands to 'off'" | 1345 | "base off\n - set address offset for memory commands to 'off'" |
1346 | ); | 1346 | ); |
1347 | 1347 | ||
1348 | U_BOOT_CMD( | 1348 | U_BOOT_CMD( |
1349 | loop, 3, 1, do_mem_loop, | 1349 | loop, 3, 1, do_mem_loop, |
1350 | "infinite loop on address range", | 1350 | "infinite loop on address range", |
1351 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 1351 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
1352 | "[.b, .w, .l, .q] address number_of_objects" | 1352 | "[.b, .w, .l, .q] address number_of_objects" |
1353 | #else | 1353 | #else |
1354 | "[.b, .w, .l] address number_of_objects" | 1354 | "[.b, .w, .l] address number_of_objects" |
1355 | #endif | 1355 | #endif |
1356 | ); | 1356 | ); |
1357 | 1357 | ||
1358 | #ifdef CONFIG_LOOPW | 1358 | #ifdef CONFIG_LOOPW |
1359 | U_BOOT_CMD( | 1359 | U_BOOT_CMD( |
1360 | loopw, 4, 1, do_mem_loopw, | 1360 | loopw, 4, 1, do_mem_loopw, |
1361 | "infinite write loop on address range", | 1361 | "infinite write loop on address range", |
1362 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 1362 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
1363 | "[.b, .w, .l, .q] address number_of_objects data_to_write" | 1363 | "[.b, .w, .l, .q] address number_of_objects data_to_write" |
1364 | #else | 1364 | #else |
1365 | "[.b, .w, .l] address number_of_objects data_to_write" | 1365 | "[.b, .w, .l] address number_of_objects data_to_write" |
1366 | #endif | 1366 | #endif |
1367 | ); | 1367 | ); |
1368 | #endif /* CONFIG_LOOPW */ | 1368 | #endif /* CONFIG_LOOPW */ |
1369 | 1369 | ||
1370 | #ifdef CONFIG_CMD_MEMTEST | 1370 | #ifdef CONFIG_CMD_MEMTEST |
1371 | U_BOOT_CMD( | 1371 | U_BOOT_CMD( |
1372 | mtest, 5, 1, do_mem_mtest, | 1372 | mtest, 5, 1, do_mem_mtest, |
1373 | "simple RAM read/write test", | 1373 | "simple RAM read/write test", |
1374 | "[start [end [pattern [iterations]]]]" | 1374 | "[start [end [pattern [iterations]]]]" |
1375 | ); | 1375 | ); |
1376 | #endif /* CONFIG_CMD_MEMTEST */ | 1376 | #endif /* CONFIG_CMD_MEMTEST */ |
1377 | 1377 | ||
1378 | #ifdef CONFIG_MX_CYCLIC | 1378 | #ifdef CONFIG_MX_CYCLIC |
1379 | U_BOOT_CMD( | 1379 | U_BOOT_CMD( |
1380 | mdc, 4, 1, do_mem_mdc, | 1380 | mdc, 4, 1, do_mem_mdc, |
1381 | "memory display cyclic", | 1381 | "memory display cyclic", |
1382 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 1382 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
1383 | "[.b, .w, .l, .q] address count delay(ms)" | 1383 | "[.b, .w, .l, .q] address count delay(ms)" |
1384 | #else | 1384 | #else |
1385 | "[.b, .w, .l] address count delay(ms)" | 1385 | "[.b, .w, .l] address count delay(ms)" |
1386 | #endif | 1386 | #endif |
1387 | ); | 1387 | ); |
1388 | 1388 | ||
1389 | U_BOOT_CMD( | 1389 | U_BOOT_CMD( |
1390 | mwc, 4, 1, do_mem_mwc, | 1390 | mwc, 4, 1, do_mem_mwc, |
1391 | "memory write cyclic", | 1391 | "memory write cyclic", |
1392 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA | 1392 | #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA |
1393 | "[.b, .w, .l, .q] address value delay(ms)" | 1393 | "[.b, .w, .l, .q] address value delay(ms)" |
1394 | #else | 1394 | #else |
1395 | "[.b, .w, .l] address value delay(ms)" | 1395 | "[.b, .w, .l] address value delay(ms)" |
1396 | #endif | 1396 | #endif |
1397 | ); | 1397 | ); |
1398 | #endif /* CONFIG_MX_CYCLIC */ | 1398 | #endif /* CONFIG_MX_CYCLIC */ |
1399 | 1399 | ||
1400 | #ifdef CONFIG_CMD_MEMINFO | 1400 | #ifdef CONFIG_CMD_MEMINFO |
1401 | U_BOOT_CMD( | 1401 | U_BOOT_CMD( |
1402 | meminfo, 3, 1, do_mem_info, | 1402 | meminfo, 3, 1, do_mem_info, |
1403 | "display memory information", | 1403 | "display memory information", |
1404 | "" | 1404 | "" |
1405 | ); | 1405 | ); |
1406 | #endif | 1406 | #endif |
1407 | 1407 |
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86
-
mentioned in commit 321f86