1 // SPDX-License-Identifier: GPL-2.0+
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
10 * Copied from FADS ROM, Dan Malek (dmalek@jlc.net)
15 #include <bootretry.h>
25 #include <linux/compiler.h>
27 DECLARE_GLOBAL_DATA_PTR;
29 static int mod_mem(cmd_tbl_t *, int, int, int, char * const []);
31 /* Display values from last command.
32 * Memory modify remembered values are different from display memory.
34 static ulong dp_last_addr, dp_last_size;
35 static ulong dp_last_length = 0x40;
36 static ulong mm_last_addr, mm_last_size;
38 static ulong base_address = 0;
43 * md{.b, .w, .l, .q} {addr} {len}
45 #define DISP_LINE_LEN 16
46 static int do_mem_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
48 ulong addr, length, bytes;
53 /* We use the last specified parameters, unless new ones are
58 length = dp_last_length;
63 if ((flag & CMD_FLAG_REPEAT) == 0) {
64 /* New command specified. Check for a size specification.
65 * Defaults to long if no or incorrect specification.
67 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
70 /* Address is specified since argc > 1
72 addr = simple_strtoul(argv[1], NULL, 16);
75 /* If another parameter, it is the length to display.
76 * Length is the number of objects, not number of bytes.
79 length = simple_strtoul(argv[2], NULL, 16);
82 bytes = size * length;
83 buf = map_sysmem(addr, bytes);
85 /* Print the lines. */
86 print_buffer(addr, buf, size, length, DISP_LINE_LEN / size);
91 dp_last_length = length;
96 static int do_mem_mm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
98 return mod_mem (cmdtp, 1, flag, argc, argv);
100 static int do_mem_nm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
102 return mod_mem (cmdtp, 0, flag, argc, argv);
105 static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
107 #ifdef MEM_SUPPORT_64BIT_DATA
117 if ((argc < 3) || (argc > 4))
118 return CMD_RET_USAGE;
120 /* Check for size specification.
122 if ((size = cmd_get_data_size(argv[0], 4)) < 1)
125 /* Address is specified since argc > 1
127 addr = simple_strtoul(argv[1], NULL, 16);
128 addr += base_address;
130 /* Get the value to write.
132 #ifdef MEM_SUPPORT_64BIT_DATA
133 writeval = simple_strtoull(argv[2], NULL, 16);
135 writeval = simple_strtoul(argv[2], NULL, 16);
140 count = simple_strtoul(argv[3], NULL, 16);
145 bytes = size * count;
146 start = map_sysmem(addr, bytes);
148 while (count-- > 0) {
150 *((u32 *)buf) = (u32)writeval;
151 #ifdef MEM_SUPPORT_64BIT_DATA
153 *((u64 *)buf) = (u64)writeval;
156 *((u16 *)buf) = (u16)writeval;
158 *((u8 *)buf) = (u8)writeval;
165 #ifdef CONFIG_CMD_MX_CYCLIC
166 static int do_mem_mdc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
172 return CMD_RET_USAGE;
174 count = simple_strtoul(argv[3], NULL, 10);
177 do_mem_md (NULL, 0, 3, argv);
179 /* delay for <count> ms... */
180 for (i=0; i<count; i++)
183 /* check for ctrl-c to abort... */
193 static int do_mem_mwc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
199 return CMD_RET_USAGE;
201 count = simple_strtoul(argv[3], NULL, 10);
204 do_mem_mw (NULL, 0, 3, argv);
206 /* delay for <count> ms... */
207 for (i=0; i<count; i++)
210 /* check for ctrl-c to abort... */
219 #endif /* CONFIG_CMD_MX_CYCLIC */
221 static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
223 ulong addr1, addr2, count, ngood, bytes;
227 const void *buf1, *buf2, *base;
228 #ifdef MEM_SUPPORT_64BIT_DATA
235 return CMD_RET_USAGE;
237 /* Check for size specification.
239 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
241 type = size == 8 ? "double word" :
243 size == 2 ? "halfword" : "byte";
245 addr1 = simple_strtoul(argv[1], NULL, 16);
246 addr1 += base_address;
248 addr2 = simple_strtoul(argv[2], NULL, 16);
249 addr2 += base_address;
251 count = simple_strtoul(argv[3], NULL, 16);
253 bytes = size * count;
254 base = buf1 = map_sysmem(addr1, bytes);
255 buf2 = map_sysmem(addr2, bytes);
256 for (ngood = 0; ngood < count; ++ngood) {
258 word1 = *(u32 *)buf1;
259 word2 = *(u32 *)buf2;
260 #ifdef MEM_SUPPORT_64BIT_DATA
261 } else if (size == 8) {
262 word1 = *(u64 *)buf1;
263 word2 = *(u64 *)buf2;
265 } else if (size == 2) {
266 word1 = *(u16 *)buf1;
267 word2 = *(u16 *)buf2;
272 if (word1 != word2) {
273 ulong offset = buf1 - base;
274 #ifdef MEM_SUPPORT_64BIT_DATA
275 printf("%s at 0x%p (%#0*llx) != %s at 0x%p (%#0*llx)\n",
276 type, (void *)(addr1 + offset), size, word1,
277 type, (void *)(addr2 + offset), size, word2);
279 printf("%s at 0x%08lx (%#0*lx) != %s at 0x%08lx (%#0*lx)\n",
280 type, (ulong)(addr1 + offset), size, word1,
281 type, (ulong)(addr2 + offset), size, word2);
290 /* reset watchdog from time to time */
291 if ((ngood % (64 << 10)) == 0)
297 printf("Total of %ld %s(s) were the same\n", ngood, type);
301 static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
303 ulong addr, dest, count;
308 return CMD_RET_USAGE;
310 /* Check for size specification.
312 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
315 addr = simple_strtoul(argv[1], NULL, 16);
316 addr += base_address;
318 dest = simple_strtoul(argv[2], NULL, 16);
319 dest += base_address;
321 count = simple_strtoul(argv[3], NULL, 16);
324 puts ("Zero length ???\n");
328 src = map_sysmem(addr, count * size);
329 dst = map_sysmem(dest, count * size);
331 #ifdef CONFIG_MTD_NOR_FLASH
332 /* check if we are copying to Flash */
333 if (addr2info((ulong)dst)) {
336 puts ("Copy to Flash... ");
338 rc = flash_write((char *)src, (ulong)dst, count * size);
352 memcpy(dst, src, count * size);
359 static int do_mem_base(cmd_tbl_t *cmdtp, int flag, int argc,
363 /* Set new base address.
365 base_address = simple_strtoul(argv[1], NULL, 16);
367 /* Print the current base address.
369 printf("Base Address: 0x%08lx\n", base_address);
373 static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
376 ulong addr, length, i, bytes;
378 #ifdef MEM_SUPPORT_64BIT_DATA
382 volatile u16 *shortp;
387 return CMD_RET_USAGE;
390 * Check for a size specification.
391 * Defaults to long if no or incorrect specification.
393 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
396 /* Address is always specified.
398 addr = simple_strtoul(argv[1], NULL, 16);
400 /* Length is the number of objects, not number of bytes.
402 length = simple_strtoul(argv[2], NULL, 16);
404 bytes = size * length;
405 buf = map_sysmem(addr, bytes);
407 /* We want to optimize the loops to run as fast as possible.
408 * If we have only one object, just run infinite loops.
411 #ifdef MEM_SUPPORT_64BIT_DATA
433 #ifdef MEM_SUPPORT_64BIT_DATA
471 static int do_mem_loopw(cmd_tbl_t *cmdtp, int flag, int argc,
474 ulong addr, length, i, bytes;
476 #ifdef MEM_SUPPORT_64BIT_DATA
483 volatile u16 *shortp;
488 return CMD_RET_USAGE;
491 * Check for a size specification.
492 * Defaults to long if no or incorrect specification.
494 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
497 /* Address is always specified.
499 addr = simple_strtoul(argv[1], NULL, 16);
501 /* Length is the number of objects, not number of bytes.
503 length = simple_strtoul(argv[2], NULL, 16);
506 #ifdef MEM_SUPPORT_64BIT_DATA
507 data = simple_strtoull(argv[3], NULL, 16);
509 data = simple_strtoul(argv[3], NULL, 16);
512 bytes = size * length;
513 buf = map_sysmem(addr, bytes);
515 /* We want to optimize the loops to run as fast as possible.
516 * If we have only one object, just run infinite loops.
519 #ifdef MEM_SUPPORT_64BIT_DATA
541 #ifdef MEM_SUPPORT_64BIT_DATA
574 #endif /* CONFIG_LOOPW */
576 #ifdef CONFIG_CMD_MEMTEST
577 static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
588 vu_long anti_pattern;
590 static const ulong bitpattern[] = {
591 0x00000001, /* single bit */
592 0x00000003, /* two adjacent bits */
593 0x00000007, /* three adjacent bits */
594 0x0000000F, /* four adjacent bits */
595 0x00000005, /* two non-adjacent bits */
596 0x00000015, /* three non-adjacent bits */
597 0x00000055, /* four non-adjacent bits */
598 0xaaaaaaaa, /* alternating 1/0 */
601 num_words = (end_addr - start_addr) / sizeof(vu_long);
604 * Data line test: write a pattern to the first
605 * location, write the 1's complement to a 'parking'
606 * address (changes the state of the data bus so a
607 * floating bus doesn't give a false OK), and then
608 * read the value back. Note that we read it back
609 * into a variable because the next time we read it,
610 * it might be right (been there, tough to explain to
611 * the quality guys why it prints a failure when the
612 * "is" and "should be" are obviously the same in the
615 * Rather than exhaustively testing, we test some
616 * patterns by shifting '1' bits through a field of
617 * '0's and '0' bits through a field of '1's (i.e.
618 * pattern and ~pattern).
621 for (j = 0; j < sizeof(bitpattern) / sizeof(bitpattern[0]); j++) {
623 for (; val != 0; val <<= 1) {
625 *dummy = ~val; /* clear the test data off the bus */
627 if (readback != val) {
628 printf("FAILURE (data line): "
629 "expected %08lx, actual %08lx\n",
638 if (readback != ~val) {
639 printf("FAILURE (data line): "
640 "Is %08lx, should be %08lx\n",
650 * Based on code whose Original Author and Copyright
651 * information follows: Copyright (c) 1998 by Michael
652 * Barr. This software is placed into the public
653 * domain and may be used for any purpose. However,
654 * this notice must not be changed or removed and no
655 * warranty is either expressed or implied by its
656 * publication or distribution.
662 * Description: Test the address bus wiring in a
663 * memory region by performing a walking
664 * 1's test on the relevant bits of the
665 * address and checking for aliasing.
666 * This test will find single-bit
667 * address failures such as stuck-high,
668 * stuck-low, and shorted pins. The base
669 * address and size of the region are
670 * selected by the caller.
672 * Notes: For best results, the selected base
673 * address should have enough LSB 0's to
674 * guarantee single address bit changes.
675 * For example, to test a 64-Kbyte
676 * region, select a base address on a
677 * 64-Kbyte boundary. Also, select the
678 * region size as a power-of-two if at
681 * Returns: 0 if the test succeeds, 1 if the test fails.
683 pattern = (vu_long) 0xaaaaaaaa;
684 anti_pattern = (vu_long) 0x55555555;
686 debug("%s:%d: length = 0x%.8lx\n", __func__, __LINE__, num_words);
688 * Write the default pattern at each of the
689 * power-of-two offsets.
691 for (offset = 1; offset < num_words; offset <<= 1)
692 addr[offset] = pattern;
695 * Check for address bits stuck high.
698 addr[test_offset] = anti_pattern;
700 for (offset = 1; offset < num_words; offset <<= 1) {
702 if (temp != pattern) {
703 printf("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
704 " expected 0x%.8lx, actual 0x%.8lx\n",
705 start_addr + offset*sizeof(vu_long),
712 addr[test_offset] = pattern;
716 * Check for addr bits stuck low or shorted.
718 for (test_offset = 1; test_offset < num_words; test_offset <<= 1) {
719 addr[test_offset] = anti_pattern;
721 for (offset = 1; offset < num_words; offset <<= 1) {
723 if ((temp != pattern) && (offset != test_offset)) {
724 printf("\nFAILURE: Address bit stuck low or"
725 " shorted @ 0x%.8lx: expected 0x%.8lx,"
727 start_addr + offset*sizeof(vu_long),
734 addr[test_offset] = pattern;
738 * Description: Test the integrity of a physical
739 * memory device by performing an
740 * increment/decrement test over the
741 * entire region. In the process every
742 * storage bit in the device is tested
743 * as a zero and a one. The base address
744 * and the size of the region are
745 * selected by the caller.
747 * Returns: 0 if the test succeeds, 1 if the test fails.
752 * Fill memory with a known pattern.
754 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
756 addr[offset] = pattern;
760 * Check each location and invert it for the second pass.
762 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
765 if (temp != pattern) {
766 printf("\nFAILURE (read/write) @ 0x%.8lx:"
767 " expected 0x%.8lx, actual 0x%.8lx)\n",
768 start_addr + offset*sizeof(vu_long),
775 anti_pattern = ~pattern;
776 addr[offset] = anti_pattern;
780 * Check each location for the inverted pattern and zero it.
782 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
784 anti_pattern = ~pattern;
786 if (temp != anti_pattern) {
787 printf("\nFAILURE (read/write): @ 0x%.8lx:"
788 " expected 0x%.8lx, actual 0x%.8lx)\n",
789 start_addr + offset*sizeof(vu_long),
801 static int compare_regions(volatile unsigned long *bufa,
802 volatile unsigned long *bufb, size_t count)
804 volatile unsigned long *p1 = bufa;
805 volatile unsigned long *p2 = bufb;
809 for (i = 0; i < count; i++, p1++, p2++) {
811 printf("FAILURE: 0x%08lx != 0x%08lx (delta=0x%08lx -> bit %ld) at offset 0x%08lx\n",
812 (unsigned long)*p1, (unsigned long)*p2,
813 *p1 ^ *p2, __ffs(*p1 ^ *p2),
814 (unsigned long)(i * sizeof(unsigned long)));
822 static ulong test_bitflip_comparison(volatile unsigned long *bufa,
823 volatile unsigned long *bufb, size_t count)
825 volatile unsigned long *p1 = bufa;
826 volatile unsigned long *p2 = bufb;
833 max = sizeof(unsigned long) * 8;
834 for (k = 0; k < max; k++) {
835 q = 0x00000001L << k;
836 for (j = 0; j < 8; j++) {
839 p1 = (volatile unsigned long *)bufa;
840 p2 = (volatile unsigned long *)bufb;
841 for (i = 0; i < count; i++)
842 *p1++ = *p2++ = (i % 2) == 0 ? q : ~q;
844 errs += compare_regions(bufa, bufb, count);
854 static ulong mem_test_quick(vu_long *buf, ulong start_addr, ulong end_addr,
855 vu_long pattern, int iteration)
863 /* Alternate the pattern */
868 * Flip the pattern each time to make lots of zeros and
869 * then, the next time, lots of ones. We decrement
870 * the "negative" patterns and increment the "positive"
871 * patterns to preserve this feature.
873 if (pattern & 0x80000000)
874 pattern = -pattern; /* complement & increment */
878 length = (end_addr - start_addr) / sizeof(ulong);
880 printf("\rPattern %08lX Writing..."
882 "\b\b\b\b\b\b\b\b\b\b",
885 for (addr = buf, val = pattern; addr < end; addr++) {
893 for (addr = buf, val = pattern; addr < end; addr++) {
896 if (readback != val) {
897 ulong offset = addr - buf;
899 printf("\nMem error @ 0x%08X: "
900 "found %08lX, expected %08lX\n",
901 (uint)(uintptr_t)(start_addr + offset*sizeof(vu_long)),
914 * Perform a memory test. A more complete alternative test can be
915 * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until
916 * interrupted by ctrl-c or by a failure of one of the sub-tests.
918 static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
922 vu_long scratch_space;
923 vu_long *buf, *dummy = &scratch_space;
924 ulong iteration_limit = 0;
926 ulong errs = 0; /* number of errors, or -1 if interrupted */
930 start = CONFIG_SYS_MEMTEST_START;
931 end = CONFIG_SYS_MEMTEST_END;
934 if (strict_strtoul(argv[1], 16, &start) < 0)
935 return CMD_RET_USAGE;
938 if (strict_strtoul(argv[2], 16, &end) < 0)
939 return CMD_RET_USAGE;
942 if (strict_strtoul(argv[3], 16, &pattern) < 0)
943 return CMD_RET_USAGE;
946 if (strict_strtoul(argv[4], 16, &iteration_limit) < 0)
947 return CMD_RET_USAGE;
950 printf("Refusing to do empty test\n");
954 printf("Testing %08lx ... %08lx:\n", start, end);
955 debug("%s:%d: start %#08lx end %#08lx\n", __func__, __LINE__,
958 buf = map_sysmem(start, end - start);
960 !iteration_limit || iteration < iteration_limit;
967 printf("Iteration: %6d\r", iteration + 1);
969 if (IS_ENABLED(CONFIG_SYS_ALT_MEMTEST)) {
970 errs = mem_test_alt(buf, start, end, dummy);
974 errs = test_bitflip_comparison(buf,
975 buf + (end - start) / 2,
977 sizeof(unsigned long));
979 errs = mem_test_quick(buf, start, end, pattern,
987 unmap_sysmem((void *)buf);
990 /* Memory test was aborted - write a newline to finish off */
993 printf("Tested %d iteration(s) with %lu errors.\n", iteration, count);
997 #endif /* CONFIG_CMD_MEMTEST */
1002 * mm{.b, .w, .l, .q} {addr}
1003 * nm{.b, .w, .l, .q} {addr}
1006 mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
1009 #ifdef MEM_SUPPORT_64BIT_DATA
1018 return CMD_RET_USAGE;
1020 bootretry_reset_cmd_timeout(); /* got a good command to get here */
1021 /* We use the last specified parameters, unless new ones are
1024 addr = mm_last_addr;
1025 size = mm_last_size;
1027 if ((flag & CMD_FLAG_REPEAT) == 0) {
1028 /* New command specified. Check for a size specification.
1029 * Defaults to long if no or incorrect specification.
1031 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
1034 /* Address is specified since argc > 1
1036 addr = simple_strtoul(argv[1], NULL, 16);
1037 addr += base_address;
1040 /* Print the address, followed by value. Then accept input for
1041 * the next value. A non-converted value exits.
1044 ptr = map_sysmem(addr, size);
1045 printf("%08lx:", addr);
1047 printf(" %08x", *((u32 *)ptr));
1048 #ifdef MEM_SUPPORT_64BIT_DATA
1050 printf(" %016llx", *((u64 *)ptr));
1053 printf(" %04x", *((u16 *)ptr));
1055 printf(" %02x", *((u8 *)ptr));
1057 nbytes = cli_readline(" ? ");
1058 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
1059 /* <CR> pressed as only input, don't modify current
1060 * location and move to next. "-" pressed will go back.
1063 addr += nbytes ? -size : size;
1065 /* good enough to not time out */
1066 bootretry_reset_cmd_timeout();
1068 #ifdef CONFIG_BOOT_RETRY_TIME
1069 else if (nbytes == -2) {
1070 break; /* timed out, exit the command */
1075 #ifdef MEM_SUPPORT_64BIT_DATA
1076 i = simple_strtoull(console_buffer, &endp, 16);
1078 i = simple_strtoul(console_buffer, &endp, 16);
1080 nbytes = endp - console_buffer;
1082 /* good enough to not time out
1084 bootretry_reset_cmd_timeout();
1087 #ifdef MEM_SUPPORT_64BIT_DATA
1103 mm_last_addr = addr;
1104 mm_last_size = size;
1108 #ifdef CONFIG_CMD_CRC32
1110 static int do_mem_crc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
1117 return CMD_RET_USAGE;
1121 #ifdef CONFIG_CRC32_VERIFY
1122 if (strcmp(*av, "-v") == 0) {
1123 flags |= HASH_FLAG_VERIFY | HASH_FLAG_ENV;
1129 return hash_command("crc32", flags, cmdtp, flag, ac, av);
1134 #ifdef CONFIG_CMD_RANDOM
1135 static int do_random(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
1137 unsigned long addr, len;
1138 unsigned long seed; // NOT INITIALIZED ON PURPOSE
1139 unsigned int *buf, *start;
1140 unsigned char *buf8;
1143 if (argc < 3 || argc > 4)
1144 return CMD_RET_USAGE;
1146 len = simple_strtoul(argv[2], NULL, 16);
1147 addr = simple_strtoul(argv[1], NULL, 16);
1150 seed = simple_strtoul(argv[3], NULL, 16);
1152 printf("The seed cannot be 0. Using 0xDEADBEEF.\n");
1156 seed = get_timer(0) ^ rand();
1160 start = map_sysmem(addr, len);
1162 for (i = 0; i < (len / 4); i++)
1165 buf8 = (unsigned char *)buf;
1166 for (i = 0; i < (len % 4); i++)
1167 *buf8++ = rand() & 0xFF;
1169 unmap_sysmem(start);
1170 printf("%lu bytes filled with random data\n", len);
1172 return CMD_RET_SUCCESS;
1176 /**************************************************/
1178 md, 3, 1, do_mem_md,
1180 #ifdef MEM_SUPPORT_64BIT_DATA
1181 "[.b, .w, .l, .q] address [# of objects]"
1183 "[.b, .w, .l] address [# of objects]"
1189 mm, 2, 1, do_mem_mm,
1190 "memory modify (auto-incrementing address)",
1191 #ifdef MEM_SUPPORT_64BIT_DATA
1192 "[.b, .w, .l, .q] address"
1194 "[.b, .w, .l] address"
1200 nm, 2, 1, do_mem_nm,
1201 "memory modify (constant address)",
1202 #ifdef MEM_SUPPORT_64BIT_DATA
1203 "[.b, .w, .l, .q] address"
1205 "[.b, .w, .l] address"
1210 mw, 4, 1, do_mem_mw,
1211 "memory write (fill)",
1212 #ifdef MEM_SUPPORT_64BIT_DATA
1213 "[.b, .w, .l, .q] address value [count]"
1215 "[.b, .w, .l] address value [count]"
1220 cp, 4, 1, do_mem_cp,
1222 #ifdef MEM_SUPPORT_64BIT_DATA
1223 "[.b, .w, .l, .q] source target count"
1225 "[.b, .w, .l] source target count"
1230 cmp, 4, 1, do_mem_cmp,
1232 #ifdef MEM_SUPPORT_64BIT_DATA
1233 "[.b, .w, .l, .q] addr1 addr2 count"
1235 "[.b, .w, .l] addr1 addr2 count"
1239 #ifdef CONFIG_CMD_CRC32
1241 #ifndef CONFIG_CRC32_VERIFY
1244 crc32, 4, 1, do_mem_crc,
1245 "checksum calculation",
1246 "address count [addr]\n - compute CRC32 checksum [save at addr]"
1249 #else /* CONFIG_CRC32_VERIFY */
1252 crc32, 5, 1, do_mem_crc,
1253 "checksum calculation",
1254 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1255 "-v address count crc\n - verify crc of memory area"
1258 #endif /* CONFIG_CRC32_VERIFY */
1262 #ifdef CONFIG_CMD_MEMINFO
1263 static int do_mem_info(cmd_tbl_t *cmdtp, int flag, int argc,
1264 char * const argv[])
1267 print_size(gd->ram_size, "\n");
1274 base, 2, 1, do_mem_base,
1275 "print or set address offset",
1276 "\n - print address offset for memory commands\n"
1277 "base off\n - set address offset for memory commands to 'off'"
1281 loop, 3, 1, do_mem_loop,
1282 "infinite loop on address range",
1283 #ifdef MEM_SUPPORT_64BIT_DATA
1284 "[.b, .w, .l, .q] address number_of_objects"
1286 "[.b, .w, .l] address number_of_objects"
1292 loopw, 4, 1, do_mem_loopw,
1293 "infinite write loop on address range",
1294 #ifdef MEM_SUPPORT_64BIT_DATA
1295 "[.b, .w, .l, .q] address number_of_objects data_to_write"
1297 "[.b, .w, .l] address number_of_objects data_to_write"
1300 #endif /* CONFIG_LOOPW */
1302 #ifdef CONFIG_CMD_MEMTEST
1304 mtest, 5, 1, do_mem_mtest,
1305 "simple RAM read/write test",
1306 "[start [end [pattern [iterations]]]]"
1308 #endif /* CONFIG_CMD_MEMTEST */
1310 #ifdef CONFIG_CMD_MX_CYCLIC
1312 mdc, 4, 1, do_mem_mdc,
1313 "memory display cyclic",
1314 #ifdef MEM_SUPPORT_64BIT_DATA
1315 "[.b, .w, .l, .q] address count delay(ms)"
1317 "[.b, .w, .l] address count delay(ms)"
1322 mwc, 4, 1, do_mem_mwc,
1323 "memory write cyclic",
1324 #ifdef MEM_SUPPORT_64BIT_DATA
1325 "[.b, .w, .l, .q] address value delay(ms)"
1327 "[.b, .w, .l] address value delay(ms)"
1330 #endif /* CONFIG_CMD_MX_CYCLIC */
1332 #ifdef CONFIG_CMD_MEMINFO
1334 meminfo, 3, 1, do_mem_info,
1335 "display memory information",
1340 #ifdef CONFIG_CMD_RANDOM
1342 random, 4, 0, do_random,
1343 "fill memory with random pattern",
1344 "<addr> <len> [<seed>]\n"
1345 " - Fill 'len' bytes of memory starting at 'addr' with random data\n"