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>
24 #include <linux/compiler.h>
26 DECLARE_GLOBAL_DATA_PTR;
28 static int mod_mem(cmd_tbl_t *, int, int, int, char * const []);
30 /* Display values from last command.
31 * Memory modify remembered values are different from display memory.
33 static ulong dp_last_addr, dp_last_size;
34 static ulong dp_last_length = 0x40;
35 static ulong mm_last_addr, mm_last_size;
37 static ulong base_address = 0;
42 * md{.b, .w, .l, .q} {addr} {len}
44 #define DISP_LINE_LEN 16
45 static int do_mem_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
47 ulong addr, length, bytes;
52 /* We use the last specified parameters, unless new ones are
57 length = dp_last_length;
62 if ((flag & CMD_FLAG_REPEAT) == 0) {
63 /* New command specified. Check for a size specification.
64 * Defaults to long if no or incorrect specification.
66 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
69 /* Address is specified since argc > 1
71 addr = simple_strtoul(argv[1], NULL, 16);
74 /* If another parameter, it is the length to display.
75 * Length is the number of objects, not number of bytes.
78 length = simple_strtoul(argv[2], NULL, 16);
81 bytes = size * length;
82 buf = map_sysmem(addr, bytes);
84 /* Print the lines. */
85 print_buffer(addr, buf, size, length, DISP_LINE_LEN / size);
90 dp_last_length = length;
95 static int do_mem_mm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
97 return mod_mem (cmdtp, 1, flag, argc, argv);
99 static int do_mem_nm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
101 return mod_mem (cmdtp, 0, flag, argc, argv);
104 static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
106 #ifdef MEM_SUPPORT_64BIT_DATA
116 if ((argc < 3) || (argc > 4))
117 return CMD_RET_USAGE;
119 /* Check for size specification.
121 if ((size = cmd_get_data_size(argv[0], 4)) < 1)
124 /* Address is specified since argc > 1
126 addr = simple_strtoul(argv[1], NULL, 16);
127 addr += base_address;
129 /* Get the value to write.
131 #ifdef MEM_SUPPORT_64BIT_DATA
132 writeval = simple_strtoull(argv[2], NULL, 16);
134 writeval = simple_strtoul(argv[2], NULL, 16);
139 count = simple_strtoul(argv[3], NULL, 16);
144 bytes = size * count;
145 start = map_sysmem(addr, bytes);
147 while (count-- > 0) {
149 *((u32 *)buf) = (u32)writeval;
150 #ifdef MEM_SUPPORT_64BIT_DATA
152 *((u64 *)buf) = (u64)writeval;
155 *((u16 *)buf) = (u16)writeval;
157 *((u8 *)buf) = (u8)writeval;
164 #ifdef CONFIG_CMD_MX_CYCLIC
165 static int do_mem_mdc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
171 return CMD_RET_USAGE;
173 count = simple_strtoul(argv[3], NULL, 10);
176 do_mem_md (NULL, 0, 3, argv);
178 /* delay for <count> ms... */
179 for (i=0; i<count; i++)
182 /* check for ctrl-c to abort... */
192 static int do_mem_mwc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
198 return CMD_RET_USAGE;
200 count = simple_strtoul(argv[3], NULL, 10);
203 do_mem_mw (NULL, 0, 3, argv);
205 /* delay for <count> ms... */
206 for (i=0; i<count; i++)
209 /* check for ctrl-c to abort... */
218 #endif /* CONFIG_CMD_MX_CYCLIC */
220 static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
222 ulong addr1, addr2, count, ngood, bytes;
226 const void *buf1, *buf2, *base;
227 #ifdef MEM_SUPPORT_64BIT_DATA
234 return CMD_RET_USAGE;
236 /* Check for size specification.
238 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
240 type = size == 8 ? "double word" :
242 size == 2 ? "halfword" : "byte";
244 addr1 = simple_strtoul(argv[1], NULL, 16);
245 addr1 += base_address;
247 addr2 = simple_strtoul(argv[2], NULL, 16);
248 addr2 += base_address;
250 count = simple_strtoul(argv[3], NULL, 16);
252 bytes = size * count;
253 base = buf1 = map_sysmem(addr1, bytes);
254 buf2 = map_sysmem(addr2, bytes);
255 for (ngood = 0; ngood < count; ++ngood) {
257 word1 = *(u32 *)buf1;
258 word2 = *(u32 *)buf2;
259 #ifdef MEM_SUPPORT_64BIT_DATA
260 } else if (size == 8) {
261 word1 = *(u64 *)buf1;
262 word2 = *(u64 *)buf2;
264 } else if (size == 2) {
265 word1 = *(u16 *)buf1;
266 word2 = *(u16 *)buf2;
271 if (word1 != word2) {
272 ulong offset = buf1 - base;
273 #ifdef MEM_SUPPORT_64BIT_DATA
274 printf("%s at 0x%p (%#0*llx) != %s at 0x%p (%#0*llx)\n",
275 type, (void *)(addr1 + offset), size, word1,
276 type, (void *)(addr2 + offset), size, word2);
278 printf("%s at 0x%08lx (%#0*lx) != %s at 0x%08lx (%#0*lx)\n",
279 type, (ulong)(addr1 + offset), size, word1,
280 type, (ulong)(addr2 + offset), size, word2);
289 /* reset watchdog from time to time */
290 if ((ngood % (64 << 10)) == 0)
296 printf("Total of %ld %s(s) were the same\n", ngood, type);
300 static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
302 ulong addr, dest, count;
307 return CMD_RET_USAGE;
309 /* Check for size specification.
311 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
314 addr = simple_strtoul(argv[1], NULL, 16);
315 addr += base_address;
317 dest = simple_strtoul(argv[2], NULL, 16);
318 dest += base_address;
320 count = simple_strtoul(argv[3], NULL, 16);
323 puts ("Zero length ???\n");
327 src = map_sysmem(addr, count * size);
328 dst = map_sysmem(dest, count * size);
330 #ifdef CONFIG_MTD_NOR_FLASH
331 /* check if we are copying to Flash */
332 if (addr2info((ulong)dst)) {
335 puts ("Copy to Flash... ");
337 rc = flash_write((char *)src, (ulong)dst, count * size);
351 memcpy(dst, src, count * size);
358 static int do_mem_base(cmd_tbl_t *cmdtp, int flag, int argc,
362 /* Set new base address.
364 base_address = simple_strtoul(argv[1], NULL, 16);
366 /* Print the current base address.
368 printf("Base Address: 0x%08lx\n", base_address);
372 static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
375 ulong addr, length, i, bytes;
377 #ifdef MEM_SUPPORT_64BIT_DATA
381 volatile u16 *shortp;
386 return CMD_RET_USAGE;
389 * Check for a size specification.
390 * Defaults to long if no or incorrect specification.
392 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
395 /* Address is always specified.
397 addr = simple_strtoul(argv[1], NULL, 16);
399 /* Length is the number of objects, not number of bytes.
401 length = simple_strtoul(argv[2], NULL, 16);
403 bytes = size * length;
404 buf = map_sysmem(addr, bytes);
406 /* We want to optimize the loops to run as fast as possible.
407 * If we have only one object, just run infinite loops.
410 #ifdef MEM_SUPPORT_64BIT_DATA
432 #ifdef MEM_SUPPORT_64BIT_DATA
470 static int do_mem_loopw(cmd_tbl_t *cmdtp, int flag, int argc,
473 ulong addr, length, i, bytes;
475 #ifdef MEM_SUPPORT_64BIT_DATA
482 volatile u16 *shortp;
487 return CMD_RET_USAGE;
490 * Check for a size specification.
491 * Defaults to long if no or incorrect specification.
493 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
496 /* Address is always specified.
498 addr = simple_strtoul(argv[1], NULL, 16);
500 /* Length is the number of objects, not number of bytes.
502 length = simple_strtoul(argv[2], NULL, 16);
505 #ifdef MEM_SUPPORT_64BIT_DATA
506 data = simple_strtoull(argv[3], NULL, 16);
508 data = simple_strtoul(argv[3], NULL, 16);
511 bytes = size * length;
512 buf = map_sysmem(addr, bytes);
514 /* We want to optimize the loops to run as fast as possible.
515 * If we have only one object, just run infinite loops.
518 #ifdef MEM_SUPPORT_64BIT_DATA
540 #ifdef MEM_SUPPORT_64BIT_DATA
573 #endif /* CONFIG_LOOPW */
575 #ifdef CONFIG_CMD_MEMTEST
576 static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
587 vu_long anti_pattern;
589 static const ulong bitpattern[] = {
590 0x00000001, /* single bit */
591 0x00000003, /* two adjacent bits */
592 0x00000007, /* three adjacent bits */
593 0x0000000F, /* four adjacent bits */
594 0x00000005, /* two non-adjacent bits */
595 0x00000015, /* three non-adjacent bits */
596 0x00000055, /* four non-adjacent bits */
597 0xaaaaaaaa, /* alternating 1/0 */
600 num_words = (end_addr - start_addr) / sizeof(vu_long);
603 * Data line test: write a pattern to the first
604 * location, write the 1's complement to a 'parking'
605 * address (changes the state of the data bus so a
606 * floating bus doesn't give a false OK), and then
607 * read the value back. Note that we read it back
608 * into a variable because the next time we read it,
609 * it might be right (been there, tough to explain to
610 * the quality guys why it prints a failure when the
611 * "is" and "should be" are obviously the same in the
614 * Rather than exhaustively testing, we test some
615 * patterns by shifting '1' bits through a field of
616 * '0's and '0' bits through a field of '1's (i.e.
617 * pattern and ~pattern).
620 for (j = 0; j < sizeof(bitpattern) / sizeof(bitpattern[0]); j++) {
622 for (; val != 0; val <<= 1) {
624 *dummy = ~val; /* clear the test data off the bus */
626 if (readback != val) {
627 printf("FAILURE (data line): "
628 "expected %08lx, actual %08lx\n",
637 if (readback != ~val) {
638 printf("FAILURE (data line): "
639 "Is %08lx, should be %08lx\n",
649 * Based on code whose Original Author and Copyright
650 * information follows: Copyright (c) 1998 by Michael
651 * Barr. This software is placed into the public
652 * domain and may be used for any purpose. However,
653 * this notice must not be changed or removed and no
654 * warranty is either expressed or implied by its
655 * publication or distribution.
661 * Description: Test the address bus wiring in a
662 * memory region by performing a walking
663 * 1's test on the relevant bits of the
664 * address and checking for aliasing.
665 * This test will find single-bit
666 * address failures such as stuck-high,
667 * stuck-low, and shorted pins. The base
668 * address and size of the region are
669 * selected by the caller.
671 * Notes: For best results, the selected base
672 * address should have enough LSB 0's to
673 * guarantee single address bit changes.
674 * For example, to test a 64-Kbyte
675 * region, select a base address on a
676 * 64-Kbyte boundary. Also, select the
677 * region size as a power-of-two if at
680 * Returns: 0 if the test succeeds, 1 if the test fails.
682 pattern = (vu_long) 0xaaaaaaaa;
683 anti_pattern = (vu_long) 0x55555555;
685 debug("%s:%d: length = 0x%.8lx\n", __func__, __LINE__, num_words);
687 * Write the default pattern at each of the
688 * power-of-two offsets.
690 for (offset = 1; offset < num_words; offset <<= 1)
691 addr[offset] = pattern;
694 * Check for address bits stuck high.
697 addr[test_offset] = anti_pattern;
699 for (offset = 1; offset < num_words; offset <<= 1) {
701 if (temp != pattern) {
702 printf("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
703 " expected 0x%.8lx, actual 0x%.8lx\n",
704 start_addr + offset*sizeof(vu_long),
711 addr[test_offset] = pattern;
715 * Check for addr bits stuck low or shorted.
717 for (test_offset = 1; test_offset < num_words; test_offset <<= 1) {
718 addr[test_offset] = anti_pattern;
720 for (offset = 1; offset < num_words; offset <<= 1) {
722 if ((temp != pattern) && (offset != test_offset)) {
723 printf("\nFAILURE: Address bit stuck low or"
724 " shorted @ 0x%.8lx: expected 0x%.8lx,"
726 start_addr + offset*sizeof(vu_long),
733 addr[test_offset] = pattern;
737 * Description: Test the integrity of a physical
738 * memory device by performing an
739 * increment/decrement test over the
740 * entire region. In the process every
741 * storage bit in the device is tested
742 * as a zero and a one. The base address
743 * and the size of the region are
744 * selected by the caller.
746 * Returns: 0 if the test succeeds, 1 if the test fails.
751 * Fill memory with a known pattern.
753 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
755 addr[offset] = pattern;
759 * Check each location and invert it for the second pass.
761 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
764 if (temp != pattern) {
765 printf("\nFAILURE (read/write) @ 0x%.8lx:"
766 " expected 0x%.8lx, actual 0x%.8lx)\n",
767 start_addr + offset*sizeof(vu_long),
774 anti_pattern = ~pattern;
775 addr[offset] = anti_pattern;
779 * Check each location for the inverted pattern and zero it.
781 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
783 anti_pattern = ~pattern;
785 if (temp != anti_pattern) {
786 printf("\nFAILURE (read/write): @ 0x%.8lx:"
787 " expected 0x%.8lx, actual 0x%.8lx)\n",
788 start_addr + offset*sizeof(vu_long),
800 static int compare_regions(volatile unsigned long *bufa,
801 volatile unsigned long *bufb, size_t count)
803 volatile unsigned long *p1 = bufa;
804 volatile unsigned long *p2 = bufb;
808 for (i = 0; i < count; i++, p1++, p2++) {
810 printf("FAILURE: 0x%08lx != 0x%08lx (delta=0x%08lx -> bit %ld) at offset 0x%08lx\n",
811 (unsigned long)*p1, (unsigned long)*p2,
812 *p1 ^ *p2, __ffs(*p1 ^ *p2),
813 (unsigned long)(i * sizeof(unsigned long)));
821 static ulong test_bitflip_comparison(volatile unsigned long *bufa,
822 volatile unsigned long *bufb, size_t count)
824 volatile unsigned long *p1 = bufa;
825 volatile unsigned long *p2 = bufb;
832 max = sizeof(unsigned long) * 8;
833 for (k = 0; k < max; k++) {
834 q = 0x00000001L << k;
835 for (j = 0; j < 8; j++) {
838 p1 = (volatile unsigned long *)bufa;
839 p2 = (volatile unsigned long *)bufb;
840 for (i = 0; i < count; i++)
841 *p1++ = *p2++ = (i % 2) == 0 ? q : ~q;
843 errs += compare_regions(bufa, bufb, count);
853 static ulong mem_test_quick(vu_long *buf, ulong start_addr, ulong end_addr,
854 vu_long pattern, int iteration)
862 /* Alternate the pattern */
867 * Flip the pattern each time to make lots of zeros and
868 * then, the next time, lots of ones. We decrement
869 * the "negative" patterns and increment the "positive"
870 * patterns to preserve this feature.
872 if (pattern & 0x80000000)
873 pattern = -pattern; /* complement & increment */
877 length = (end_addr - start_addr) / sizeof(ulong);
879 printf("\rPattern %08lX Writing..."
881 "\b\b\b\b\b\b\b\b\b\b",
884 for (addr = buf, val = pattern; addr < end; addr++) {
892 for (addr = buf, val = pattern; addr < end; addr++) {
895 if (readback != val) {
896 ulong offset = addr - buf;
898 printf("\nMem error @ 0x%08X: "
899 "found %08lX, expected %08lX\n",
900 (uint)(uintptr_t)(start_addr + offset*sizeof(vu_long)),
913 * Perform a memory test. A more complete alternative test can be
914 * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until
915 * interrupted by ctrl-c or by a failure of one of the sub-tests.
917 static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
921 vu_long scratch_space;
922 vu_long *buf, *dummy = &scratch_space;
923 ulong iteration_limit = 0;
925 ulong errs = 0; /* number of errors, or -1 if interrupted */
929 start = CONFIG_SYS_MEMTEST_START;
930 end = CONFIG_SYS_MEMTEST_END;
933 if (strict_strtoul(argv[1], 16, &start) < 0)
934 return CMD_RET_USAGE;
937 if (strict_strtoul(argv[2], 16, &end) < 0)
938 return CMD_RET_USAGE;
941 if (strict_strtoul(argv[3], 16, &pattern) < 0)
942 return CMD_RET_USAGE;
945 if (strict_strtoul(argv[4], 16, &iteration_limit) < 0)
946 return CMD_RET_USAGE;
949 printf("Refusing to do empty test\n");
953 printf("Testing %08lx ... %08lx:\n", start, end);
954 debug("%s:%d: start %#08lx end %#08lx\n", __func__, __LINE__,
957 buf = map_sysmem(start, end - start);
959 !iteration_limit || iteration < iteration_limit;
966 printf("Iteration: %6d\r", iteration + 1);
968 if (IS_ENABLED(CONFIG_SYS_ALT_MEMTEST)) {
969 errs = mem_test_alt(buf, start, end, dummy);
973 errs = test_bitflip_comparison(buf,
974 buf + (end - start) / 2,
976 sizeof(unsigned long));
978 errs = mem_test_quick(buf, start, end, pattern,
986 unmap_sysmem((void *)buf);
989 /* Memory test was aborted - write a newline to finish off */
992 printf("Tested %d iteration(s) with %lu errors.\n", iteration, count);
996 #endif /* CONFIG_CMD_MEMTEST */
1001 * mm{.b, .w, .l, .q} {addr}
1002 * nm{.b, .w, .l, .q} {addr}
1005 mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
1008 #ifdef MEM_SUPPORT_64BIT_DATA
1017 return CMD_RET_USAGE;
1019 bootretry_reset_cmd_timeout(); /* got a good command to get here */
1020 /* We use the last specified parameters, unless new ones are
1023 addr = mm_last_addr;
1024 size = mm_last_size;
1026 if ((flag & CMD_FLAG_REPEAT) == 0) {
1027 /* New command specified. Check for a size specification.
1028 * Defaults to long if no or incorrect specification.
1030 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
1033 /* Address is specified since argc > 1
1035 addr = simple_strtoul(argv[1], NULL, 16);
1036 addr += base_address;
1039 /* Print the address, followed by value. Then accept input for
1040 * the next value. A non-converted value exits.
1043 ptr = map_sysmem(addr, size);
1044 printf("%08lx:", addr);
1046 printf(" %08x", *((u32 *)ptr));
1047 #ifdef MEM_SUPPORT_64BIT_DATA
1049 printf(" %016llx", *((u64 *)ptr));
1052 printf(" %04x", *((u16 *)ptr));
1054 printf(" %02x", *((u8 *)ptr));
1056 nbytes = cli_readline(" ? ");
1057 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
1058 /* <CR> pressed as only input, don't modify current
1059 * location and move to next. "-" pressed will go back.
1062 addr += nbytes ? -size : size;
1064 /* good enough to not time out */
1065 bootretry_reset_cmd_timeout();
1067 #ifdef CONFIG_BOOT_RETRY_TIME
1068 else if (nbytes == -2) {
1069 break; /* timed out, exit the command */
1074 #ifdef MEM_SUPPORT_64BIT_DATA
1075 i = simple_strtoull(console_buffer, &endp, 16);
1077 i = simple_strtoul(console_buffer, &endp, 16);
1079 nbytes = endp - console_buffer;
1081 /* good enough to not time out
1083 bootretry_reset_cmd_timeout();
1086 #ifdef MEM_SUPPORT_64BIT_DATA
1102 mm_last_addr = addr;
1103 mm_last_size = size;
1107 #ifdef CONFIG_CMD_CRC32
1109 static int do_mem_crc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
1116 return CMD_RET_USAGE;
1120 #ifdef CONFIG_CRC32_VERIFY
1121 if (strcmp(*av, "-v") == 0) {
1122 flags |= HASH_FLAG_VERIFY | HASH_FLAG_ENV;
1128 return hash_command("crc32", flags, cmdtp, flag, ac, av);
1133 #ifdef CONFIG_CMD_RANDOM
1134 static int do_random(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
1136 unsigned long addr, len;
1137 unsigned long seed; // NOT INITIALIZED ON PURPOSE
1138 unsigned int *buf, *start;
1139 unsigned char *buf8;
1142 if (argc < 3 || argc > 4)
1143 return CMD_RET_USAGE;
1145 len = simple_strtoul(argv[2], NULL, 16);
1146 addr = simple_strtoul(argv[1], NULL, 16);
1149 seed = simple_strtoul(argv[3], NULL, 16);
1151 printf("The seed cannot be 0. Using 0xDEADBEEF.\n");
1155 seed = get_timer(0) ^ rand();
1159 start = map_sysmem(addr, len);
1161 for (i = 0; i < (len / 4); i++)
1164 buf8 = (unsigned char *)buf;
1165 for (i = 0; i < (len % 4); i++)
1166 *buf8++ = rand() & 0xFF;
1168 unmap_sysmem(start);
1169 printf("%lu bytes filled with random data\n", len);
1171 return CMD_RET_SUCCESS;
1175 /**************************************************/
1177 md, 3, 1, do_mem_md,
1179 #ifdef MEM_SUPPORT_64BIT_DATA
1180 "[.b, .w, .l, .q] address [# of objects]"
1182 "[.b, .w, .l] address [# of objects]"
1188 mm, 2, 1, do_mem_mm,
1189 "memory modify (auto-incrementing address)",
1190 #ifdef MEM_SUPPORT_64BIT_DATA
1191 "[.b, .w, .l, .q] address"
1193 "[.b, .w, .l] address"
1199 nm, 2, 1, do_mem_nm,
1200 "memory modify (constant address)",
1201 #ifdef MEM_SUPPORT_64BIT_DATA
1202 "[.b, .w, .l, .q] address"
1204 "[.b, .w, .l] address"
1209 mw, 4, 1, do_mem_mw,
1210 "memory write (fill)",
1211 #ifdef MEM_SUPPORT_64BIT_DATA
1212 "[.b, .w, .l, .q] address value [count]"
1214 "[.b, .w, .l] address value [count]"
1219 cp, 4, 1, do_mem_cp,
1221 #ifdef MEM_SUPPORT_64BIT_DATA
1222 "[.b, .w, .l, .q] source target count"
1224 "[.b, .w, .l] source target count"
1229 cmp, 4, 1, do_mem_cmp,
1231 #ifdef MEM_SUPPORT_64BIT_DATA
1232 "[.b, .w, .l, .q] addr1 addr2 count"
1234 "[.b, .w, .l] addr1 addr2 count"
1238 #ifdef CONFIG_CMD_CRC32
1240 #ifndef CONFIG_CRC32_VERIFY
1243 crc32, 4, 1, do_mem_crc,
1244 "checksum calculation",
1245 "address count [addr]\n - compute CRC32 checksum [save at addr]"
1248 #else /* CONFIG_CRC32_VERIFY */
1251 crc32, 5, 1, do_mem_crc,
1252 "checksum calculation",
1253 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1254 "-v address count crc\n - verify crc of memory area"
1257 #endif /* CONFIG_CRC32_VERIFY */
1261 #ifdef CONFIG_CMD_MEMINFO
1262 static int do_mem_info(cmd_tbl_t *cmdtp, int flag, int argc,
1263 char * const argv[])
1266 print_size(gd->ram_size, "\n");
1273 base, 2, 1, do_mem_base,
1274 "print or set address offset",
1275 "\n - print address offset for memory commands\n"
1276 "base off\n - set address offset for memory commands to 'off'"
1280 loop, 3, 1, do_mem_loop,
1281 "infinite loop on address range",
1282 #ifdef MEM_SUPPORT_64BIT_DATA
1283 "[.b, .w, .l, .q] address number_of_objects"
1285 "[.b, .w, .l] address number_of_objects"
1291 loopw, 4, 1, do_mem_loopw,
1292 "infinite write loop on address range",
1293 #ifdef MEM_SUPPORT_64BIT_DATA
1294 "[.b, .w, .l, .q] address number_of_objects data_to_write"
1296 "[.b, .w, .l] address number_of_objects data_to_write"
1299 #endif /* CONFIG_LOOPW */
1301 #ifdef CONFIG_CMD_MEMTEST
1303 mtest, 5, 1, do_mem_mtest,
1304 "simple RAM read/write test",
1305 "[start [end [pattern [iterations]]]]"
1307 #endif /* CONFIG_CMD_MEMTEST */
1309 #ifdef CONFIG_CMD_MX_CYCLIC
1311 mdc, 4, 1, do_mem_mdc,
1312 "memory display cyclic",
1313 #ifdef MEM_SUPPORT_64BIT_DATA
1314 "[.b, .w, .l, .q] address count delay(ms)"
1316 "[.b, .w, .l] address count delay(ms)"
1321 mwc, 4, 1, do_mem_mwc,
1322 "memory write cyclic",
1323 #ifdef MEM_SUPPORT_64BIT_DATA
1324 "[.b, .w, .l, .q] address value delay(ms)"
1326 "[.b, .w, .l] address value delay(ms)"
1329 #endif /* CONFIG_CMD_MX_CYCLIC */
1331 #ifdef CONFIG_CMD_MEMINFO
1333 meminfo, 3, 1, do_mem_info,
1334 "display memory information",
1339 #ifdef CONFIG_CMD_RANDOM
1341 random, 4, 0, do_random,
1342 "fill memory with random pattern",
1343 "<addr> <len> [<seed>]\n"
1344 " - Fill 'len' bytes of memory starting at 'addr' with random data\n"