1 // SPDX-License-Identifier: GPL-2.0+
15 #include <bootretry.h>
26 #include <linux/compiler.h>
27 #include <linux/delay.h>
29 DECLARE_GLOBAL_DATA_PTR;
31 #ifndef CONFIG_SYS_MEMTEST_SCRATCH
32 #define CONFIG_SYS_MEMTEST_SCRATCH 0
35 static int mod_mem(struct cmd_tbl *, int, int, int, char * const []);
37 /* Display values from last command.
38 * Memory modify remembered values are different from display memory.
40 static ulong dp_last_addr, dp_last_size;
41 static ulong dp_last_length = 0x40;
42 static ulong mm_last_addr, mm_last_size;
44 static ulong base_address = 0;
49 * md{.b, .w, .l, .q} {addr} {len}
51 #define DISP_LINE_LEN 16
52 static int do_mem_md(struct cmd_tbl *cmdtp, int flag, int argc,
55 ulong addr, length, bytes;
60 /* We use the last specified parameters, unless new ones are
65 length = dp_last_length;
70 if ((flag & CMD_FLAG_REPEAT) == 0) {
71 /* New command specified. Check for a size specification.
72 * Defaults to long if no or incorrect specification.
74 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
77 /* Address is specified since argc > 1
79 addr = simple_strtoul(argv[1], NULL, 16);
82 /* If another parameter, it is the length to display.
83 * Length is the number of objects, not number of bytes.
86 length = simple_strtoul(argv[2], NULL, 16);
89 bytes = size * length;
90 buf = map_sysmem(addr, bytes);
92 /* Print the lines. */
93 print_buffer(addr, buf, size, length, DISP_LINE_LEN / size);
98 dp_last_length = length;
103 static int do_mem_mm(struct cmd_tbl *cmdtp, int flag, int argc,
106 return mod_mem (cmdtp, 1, flag, argc, argv);
109 static int do_mem_nm(struct cmd_tbl *cmdtp, int flag, int argc,
112 return mod_mem (cmdtp, 0, flag, argc, argv);
115 static int do_mem_mw(struct cmd_tbl *cmdtp, int flag, int argc,
118 #ifdef MEM_SUPPORT_64BIT_DATA
128 if ((argc < 3) || (argc > 4))
129 return CMD_RET_USAGE;
131 /* Check for size specification.
133 if ((size = cmd_get_data_size(argv[0], 4)) < 1)
136 /* Address is specified since argc > 1
138 addr = simple_strtoul(argv[1], NULL, 16);
139 addr += base_address;
141 /* Get the value to write.
143 #ifdef MEM_SUPPORT_64BIT_DATA
144 writeval = simple_strtoull(argv[2], NULL, 16);
146 writeval = simple_strtoul(argv[2], NULL, 16);
151 count = simple_strtoul(argv[3], NULL, 16);
156 bytes = size * count;
157 start = map_sysmem(addr, bytes);
159 while (count-- > 0) {
161 *((u32 *)buf) = (u32)writeval;
162 #ifdef MEM_SUPPORT_64BIT_DATA
164 *((u64 *)buf) = (u64)writeval;
167 *((u16 *)buf) = (u16)writeval;
169 *((u8 *)buf) = (u8)writeval;
176 #ifdef CONFIG_CMD_MX_CYCLIC
177 static int do_mem_mdc(struct cmd_tbl *cmdtp, int flag, int argc,
184 return CMD_RET_USAGE;
186 count = simple_strtoul(argv[3], NULL, 10);
189 do_mem_md (NULL, 0, 3, argv);
191 /* delay for <count> ms... */
192 for (i=0; i<count; i++)
195 /* check for ctrl-c to abort... */
205 static int do_mem_mwc(struct cmd_tbl *cmdtp, int flag, int argc,
212 return CMD_RET_USAGE;
214 count = simple_strtoul(argv[3], NULL, 10);
217 do_mem_mw (NULL, 0, 3, argv);
219 /* delay for <count> ms... */
220 for (i=0; i<count; i++)
223 /* check for ctrl-c to abort... */
232 #endif /* CONFIG_CMD_MX_CYCLIC */
234 static int do_mem_cmp(struct cmd_tbl *cmdtp, int flag, int argc,
237 ulong addr1, addr2, count, ngood, bytes;
241 const void *buf1, *buf2, *base;
242 #ifdef MEM_SUPPORT_64BIT_DATA
249 return CMD_RET_USAGE;
251 /* Check for size specification.
253 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
255 type = size == 8 ? "double word" :
257 size == 2 ? "halfword" : "byte";
259 addr1 = simple_strtoul(argv[1], NULL, 16);
260 addr1 += base_address;
262 addr2 = simple_strtoul(argv[2], NULL, 16);
263 addr2 += base_address;
265 count = simple_strtoul(argv[3], NULL, 16);
267 bytes = size * count;
268 base = buf1 = map_sysmem(addr1, bytes);
269 buf2 = map_sysmem(addr2, bytes);
270 for (ngood = 0; ngood < count; ++ngood) {
272 word1 = *(u32 *)buf1;
273 word2 = *(u32 *)buf2;
274 #ifdef MEM_SUPPORT_64BIT_DATA
275 } else if (size == 8) {
276 word1 = *(u64 *)buf1;
277 word2 = *(u64 *)buf2;
279 } else if (size == 2) {
280 word1 = *(u16 *)buf1;
281 word2 = *(u16 *)buf2;
286 if (word1 != word2) {
287 ulong offset = buf1 - base;
288 #ifdef MEM_SUPPORT_64BIT_DATA
289 printf("%s at 0x%p (%#0*llx) != %s at 0x%p (%#0*llx)\n",
290 type, (void *)(addr1 + offset), size, word1,
291 type, (void *)(addr2 + offset), size, word2);
293 printf("%s at 0x%08lx (%#0*lx) != %s at 0x%08lx (%#0*lx)\n",
294 type, (ulong)(addr1 + offset), size, word1,
295 type, (ulong)(addr2 + offset), size, word2);
304 /* reset watchdog from time to time */
305 if ((ngood % (64 << 10)) == 0)
311 printf("Total of %ld %s(s) were the same\n", ngood, type);
315 static int do_mem_cp(struct cmd_tbl *cmdtp, int flag, int argc,
318 ulong addr, dest, count;
323 return CMD_RET_USAGE;
325 /* Check for size specification.
327 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
330 addr = simple_strtoul(argv[1], NULL, 16);
331 addr += base_address;
333 dest = simple_strtoul(argv[2], NULL, 16);
334 dest += base_address;
336 count = simple_strtoul(argv[3], NULL, 16);
339 puts ("Zero length ???\n");
343 src = map_sysmem(addr, count * size);
344 dst = map_sysmem(dest, count * size);
346 #ifdef CONFIG_MTD_NOR_FLASH
347 /* check if we are copying to Flash */
348 if (addr2info((ulong)dst)) {
351 puts ("Copy to Flash... ");
353 rc = flash_write((char *)src, (ulong)dst, count * size);
367 memcpy(dst, src, count * size);
374 static int do_mem_base(struct cmd_tbl *cmdtp, int flag, int argc,
378 /* Set new base address.
380 base_address = simple_strtoul(argv[1], NULL, 16);
382 /* Print the current base address.
384 printf("Base Address: 0x%08lx\n", base_address);
388 static int do_mem_loop(struct cmd_tbl *cmdtp, int flag, int argc,
391 ulong addr, length, i, bytes;
393 #ifdef MEM_SUPPORT_64BIT_DATA
397 volatile u16 *shortp;
402 return CMD_RET_USAGE;
405 * Check for a size specification.
406 * Defaults to long if no or incorrect specification.
408 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
411 /* Address is always specified.
413 addr = simple_strtoul(argv[1], NULL, 16);
415 /* Length is the number of objects, not number of bytes.
417 length = simple_strtoul(argv[2], NULL, 16);
419 bytes = size * length;
420 buf = map_sysmem(addr, bytes);
422 /* We want to optimize the loops to run as fast as possible.
423 * If we have only one object, just run infinite loops.
426 #ifdef MEM_SUPPORT_64BIT_DATA
448 #ifdef MEM_SUPPORT_64BIT_DATA
486 static int do_mem_loopw(struct cmd_tbl *cmdtp, int flag, int argc,
489 ulong addr, length, i, bytes;
491 #ifdef MEM_SUPPORT_64BIT_DATA
498 volatile u16 *shortp;
503 return CMD_RET_USAGE;
506 * Check for a size specification.
507 * Defaults to long if no or incorrect specification.
509 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
512 /* Address is always specified.
514 addr = simple_strtoul(argv[1], NULL, 16);
516 /* Length is the number of objects, not number of bytes.
518 length = simple_strtoul(argv[2], NULL, 16);
521 #ifdef MEM_SUPPORT_64BIT_DATA
522 data = simple_strtoull(argv[3], NULL, 16);
524 data = simple_strtoul(argv[3], NULL, 16);
527 bytes = size * length;
528 buf = map_sysmem(addr, bytes);
530 /* We want to optimize the loops to run as fast as possible.
531 * If we have only one object, just run infinite loops.
534 #ifdef MEM_SUPPORT_64BIT_DATA
556 #ifdef MEM_SUPPORT_64BIT_DATA
589 #endif /* CONFIG_LOOPW */
591 #ifdef CONFIG_CMD_MEMTEST
592 static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
603 vu_long anti_pattern;
605 static const ulong bitpattern[] = {
606 0x00000001, /* single bit */
607 0x00000003, /* two adjacent bits */
608 0x00000007, /* three adjacent bits */
609 0x0000000F, /* four adjacent bits */
610 0x00000005, /* two non-adjacent bits */
611 0x00000015, /* three non-adjacent bits */
612 0x00000055, /* four non-adjacent bits */
613 0xaaaaaaaa, /* alternating 1/0 */
616 num_words = (end_addr - start_addr) / sizeof(vu_long);
619 * Data line test: write a pattern to the first
620 * location, write the 1's complement to a 'parking'
621 * address (changes the state of the data bus so a
622 * floating bus doesn't give a false OK), and then
623 * read the value back. Note that we read it back
624 * into a variable because the next time we read it,
625 * it might be right (been there, tough to explain to
626 * the quality guys why it prints a failure when the
627 * "is" and "should be" are obviously the same in the
630 * Rather than exhaustively testing, we test some
631 * patterns by shifting '1' bits through a field of
632 * '0's and '0' bits through a field of '1's (i.e.
633 * pattern and ~pattern).
636 for (j = 0; j < sizeof(bitpattern) / sizeof(bitpattern[0]); j++) {
638 for (; val != 0; val <<= 1) {
640 *dummy = ~val; /* clear the test data off the bus */
642 if (readback != val) {
643 printf("FAILURE (data line): "
644 "expected %08lx, actual %08lx\n",
653 if (readback != ~val) {
654 printf("FAILURE (data line): "
655 "Is %08lx, should be %08lx\n",
665 * Based on code whose Original Author and Copyright
666 * information follows: Copyright (c) 1998 by Michael
667 * Barr. This software is placed into the public
668 * domain and may be used for any purpose. However,
669 * this notice must not be changed or removed and no
670 * warranty is either expressed or implied by its
671 * publication or distribution.
677 * Description: Test the address bus wiring in a
678 * memory region by performing a walking
679 * 1's test on the relevant bits of the
680 * address and checking for aliasing.
681 * This test will find single-bit
682 * address failures such as stuck-high,
683 * stuck-low, and shorted pins. The base
684 * address and size of the region are
685 * selected by the caller.
687 * Notes: For best results, the selected base
688 * address should have enough LSB 0's to
689 * guarantee single address bit changes.
690 * For example, to test a 64-Kbyte
691 * region, select a base address on a
692 * 64-Kbyte boundary. Also, select the
693 * region size as a power-of-two if at
696 * Returns: 0 if the test succeeds, 1 if the test fails.
698 pattern = (vu_long) 0xaaaaaaaa;
699 anti_pattern = (vu_long) 0x55555555;
701 debug("%s:%d: length = 0x%.8lx\n", __func__, __LINE__, num_words);
703 * Write the default pattern at each of the
704 * power-of-two offsets.
706 for (offset = 1; offset < num_words; offset <<= 1)
707 addr[offset] = pattern;
710 * Check for address bits stuck high.
713 addr[test_offset] = anti_pattern;
715 for (offset = 1; offset < num_words; offset <<= 1) {
717 if (temp != pattern) {
718 printf("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
719 " expected 0x%.8lx, actual 0x%.8lx\n",
720 start_addr + offset*sizeof(vu_long),
727 addr[test_offset] = pattern;
731 * Check for addr bits stuck low or shorted.
733 for (test_offset = 1; test_offset < num_words; test_offset <<= 1) {
734 addr[test_offset] = anti_pattern;
736 for (offset = 1; offset < num_words; offset <<= 1) {
738 if ((temp != pattern) && (offset != test_offset)) {
739 printf("\nFAILURE: Address bit stuck low or"
740 " shorted @ 0x%.8lx: expected 0x%.8lx,"
742 start_addr + offset*sizeof(vu_long),
749 addr[test_offset] = pattern;
753 * Description: Test the integrity of a physical
754 * memory device by performing an
755 * increment/decrement test over the
756 * entire region. In the process every
757 * storage bit in the device is tested
758 * as a zero and a one. The base address
759 * and the size of the region are
760 * selected by the caller.
762 * Returns: 0 if the test succeeds, 1 if the test fails.
767 * Fill memory with a known pattern.
769 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
771 addr[offset] = pattern;
775 * Check each location and invert it for the second pass.
777 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
780 if (temp != pattern) {
781 printf("\nFAILURE (read/write) @ 0x%.8lx:"
782 " expected 0x%.8lx, actual 0x%.8lx)\n",
783 start_addr + offset*sizeof(vu_long),
790 anti_pattern = ~pattern;
791 addr[offset] = anti_pattern;
795 * Check each location for the inverted pattern and zero it.
797 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
799 anti_pattern = ~pattern;
801 if (temp != anti_pattern) {
802 printf("\nFAILURE (read/write): @ 0x%.8lx:"
803 " expected 0x%.8lx, actual 0x%.8lx)\n",
804 start_addr + offset*sizeof(vu_long),
816 static int compare_regions(volatile unsigned long *bufa,
817 volatile unsigned long *bufb, size_t count)
819 volatile unsigned long *p1 = bufa;
820 volatile unsigned long *p2 = bufb;
824 for (i = 0; i < count; i++, p1++, p2++) {
826 printf("FAILURE: 0x%08lx != 0x%08lx (delta=0x%08lx -> bit %ld) at offset 0x%08lx\n",
827 (unsigned long)*p1, (unsigned long)*p2,
828 *p1 ^ *p2, __ffs(*p1 ^ *p2),
829 (unsigned long)(i * sizeof(unsigned long)));
837 static ulong test_bitflip_comparison(volatile unsigned long *bufa,
838 volatile unsigned long *bufb, size_t count)
840 volatile unsigned long *p1 = bufa;
841 volatile unsigned long *p2 = bufb;
848 max = sizeof(unsigned long) * 8;
849 for (k = 0; k < max; k++) {
850 q = 0x00000001L << k;
851 for (j = 0; j < 8; j++) {
854 p1 = (volatile unsigned long *)bufa;
855 p2 = (volatile unsigned long *)bufb;
856 for (i = 0; i < count; i++)
857 *p1++ = *p2++ = (i % 2) == 0 ? q : ~q;
859 errs += compare_regions(bufa, bufb, count);
869 static ulong mem_test_quick(vu_long *buf, ulong start_addr, ulong end_addr,
870 vu_long pattern, int iteration)
878 /* Alternate the pattern */
883 * Flip the pattern each time to make lots of zeros and
884 * then, the next time, lots of ones. We decrement
885 * the "negative" patterns and increment the "positive"
886 * patterns to preserve this feature.
888 if (pattern & 0x80000000)
889 pattern = -pattern; /* complement & increment */
893 length = (end_addr - start_addr) / sizeof(ulong);
895 printf("\rPattern %08lX Writing..."
897 "\b\b\b\b\b\b\b\b\b\b",
900 for (addr = buf, val = pattern; addr < end; addr++) {
908 for (addr = buf, val = pattern; addr < end; addr++) {
911 if (readback != val) {
912 ulong offset = addr - buf;
914 printf("\nMem error @ 0x%08X: "
915 "found %08lX, expected %08lX\n",
916 (uint)(uintptr_t)(start_addr + offset*sizeof(vu_long)),
929 * Perform a memory test. A more complete alternative test can be
930 * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until
931 * interrupted by ctrl-c or by a failure of one of the sub-tests.
933 static int do_mem_mtest(struct cmd_tbl *cmdtp, int flag, int argc,
937 vu_long scratch_space;
938 vu_long *buf, *dummy = &scratch_space;
939 ulong iteration_limit = 0;
941 ulong errs = 0; /* number of errors, or -1 if interrupted */
945 start = CONFIG_SYS_MEMTEST_START;
946 end = CONFIG_SYS_MEMTEST_END;
949 if (strict_strtoul(argv[1], 16, &start) < 0)
950 return CMD_RET_USAGE;
953 if (strict_strtoul(argv[2], 16, &end) < 0)
954 return CMD_RET_USAGE;
957 if (strict_strtoul(argv[3], 16, &pattern) < 0)
958 return CMD_RET_USAGE;
961 if (strict_strtoul(argv[4], 16, &iteration_limit) < 0)
962 return CMD_RET_USAGE;
965 printf("Refusing to do empty test\n");
969 printf("Testing %08lx ... %08lx:\n", start, end);
970 debug("%s:%d: start %#08lx end %#08lx\n", __func__, __LINE__,
973 buf = map_sysmem(start, end - start);
975 !iteration_limit || iteration < iteration_limit;
982 printf("Iteration: %6d\r", iteration + 1);
984 if (IS_ENABLED(CONFIG_SYS_ALT_MEMTEST)) {
985 errs = mem_test_alt(buf, start, end, dummy);
989 errs = test_bitflip_comparison(buf,
990 buf + (end - start) / 2,
992 sizeof(unsigned long));
994 errs = mem_test_quick(buf, start, end, pattern,
1002 unmap_sysmem((void *)buf);
1005 /* Memory test was aborted - write a newline to finish off */
1008 printf("Tested %d iteration(s) with %lu errors.\n", iteration, count);
1012 #endif /* CONFIG_CMD_MEMTEST */
1017 * mm{.b, .w, .l, .q} {addr}
1018 * nm{.b, .w, .l, .q} {addr}
1021 mod_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc,
1025 #ifdef MEM_SUPPORT_64BIT_DATA
1034 return CMD_RET_USAGE;
1036 bootretry_reset_cmd_timeout(); /* got a good command to get here */
1037 /* We use the last specified parameters, unless new ones are
1040 addr = mm_last_addr;
1041 size = mm_last_size;
1043 if ((flag & CMD_FLAG_REPEAT) == 0) {
1044 /* New command specified. Check for a size specification.
1045 * Defaults to long if no or incorrect specification.
1047 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
1050 /* Address is specified since argc > 1
1052 addr = simple_strtoul(argv[1], NULL, 16);
1053 addr += base_address;
1056 /* Print the address, followed by value. Then accept input for
1057 * the next value. A non-converted value exits.
1060 ptr = map_sysmem(addr, size);
1061 printf("%08lx:", addr);
1063 printf(" %08x", *((u32 *)ptr));
1064 #ifdef MEM_SUPPORT_64BIT_DATA
1066 printf(" %016llx", *((u64 *)ptr));
1069 printf(" %04x", *((u16 *)ptr));
1071 printf(" %02x", *((u8 *)ptr));
1073 nbytes = cli_readline(" ? ");
1074 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
1075 /* <CR> pressed as only input, don't modify current
1076 * location and move to next. "-" pressed will go back.
1079 addr += nbytes ? -size : size;
1081 /* good enough to not time out */
1082 bootretry_reset_cmd_timeout();
1084 #ifdef CONFIG_BOOT_RETRY_TIME
1085 else if (nbytes == -2) {
1086 break; /* timed out, exit the command */
1091 #ifdef MEM_SUPPORT_64BIT_DATA
1092 i = simple_strtoull(console_buffer, &endp, 16);
1094 i = simple_strtoul(console_buffer, &endp, 16);
1096 nbytes = endp - console_buffer;
1098 /* good enough to not time out
1100 bootretry_reset_cmd_timeout();
1103 #ifdef MEM_SUPPORT_64BIT_DATA
1119 mm_last_addr = addr;
1120 mm_last_size = size;
1124 #ifdef CONFIG_CMD_CRC32
1126 static int do_mem_crc(struct cmd_tbl *cmdtp, int flag, int argc,
1134 return CMD_RET_USAGE;
1138 #ifdef CONFIG_CRC32_VERIFY
1139 if (strcmp(*av, "-v") == 0) {
1140 flags |= HASH_FLAG_VERIFY | HASH_FLAG_ENV;
1146 return hash_command("crc32", flags, cmdtp, flag, ac, av);
1151 #ifdef CONFIG_CMD_RANDOM
1152 static int do_random(struct cmd_tbl *cmdtp, int flag, int argc,
1155 unsigned long addr, len;
1156 unsigned long seed; // NOT INITIALIZED ON PURPOSE
1157 unsigned int *buf, *start;
1158 unsigned char *buf8;
1161 if (argc < 3 || argc > 4)
1162 return CMD_RET_USAGE;
1164 len = simple_strtoul(argv[2], NULL, 16);
1165 addr = simple_strtoul(argv[1], NULL, 16);
1168 seed = simple_strtoul(argv[3], NULL, 16);
1170 printf("The seed cannot be 0. Using 0xDEADBEEF.\n");
1174 seed = get_timer(0) ^ rand();
1178 start = map_sysmem(addr, len);
1180 for (i = 0; i < (len / 4); i++)
1183 buf8 = (unsigned char *)buf;
1184 for (i = 0; i < (len % 4); i++)
1185 *buf8++ = rand() & 0xFF;
1187 unmap_sysmem(start);
1188 printf("%lu bytes filled with random data\n", len);
1190 return CMD_RET_SUCCESS;
1194 /**************************************************/
1196 md, 3, 1, do_mem_md,
1198 #ifdef MEM_SUPPORT_64BIT_DATA
1199 "[.b, .w, .l, .q] address [# of objects]"
1201 "[.b, .w, .l] address [# of objects]"
1207 mm, 2, 1, do_mem_mm,
1208 "memory modify (auto-incrementing address)",
1209 #ifdef MEM_SUPPORT_64BIT_DATA
1210 "[.b, .w, .l, .q] address"
1212 "[.b, .w, .l] address"
1218 nm, 2, 1, do_mem_nm,
1219 "memory modify (constant address)",
1220 #ifdef MEM_SUPPORT_64BIT_DATA
1221 "[.b, .w, .l, .q] address"
1223 "[.b, .w, .l] address"
1228 mw, 4, 1, do_mem_mw,
1229 "memory write (fill)",
1230 #ifdef MEM_SUPPORT_64BIT_DATA
1231 "[.b, .w, .l, .q] address value [count]"
1233 "[.b, .w, .l] address value [count]"
1238 cp, 4, 1, do_mem_cp,
1240 #ifdef MEM_SUPPORT_64BIT_DATA
1241 "[.b, .w, .l, .q] source target count"
1243 "[.b, .w, .l] source target count"
1248 cmp, 4, 1, do_mem_cmp,
1250 #ifdef MEM_SUPPORT_64BIT_DATA
1251 "[.b, .w, .l, .q] addr1 addr2 count"
1253 "[.b, .w, .l] addr1 addr2 count"
1257 #ifdef CONFIG_CMD_CRC32
1259 #ifndef CONFIG_CRC32_VERIFY
1262 crc32, 4, 1, do_mem_crc,
1263 "checksum calculation",
1264 "address count [addr]\n - compute CRC32 checksum [save at addr]"
1267 #else /* CONFIG_CRC32_VERIFY */
1270 crc32, 5, 1, do_mem_crc,
1271 "checksum calculation",
1272 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1273 "-v address count crc\n - verify crc of memory area"
1276 #endif /* CONFIG_CRC32_VERIFY */
1280 #ifdef CONFIG_CMD_MEMINFO
1281 static int do_mem_info(struct cmd_tbl *cmdtp, int flag, int argc,
1285 print_size(gd->ram_size, "\n");
1292 base, 2, 1, do_mem_base,
1293 "print or set address offset",
1294 "\n - print address offset for memory commands\n"
1295 "base off\n - set address offset for memory commands to 'off'"
1299 loop, 3, 1, do_mem_loop,
1300 "infinite loop on address range",
1301 #ifdef MEM_SUPPORT_64BIT_DATA
1302 "[.b, .w, .l, .q] address number_of_objects"
1304 "[.b, .w, .l] address number_of_objects"
1310 loopw, 4, 1, do_mem_loopw,
1311 "infinite write loop on address range",
1312 #ifdef MEM_SUPPORT_64BIT_DATA
1313 "[.b, .w, .l, .q] address number_of_objects data_to_write"
1315 "[.b, .w, .l] address number_of_objects data_to_write"
1318 #endif /* CONFIG_LOOPW */
1320 #ifdef CONFIG_CMD_MEMTEST
1322 mtest, 5, 1, do_mem_mtest,
1323 "simple RAM read/write test",
1324 "[start [end [pattern [iterations]]]]"
1326 #endif /* CONFIG_CMD_MEMTEST */
1328 #ifdef CONFIG_CMD_MX_CYCLIC
1330 mdc, 4, 1, do_mem_mdc,
1331 "memory display cyclic",
1332 #ifdef MEM_SUPPORT_64BIT_DATA
1333 "[.b, .w, .l, .q] address count delay(ms)"
1335 "[.b, .w, .l] address count delay(ms)"
1340 mwc, 4, 1, do_mem_mwc,
1341 "memory write cyclic",
1342 #ifdef MEM_SUPPORT_64BIT_DATA
1343 "[.b, .w, .l, .q] address value delay(ms)"
1345 "[.b, .w, .l] address value delay(ms)"
1348 #endif /* CONFIG_CMD_MX_CYCLIC */
1350 #ifdef CONFIG_CMD_MEMINFO
1352 meminfo, 3, 1, do_mem_info,
1353 "display memory information",
1358 #ifdef CONFIG_CMD_RANDOM
1360 random, 4, 0, do_random,
1361 "fill memory with random pattern",
1362 "<addr> <len> [<seed>]\n"
1363 " - Fill 'len' bytes of memory starting at 'addr' with random data\n"