1 // SPDX-License-Identifier: GPL-2.0+
15 #include <bootretry.h>
25 #include <linux/compiler.h>
27 DECLARE_GLOBAL_DATA_PTR;
29 #ifndef CONFIG_SYS_MEMTEST_SCRATCH
30 #define CONFIG_SYS_MEMTEST_SCRATCH 0
33 static int mod_mem(struct cmd_tbl *, int, int, int, char * const []);
35 /* Display values from last command.
36 * Memory modify remembered values are different from display memory.
38 static ulong dp_last_addr, dp_last_size;
39 static ulong dp_last_length = 0x40;
40 static ulong mm_last_addr, mm_last_size;
42 static ulong base_address = 0;
47 * md{.b, .w, .l, .q} {addr} {len}
49 #define DISP_LINE_LEN 16
50 static int do_mem_md(struct cmd_tbl *cmdtp, int flag, int argc,
53 ulong addr, length, bytes;
58 /* We use the last specified parameters, unless new ones are
63 length = dp_last_length;
68 if ((flag & CMD_FLAG_REPEAT) == 0) {
69 /* New command specified. Check for a size specification.
70 * Defaults to long if no or incorrect specification.
72 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
75 /* Address is specified since argc > 1
77 addr = simple_strtoul(argv[1], NULL, 16);
80 /* If another parameter, it is the length to display.
81 * Length is the number of objects, not number of bytes.
84 length = simple_strtoul(argv[2], NULL, 16);
87 bytes = size * length;
88 buf = map_sysmem(addr, bytes);
90 /* Print the lines. */
91 print_buffer(addr, buf, size, length, DISP_LINE_LEN / size);
96 dp_last_length = length;
101 static int do_mem_mm(struct cmd_tbl *cmdtp, int flag, int argc,
104 return mod_mem (cmdtp, 1, flag, argc, argv);
107 static int do_mem_nm(struct cmd_tbl *cmdtp, int flag, int argc,
110 return mod_mem (cmdtp, 0, flag, argc, argv);
113 static int do_mem_mw(struct cmd_tbl *cmdtp, int flag, int argc,
116 #ifdef MEM_SUPPORT_64BIT_DATA
126 if ((argc < 3) || (argc > 4))
127 return CMD_RET_USAGE;
129 /* Check for size specification.
131 if ((size = cmd_get_data_size(argv[0], 4)) < 1)
134 /* Address is specified since argc > 1
136 addr = simple_strtoul(argv[1], NULL, 16);
137 addr += base_address;
139 /* Get the value to write.
141 #ifdef MEM_SUPPORT_64BIT_DATA
142 writeval = simple_strtoull(argv[2], NULL, 16);
144 writeval = simple_strtoul(argv[2], NULL, 16);
149 count = simple_strtoul(argv[3], NULL, 16);
154 bytes = size * count;
155 start = map_sysmem(addr, bytes);
157 while (count-- > 0) {
159 *((u32 *)buf) = (u32)writeval;
160 #ifdef MEM_SUPPORT_64BIT_DATA
162 *((u64 *)buf) = (u64)writeval;
165 *((u16 *)buf) = (u16)writeval;
167 *((u8 *)buf) = (u8)writeval;
174 #ifdef CONFIG_CMD_MX_CYCLIC
175 static int do_mem_mdc(struct cmd_tbl *cmdtp, int flag, int argc,
182 return CMD_RET_USAGE;
184 count = simple_strtoul(argv[3], NULL, 10);
187 do_mem_md (NULL, 0, 3, argv);
189 /* delay for <count> ms... */
190 for (i=0; i<count; i++)
193 /* check for ctrl-c to abort... */
203 static int do_mem_mwc(struct cmd_tbl *cmdtp, int flag, int argc,
210 return CMD_RET_USAGE;
212 count = simple_strtoul(argv[3], NULL, 10);
215 do_mem_mw (NULL, 0, 3, argv);
217 /* delay for <count> ms... */
218 for (i=0; i<count; i++)
221 /* check for ctrl-c to abort... */
230 #endif /* CONFIG_CMD_MX_CYCLIC */
232 static int do_mem_cmp(struct cmd_tbl *cmdtp, int flag, int argc,
235 ulong addr1, addr2, count, ngood, bytes;
239 const void *buf1, *buf2, *base;
240 #ifdef MEM_SUPPORT_64BIT_DATA
247 return CMD_RET_USAGE;
249 /* Check for size specification.
251 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
253 type = size == 8 ? "double word" :
255 size == 2 ? "halfword" : "byte";
257 addr1 = simple_strtoul(argv[1], NULL, 16);
258 addr1 += base_address;
260 addr2 = simple_strtoul(argv[2], NULL, 16);
261 addr2 += base_address;
263 count = simple_strtoul(argv[3], NULL, 16);
265 bytes = size * count;
266 base = buf1 = map_sysmem(addr1, bytes);
267 buf2 = map_sysmem(addr2, bytes);
268 for (ngood = 0; ngood < count; ++ngood) {
270 word1 = *(u32 *)buf1;
271 word2 = *(u32 *)buf2;
272 #ifdef MEM_SUPPORT_64BIT_DATA
273 } else if (size == 8) {
274 word1 = *(u64 *)buf1;
275 word2 = *(u64 *)buf2;
277 } else if (size == 2) {
278 word1 = *(u16 *)buf1;
279 word2 = *(u16 *)buf2;
284 if (word1 != word2) {
285 ulong offset = buf1 - base;
286 #ifdef MEM_SUPPORT_64BIT_DATA
287 printf("%s at 0x%p (%#0*llx) != %s at 0x%p (%#0*llx)\n",
288 type, (void *)(addr1 + offset), size, word1,
289 type, (void *)(addr2 + offset), size, word2);
291 printf("%s at 0x%08lx (%#0*lx) != %s at 0x%08lx (%#0*lx)\n",
292 type, (ulong)(addr1 + offset), size, word1,
293 type, (ulong)(addr2 + offset), size, word2);
302 /* reset watchdog from time to time */
303 if ((ngood % (64 << 10)) == 0)
309 printf("Total of %ld %s(s) were the same\n", ngood, type);
313 static int do_mem_cp(struct cmd_tbl *cmdtp, int flag, int argc,
316 ulong addr, dest, count;
321 return CMD_RET_USAGE;
323 /* Check for size specification.
325 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
328 addr = simple_strtoul(argv[1], NULL, 16);
329 addr += base_address;
331 dest = simple_strtoul(argv[2], NULL, 16);
332 dest += base_address;
334 count = simple_strtoul(argv[3], NULL, 16);
337 puts ("Zero length ???\n");
341 src = map_sysmem(addr, count * size);
342 dst = map_sysmem(dest, count * size);
344 #ifdef CONFIG_MTD_NOR_FLASH
345 /* check if we are copying to Flash */
346 if (addr2info((ulong)dst)) {
349 puts ("Copy to Flash... ");
351 rc = flash_write((char *)src, (ulong)dst, count * size);
365 memcpy(dst, src, count * size);
372 static int do_mem_base(struct cmd_tbl *cmdtp, int flag, int argc,
376 /* Set new base address.
378 base_address = simple_strtoul(argv[1], NULL, 16);
380 /* Print the current base address.
382 printf("Base Address: 0x%08lx\n", base_address);
386 static int do_mem_loop(struct cmd_tbl *cmdtp, int flag, int argc,
389 ulong addr, length, i, bytes;
391 #ifdef MEM_SUPPORT_64BIT_DATA
395 volatile u16 *shortp;
400 return CMD_RET_USAGE;
403 * Check for a size specification.
404 * Defaults to long if no or incorrect specification.
406 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
409 /* Address is always specified.
411 addr = simple_strtoul(argv[1], NULL, 16);
413 /* Length is the number of objects, not number of bytes.
415 length = simple_strtoul(argv[2], NULL, 16);
417 bytes = size * length;
418 buf = map_sysmem(addr, bytes);
420 /* We want to optimize the loops to run as fast as possible.
421 * If we have only one object, just run infinite loops.
424 #ifdef MEM_SUPPORT_64BIT_DATA
446 #ifdef MEM_SUPPORT_64BIT_DATA
484 static int do_mem_loopw(struct cmd_tbl *cmdtp, int flag, int argc,
487 ulong addr, length, i, bytes;
489 #ifdef MEM_SUPPORT_64BIT_DATA
496 volatile u16 *shortp;
501 return CMD_RET_USAGE;
504 * Check for a size specification.
505 * Defaults to long if no or incorrect specification.
507 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
510 /* Address is always specified.
512 addr = simple_strtoul(argv[1], NULL, 16);
514 /* Length is the number of objects, not number of bytes.
516 length = simple_strtoul(argv[2], NULL, 16);
519 #ifdef MEM_SUPPORT_64BIT_DATA
520 data = simple_strtoull(argv[3], NULL, 16);
522 data = simple_strtoul(argv[3], NULL, 16);
525 bytes = size * length;
526 buf = map_sysmem(addr, bytes);
528 /* We want to optimize the loops to run as fast as possible.
529 * If we have only one object, just run infinite loops.
532 #ifdef MEM_SUPPORT_64BIT_DATA
554 #ifdef MEM_SUPPORT_64BIT_DATA
587 #endif /* CONFIG_LOOPW */
589 #ifdef CONFIG_CMD_MEMTEST
590 static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
601 vu_long anti_pattern;
603 static const ulong bitpattern[] = {
604 0x00000001, /* single bit */
605 0x00000003, /* two adjacent bits */
606 0x00000007, /* three adjacent bits */
607 0x0000000F, /* four adjacent bits */
608 0x00000005, /* two non-adjacent bits */
609 0x00000015, /* three non-adjacent bits */
610 0x00000055, /* four non-adjacent bits */
611 0xaaaaaaaa, /* alternating 1/0 */
614 num_words = (end_addr - start_addr) / sizeof(vu_long);
617 * Data line test: write a pattern to the first
618 * location, write the 1's complement to a 'parking'
619 * address (changes the state of the data bus so a
620 * floating bus doesn't give a false OK), and then
621 * read the value back. Note that we read it back
622 * into a variable because the next time we read it,
623 * it might be right (been there, tough to explain to
624 * the quality guys why it prints a failure when the
625 * "is" and "should be" are obviously the same in the
628 * Rather than exhaustively testing, we test some
629 * patterns by shifting '1' bits through a field of
630 * '0's and '0' bits through a field of '1's (i.e.
631 * pattern and ~pattern).
634 for (j = 0; j < sizeof(bitpattern) / sizeof(bitpattern[0]); j++) {
636 for (; val != 0; val <<= 1) {
638 *dummy = ~val; /* clear the test data off the bus */
640 if (readback != val) {
641 printf("FAILURE (data line): "
642 "expected %08lx, actual %08lx\n",
651 if (readback != ~val) {
652 printf("FAILURE (data line): "
653 "Is %08lx, should be %08lx\n",
663 * Based on code whose Original Author and Copyright
664 * information follows: Copyright (c) 1998 by Michael
665 * Barr. This software is placed into the public
666 * domain and may be used for any purpose. However,
667 * this notice must not be changed or removed and no
668 * warranty is either expressed or implied by its
669 * publication or distribution.
675 * Description: Test the address bus wiring in a
676 * memory region by performing a walking
677 * 1's test on the relevant bits of the
678 * address and checking for aliasing.
679 * This test will find single-bit
680 * address failures such as stuck-high,
681 * stuck-low, and shorted pins. The base
682 * address and size of the region are
683 * selected by the caller.
685 * Notes: For best results, the selected base
686 * address should have enough LSB 0's to
687 * guarantee single address bit changes.
688 * For example, to test a 64-Kbyte
689 * region, select a base address on a
690 * 64-Kbyte boundary. Also, select the
691 * region size as a power-of-two if at
694 * Returns: 0 if the test succeeds, 1 if the test fails.
696 pattern = (vu_long) 0xaaaaaaaa;
697 anti_pattern = (vu_long) 0x55555555;
699 debug("%s:%d: length = 0x%.8lx\n", __func__, __LINE__, num_words);
701 * Write the default pattern at each of the
702 * power-of-two offsets.
704 for (offset = 1; offset < num_words; offset <<= 1)
705 addr[offset] = pattern;
708 * Check for address bits stuck high.
711 addr[test_offset] = anti_pattern;
713 for (offset = 1; offset < num_words; offset <<= 1) {
715 if (temp != pattern) {
716 printf("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
717 " expected 0x%.8lx, actual 0x%.8lx\n",
718 start_addr + offset*sizeof(vu_long),
725 addr[test_offset] = pattern;
729 * Check for addr bits stuck low or shorted.
731 for (test_offset = 1; test_offset < num_words; test_offset <<= 1) {
732 addr[test_offset] = anti_pattern;
734 for (offset = 1; offset < num_words; offset <<= 1) {
736 if ((temp != pattern) && (offset != test_offset)) {
737 printf("\nFAILURE: Address bit stuck low or"
738 " shorted @ 0x%.8lx: expected 0x%.8lx,"
740 start_addr + offset*sizeof(vu_long),
747 addr[test_offset] = pattern;
751 * Description: Test the integrity of a physical
752 * memory device by performing an
753 * increment/decrement test over the
754 * entire region. In the process every
755 * storage bit in the device is tested
756 * as a zero and a one. The base address
757 * and the size of the region are
758 * selected by the caller.
760 * Returns: 0 if the test succeeds, 1 if the test fails.
765 * Fill memory with a known pattern.
767 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
769 addr[offset] = pattern;
773 * Check each location and invert it for the second pass.
775 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
778 if (temp != pattern) {
779 printf("\nFAILURE (read/write) @ 0x%.8lx:"
780 " expected 0x%.8lx, actual 0x%.8lx)\n",
781 start_addr + offset*sizeof(vu_long),
788 anti_pattern = ~pattern;
789 addr[offset] = anti_pattern;
793 * Check each location for the inverted pattern and zero it.
795 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
797 anti_pattern = ~pattern;
799 if (temp != anti_pattern) {
800 printf("\nFAILURE (read/write): @ 0x%.8lx:"
801 " expected 0x%.8lx, actual 0x%.8lx)\n",
802 start_addr + offset*sizeof(vu_long),
814 static int compare_regions(volatile unsigned long *bufa,
815 volatile unsigned long *bufb, size_t count)
817 volatile unsigned long *p1 = bufa;
818 volatile unsigned long *p2 = bufb;
822 for (i = 0; i < count; i++, p1++, p2++) {
824 printf("FAILURE: 0x%08lx != 0x%08lx (delta=0x%08lx -> bit %ld) at offset 0x%08lx\n",
825 (unsigned long)*p1, (unsigned long)*p2,
826 *p1 ^ *p2, __ffs(*p1 ^ *p2),
827 (unsigned long)(i * sizeof(unsigned long)));
835 static ulong test_bitflip_comparison(volatile unsigned long *bufa,
836 volatile unsigned long *bufb, size_t count)
838 volatile unsigned long *p1 = bufa;
839 volatile unsigned long *p2 = bufb;
846 max = sizeof(unsigned long) * 8;
847 for (k = 0; k < max; k++) {
848 q = 0x00000001L << k;
849 for (j = 0; j < 8; j++) {
852 p1 = (volatile unsigned long *)bufa;
853 p2 = (volatile unsigned long *)bufb;
854 for (i = 0; i < count; i++)
855 *p1++ = *p2++ = (i % 2) == 0 ? q : ~q;
857 errs += compare_regions(bufa, bufb, count);
867 static ulong mem_test_quick(vu_long *buf, ulong start_addr, ulong end_addr,
868 vu_long pattern, int iteration)
876 /* Alternate the pattern */
881 * Flip the pattern each time to make lots of zeros and
882 * then, the next time, lots of ones. We decrement
883 * the "negative" patterns and increment the "positive"
884 * patterns to preserve this feature.
886 if (pattern & 0x80000000)
887 pattern = -pattern; /* complement & increment */
891 length = (end_addr - start_addr) / sizeof(ulong);
893 printf("\rPattern %08lX Writing..."
895 "\b\b\b\b\b\b\b\b\b\b",
898 for (addr = buf, val = pattern; addr < end; addr++) {
906 for (addr = buf, val = pattern; addr < end; addr++) {
909 if (readback != val) {
910 ulong offset = addr - buf;
912 printf("\nMem error @ 0x%08X: "
913 "found %08lX, expected %08lX\n",
914 (uint)(uintptr_t)(start_addr + offset*sizeof(vu_long)),
927 * Perform a memory test. A more complete alternative test can be
928 * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until
929 * interrupted by ctrl-c or by a failure of one of the sub-tests.
931 static int do_mem_mtest(struct cmd_tbl *cmdtp, int flag, int argc,
935 vu_long scratch_space;
936 vu_long *buf, *dummy = &scratch_space;
937 ulong iteration_limit = 0;
939 ulong errs = 0; /* number of errors, or -1 if interrupted */
943 start = CONFIG_SYS_MEMTEST_START;
944 end = CONFIG_SYS_MEMTEST_END;
947 if (strict_strtoul(argv[1], 16, &start) < 0)
948 return CMD_RET_USAGE;
951 if (strict_strtoul(argv[2], 16, &end) < 0)
952 return CMD_RET_USAGE;
955 if (strict_strtoul(argv[3], 16, &pattern) < 0)
956 return CMD_RET_USAGE;
959 if (strict_strtoul(argv[4], 16, &iteration_limit) < 0)
960 return CMD_RET_USAGE;
963 printf("Refusing to do empty test\n");
967 printf("Testing %08lx ... %08lx:\n", start, end);
968 debug("%s:%d: start %#08lx end %#08lx\n", __func__, __LINE__,
971 buf = map_sysmem(start, end - start);
973 !iteration_limit || iteration < iteration_limit;
980 printf("Iteration: %6d\r", iteration + 1);
982 if (IS_ENABLED(CONFIG_SYS_ALT_MEMTEST)) {
983 errs = mem_test_alt(buf, start, end, dummy);
987 errs = test_bitflip_comparison(buf,
988 buf + (end - start) / 2,
990 sizeof(unsigned long));
992 errs = mem_test_quick(buf, start, end, pattern,
1000 unmap_sysmem((void *)buf);
1003 /* Memory test was aborted - write a newline to finish off */
1006 printf("Tested %d iteration(s) with %lu errors.\n", iteration, count);
1010 #endif /* CONFIG_CMD_MEMTEST */
1015 * mm{.b, .w, .l, .q} {addr}
1016 * nm{.b, .w, .l, .q} {addr}
1019 mod_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc,
1023 #ifdef MEM_SUPPORT_64BIT_DATA
1032 return CMD_RET_USAGE;
1034 bootretry_reset_cmd_timeout(); /* got a good command to get here */
1035 /* We use the last specified parameters, unless new ones are
1038 addr = mm_last_addr;
1039 size = mm_last_size;
1041 if ((flag & CMD_FLAG_REPEAT) == 0) {
1042 /* New command specified. Check for a size specification.
1043 * Defaults to long if no or incorrect specification.
1045 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
1048 /* Address is specified since argc > 1
1050 addr = simple_strtoul(argv[1], NULL, 16);
1051 addr += base_address;
1054 /* Print the address, followed by value. Then accept input for
1055 * the next value. A non-converted value exits.
1058 ptr = map_sysmem(addr, size);
1059 printf("%08lx:", addr);
1061 printf(" %08x", *((u32 *)ptr));
1062 #ifdef MEM_SUPPORT_64BIT_DATA
1064 printf(" %016llx", *((u64 *)ptr));
1067 printf(" %04x", *((u16 *)ptr));
1069 printf(" %02x", *((u8 *)ptr));
1071 nbytes = cli_readline(" ? ");
1072 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
1073 /* <CR> pressed as only input, don't modify current
1074 * location and move to next. "-" pressed will go back.
1077 addr += nbytes ? -size : size;
1079 /* good enough to not time out */
1080 bootretry_reset_cmd_timeout();
1082 #ifdef CONFIG_BOOT_RETRY_TIME
1083 else if (nbytes == -2) {
1084 break; /* timed out, exit the command */
1089 #ifdef MEM_SUPPORT_64BIT_DATA
1090 i = simple_strtoull(console_buffer, &endp, 16);
1092 i = simple_strtoul(console_buffer, &endp, 16);
1094 nbytes = endp - console_buffer;
1096 /* good enough to not time out
1098 bootretry_reset_cmd_timeout();
1101 #ifdef MEM_SUPPORT_64BIT_DATA
1117 mm_last_addr = addr;
1118 mm_last_size = size;
1122 #ifdef CONFIG_CMD_CRC32
1124 static int do_mem_crc(struct cmd_tbl *cmdtp, int flag, int argc,
1132 return CMD_RET_USAGE;
1136 #ifdef CONFIG_CRC32_VERIFY
1137 if (strcmp(*av, "-v") == 0) {
1138 flags |= HASH_FLAG_VERIFY | HASH_FLAG_ENV;
1144 return hash_command("crc32", flags, cmdtp, flag, ac, av);
1149 #ifdef CONFIG_CMD_RANDOM
1150 static int do_random(struct cmd_tbl *cmdtp, int flag, int argc,
1153 unsigned long addr, len;
1154 unsigned long seed; // NOT INITIALIZED ON PURPOSE
1155 unsigned int *buf, *start;
1156 unsigned char *buf8;
1159 if (argc < 3 || argc > 4)
1160 return CMD_RET_USAGE;
1162 len = simple_strtoul(argv[2], NULL, 16);
1163 addr = simple_strtoul(argv[1], NULL, 16);
1166 seed = simple_strtoul(argv[3], NULL, 16);
1168 printf("The seed cannot be 0. Using 0xDEADBEEF.\n");
1172 seed = get_timer(0) ^ rand();
1176 start = map_sysmem(addr, len);
1178 for (i = 0; i < (len / 4); i++)
1181 buf8 = (unsigned char *)buf;
1182 for (i = 0; i < (len % 4); i++)
1183 *buf8++ = rand() & 0xFF;
1185 unmap_sysmem(start);
1186 printf("%lu bytes filled with random data\n", len);
1188 return CMD_RET_SUCCESS;
1192 /**************************************************/
1194 md, 3, 1, do_mem_md,
1196 #ifdef MEM_SUPPORT_64BIT_DATA
1197 "[.b, .w, .l, .q] address [# of objects]"
1199 "[.b, .w, .l] address [# of objects]"
1205 mm, 2, 1, do_mem_mm,
1206 "memory modify (auto-incrementing address)",
1207 #ifdef MEM_SUPPORT_64BIT_DATA
1208 "[.b, .w, .l, .q] address"
1210 "[.b, .w, .l] address"
1216 nm, 2, 1, do_mem_nm,
1217 "memory modify (constant address)",
1218 #ifdef MEM_SUPPORT_64BIT_DATA
1219 "[.b, .w, .l, .q] address"
1221 "[.b, .w, .l] address"
1226 mw, 4, 1, do_mem_mw,
1227 "memory write (fill)",
1228 #ifdef MEM_SUPPORT_64BIT_DATA
1229 "[.b, .w, .l, .q] address value [count]"
1231 "[.b, .w, .l] address value [count]"
1236 cp, 4, 1, do_mem_cp,
1238 #ifdef MEM_SUPPORT_64BIT_DATA
1239 "[.b, .w, .l, .q] source target count"
1241 "[.b, .w, .l] source target count"
1246 cmp, 4, 1, do_mem_cmp,
1248 #ifdef MEM_SUPPORT_64BIT_DATA
1249 "[.b, .w, .l, .q] addr1 addr2 count"
1251 "[.b, .w, .l] addr1 addr2 count"
1255 #ifdef CONFIG_CMD_CRC32
1257 #ifndef CONFIG_CRC32_VERIFY
1260 crc32, 4, 1, do_mem_crc,
1261 "checksum calculation",
1262 "address count [addr]\n - compute CRC32 checksum [save at addr]"
1265 #else /* CONFIG_CRC32_VERIFY */
1268 crc32, 5, 1, do_mem_crc,
1269 "checksum calculation",
1270 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1271 "-v address count crc\n - verify crc of memory area"
1274 #endif /* CONFIG_CRC32_VERIFY */
1278 #ifdef CONFIG_CMD_MEMINFO
1279 static int do_mem_info(struct cmd_tbl *cmdtp, int flag, int argc,
1283 print_size(gd->ram_size, "\n");
1290 base, 2, 1, do_mem_base,
1291 "print or set address offset",
1292 "\n - print address offset for memory commands\n"
1293 "base off\n - set address offset for memory commands to 'off'"
1297 loop, 3, 1, do_mem_loop,
1298 "infinite loop on address range",
1299 #ifdef MEM_SUPPORT_64BIT_DATA
1300 "[.b, .w, .l, .q] address number_of_objects"
1302 "[.b, .w, .l] address number_of_objects"
1308 loopw, 4, 1, do_mem_loopw,
1309 "infinite write loop on address range",
1310 #ifdef MEM_SUPPORT_64BIT_DATA
1311 "[.b, .w, .l, .q] address number_of_objects data_to_write"
1313 "[.b, .w, .l] address number_of_objects data_to_write"
1316 #endif /* CONFIG_LOOPW */
1318 #ifdef CONFIG_CMD_MEMTEST
1320 mtest, 5, 1, do_mem_mtest,
1321 "simple RAM read/write test",
1322 "[start [end [pattern [iterations]]]]"
1324 #endif /* CONFIG_CMD_MEMTEST */
1326 #ifdef CONFIG_CMD_MX_CYCLIC
1328 mdc, 4, 1, do_mem_mdc,
1329 "memory display cyclic",
1330 #ifdef MEM_SUPPORT_64BIT_DATA
1331 "[.b, .w, .l, .q] address count delay(ms)"
1333 "[.b, .w, .l] address count delay(ms)"
1338 mwc, 4, 1, do_mem_mwc,
1339 "memory write cyclic",
1340 #ifdef MEM_SUPPORT_64BIT_DATA
1341 "[.b, .w, .l, .q] address value delay(ms)"
1343 "[.b, .w, .l] address value delay(ms)"
1346 #endif /* CONFIG_CMD_MX_CYCLIC */
1348 #ifdef CONFIG_CMD_MEMINFO
1350 meminfo, 3, 1, do_mem_info,
1351 "display memory information",
1356 #ifdef CONFIG_CMD_RANDOM
1358 random, 4, 0, do_random,
1359 "fill memory with random pattern",
1360 "<addr> <len> [<seed>]\n"
1361 " - Fill 'len' bytes of memory starting at 'addr' with random data\n"