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>
26 #include <linux/bitops.h>
27 #include <linux/compiler.h>
28 #include <linux/delay.h>
30 DECLARE_GLOBAL_DATA_PTR;
32 #ifndef CONFIG_SYS_MEMTEST_SCRATCH
33 #define CONFIG_SYS_MEMTEST_SCRATCH 0
36 /* Create a compile-time value */
37 #ifdef MEM_SUPPORT_64BIT_DATA
38 #define SUPPORT_64BIT_DATA 1
41 #define SUPPORT_64BIT_DATA 0
45 static int mod_mem(struct cmd_tbl *, int, int, int, char * const []);
47 /* Display values from last command.
48 * Memory modify remembered values are different from display memory.
50 static ulong dp_last_addr, dp_last_size;
51 static ulong dp_last_length = 0x40;
52 static ulong mm_last_addr, mm_last_size;
54 static ulong base_address = 0;
59 * md{.b, .w, .l, .q} {addr} {len}
61 #define DISP_LINE_LEN 16
62 static int do_mem_md(struct cmd_tbl *cmdtp, int flag, int argc,
65 ulong addr, length, bytes;
70 /* We use the last specified parameters, unless new ones are
75 length = dp_last_length;
80 if ((flag & CMD_FLAG_REPEAT) == 0) {
81 /* New command specified. Check for a size specification.
82 * Defaults to long if no or incorrect specification.
84 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
87 /* Address is specified since argc > 1
89 addr = simple_strtoul(argv[1], NULL, 16);
92 /* If another parameter, it is the length to display.
93 * Length is the number of objects, not number of bytes.
96 length = simple_strtoul(argv[2], NULL, 16);
99 bytes = size * length;
100 buf = map_sysmem(addr, bytes);
102 /* Print the lines. */
103 print_buffer(addr, buf, size, length, DISP_LINE_LEN / size);
108 dp_last_length = length;
113 static int do_mem_mm(struct cmd_tbl *cmdtp, int flag, int argc,
116 return mod_mem (cmdtp, 1, flag, argc, argv);
119 static int do_mem_nm(struct cmd_tbl *cmdtp, int flag, int argc,
122 return mod_mem (cmdtp, 0, flag, argc, argv);
125 static int do_mem_mw(struct cmd_tbl *cmdtp, int flag, int argc,
128 ulong writeval; /* 64-bit if SUPPORT_64BIT_DATA */
134 if ((argc < 3) || (argc > 4))
135 return CMD_RET_USAGE;
137 /* Check for size specification.
139 if ((size = cmd_get_data_size(argv[0], 4)) < 1)
142 /* Address is specified since argc > 1
144 addr = simple_strtoul(argv[1], NULL, 16);
145 addr += base_address;
147 /* Get the value to write.
149 if (SUPPORT_64BIT_DATA)
150 writeval = simple_strtoull(argv[2], NULL, 16);
152 writeval = simple_strtoul(argv[2], NULL, 16);
156 count = simple_strtoul(argv[3], NULL, 16);
161 bytes = size * count;
162 start = map_sysmem(addr, bytes);
164 while (count-- > 0) {
166 *((u32 *)buf) = (u32)writeval;
167 else if (SUPPORT_64BIT_DATA && size == 8)
168 *((ulong *)buf) = writeval;
170 *((u16 *)buf) = (u16)writeval;
172 *((u8 *)buf) = (u8)writeval;
179 #ifdef CONFIG_CMD_MX_CYCLIC
180 static int do_mem_mdc(struct cmd_tbl *cmdtp, int flag, int argc,
187 return CMD_RET_USAGE;
189 count = simple_strtoul(argv[3], NULL, 10);
192 do_mem_md (NULL, 0, 3, argv);
194 /* delay for <count> ms... */
195 for (i=0; i<count; i++)
198 /* check for ctrl-c to abort... */
208 static int do_mem_mwc(struct cmd_tbl *cmdtp, int flag, int argc,
215 return CMD_RET_USAGE;
217 count = simple_strtoul(argv[3], NULL, 10);
220 do_mem_mw (NULL, 0, 3, argv);
222 /* delay for <count> ms... */
223 for (i=0; i<count; i++)
226 /* check for ctrl-c to abort... */
235 #endif /* CONFIG_CMD_MX_CYCLIC */
237 static int do_mem_cmp(struct cmd_tbl *cmdtp, int flag, int argc,
240 ulong addr1, addr2, count, ngood, bytes;
244 const void *buf1, *buf2, *base;
245 ulong word1, word2; /* 64-bit if SUPPORT_64BIT_DATA */
248 return CMD_RET_USAGE;
250 /* Check for size specification.
252 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
254 type = size == 8 ? "double word" :
256 size == 2 ? "halfword" : "byte";
258 addr1 = simple_strtoul(argv[1], NULL, 16);
259 addr1 += base_address;
261 addr2 = simple_strtoul(argv[2], NULL, 16);
262 addr2 += base_address;
264 count = simple_strtoul(argv[3], NULL, 16);
266 bytes = size * count;
267 base = buf1 = map_sysmem(addr1, bytes);
268 buf2 = map_sysmem(addr2, bytes);
269 for (ngood = 0; ngood < count; ++ngood) {
271 word1 = *(u32 *)buf1;
272 word2 = *(u32 *)buf2;
273 } else if (SUPPORT_64BIT_DATA && size == 8) {
274 word1 = *(ulong *)buf1;
275 word2 = *(ulong *)buf2;
276 } else if (size == 2) {
277 word1 = *(u16 *)buf1;
278 word2 = *(u16 *)buf2;
283 if (word1 != word2) {
284 ulong offset = buf1 - base;
285 printf("%s at 0x%08lx (%#0*lx) != %s at 0x%08lx (%#0*lx)\n",
286 type, (ulong)(addr1 + offset), size, word1,
287 type, (ulong)(addr2 + offset), size, word2);
295 /* reset watchdog from time to time */
296 if ((ngood % (64 << 10)) == 0)
302 printf("Total of %ld %s(s) were the same\n", ngood, type);
306 static int do_mem_cp(struct cmd_tbl *cmdtp, int flag, int argc,
309 ulong addr, dest, count;
314 return CMD_RET_USAGE;
316 /* Check for size specification.
318 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
321 addr = simple_strtoul(argv[1], NULL, 16);
322 addr += base_address;
324 dest = simple_strtoul(argv[2], NULL, 16);
325 dest += base_address;
327 count = simple_strtoul(argv[3], NULL, 16);
330 puts ("Zero length ???\n");
334 src = map_sysmem(addr, count * size);
335 dst = map_sysmem(dest, count * size);
337 #ifdef CONFIG_MTD_NOR_FLASH
338 /* check if we are copying to Flash */
339 if (addr2info((ulong)dst)) {
342 puts ("Copy to Flash... ");
344 rc = flash_write((char *)src, (ulong)dst, count * size);
358 memcpy(dst, src, count * size);
365 static int do_mem_base(struct cmd_tbl *cmdtp, int flag, int argc,
369 /* Set new base address.
371 base_address = simple_strtoul(argv[1], NULL, 16);
373 /* Print the current base address.
375 printf("Base Address: 0x%08lx\n", base_address);
379 static int do_mem_loop(struct cmd_tbl *cmdtp, int flag, int argc,
382 ulong addr, length, i, bytes;
384 volatile ulong *llp; /* 64-bit if SUPPORT_64BIT_DATA */
386 volatile u16 *shortp;
391 return CMD_RET_USAGE;
394 * Check for a size specification.
395 * Defaults to long if no or incorrect specification.
397 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
400 /* Address is always specified.
402 addr = simple_strtoul(argv[1], NULL, 16);
404 /* Length is the number of objects, not number of bytes.
406 length = simple_strtoul(argv[2], NULL, 16);
408 bytes = size * length;
409 buf = map_sysmem(addr, bytes);
411 /* We want to optimize the loops to run as fast as possible.
412 * If we have only one object, just run infinite loops.
415 if (SUPPORT_64BIT_DATA && size == 8) {
435 if (SUPPORT_64BIT_DATA && size == 8) {
471 static int do_mem_loopw(struct cmd_tbl *cmdtp, int flag, int argc,
474 ulong addr, length, i, bytes;
476 volatile ulong *llp; /* 64-bit if SUPPORT_64BIT_DATA */
477 ulong data; /* 64-bit if SUPPORT_64BIT_DATA */
479 volatile u16 *shortp;
484 return CMD_RET_USAGE;
487 * Check for a size specification.
488 * Defaults to long if no or incorrect specification.
490 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
493 /* Address is always specified.
495 addr = simple_strtoul(argv[1], NULL, 16);
497 /* Length is the number of objects, not number of bytes.
499 length = simple_strtoul(argv[2], NULL, 16);
502 if (SUPPORT_64BIT_DATA)
503 data = simple_strtoull(argv[3], NULL, 16);
505 data = simple_strtoul(argv[3], NULL, 16);
507 bytes = size * length;
508 buf = map_sysmem(addr, bytes);
510 /* We want to optimize the loops to run as fast as possible.
511 * If we have only one object, just run infinite loops.
514 if (SUPPORT_64BIT_DATA && size == 8) {
534 if (SUPPORT_64BIT_DATA && size == 8) {
565 #endif /* CONFIG_LOOPW */
567 #ifdef CONFIG_CMD_MEMTEST
568 static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
579 vu_long anti_pattern;
581 static const ulong bitpattern[] = {
582 0x00000001, /* single bit */
583 0x00000003, /* two adjacent bits */
584 0x00000007, /* three adjacent bits */
585 0x0000000F, /* four adjacent bits */
586 0x00000005, /* two non-adjacent bits */
587 0x00000015, /* three non-adjacent bits */
588 0x00000055, /* four non-adjacent bits */
589 0xaaaaaaaa, /* alternating 1/0 */
592 num_words = (end_addr - start_addr) / sizeof(vu_long);
595 * Data line test: write a pattern to the first
596 * location, write the 1's complement to a 'parking'
597 * address (changes the state of the data bus so a
598 * floating bus doesn't give a false OK), and then
599 * read the value back. Note that we read it back
600 * into a variable because the next time we read it,
601 * it might be right (been there, tough to explain to
602 * the quality guys why it prints a failure when the
603 * "is" and "should be" are obviously the same in the
606 * Rather than exhaustively testing, we test some
607 * patterns by shifting '1' bits through a field of
608 * '0's and '0' bits through a field of '1's (i.e.
609 * pattern and ~pattern).
612 for (j = 0; j < sizeof(bitpattern) / sizeof(bitpattern[0]); j++) {
614 for (; val != 0; val <<= 1) {
616 *dummy = ~val; /* clear the test data off the bus */
618 if (readback != val) {
619 printf("FAILURE (data line): "
620 "expected %08lx, actual %08lx\n",
629 if (readback != ~val) {
630 printf("FAILURE (data line): "
631 "Is %08lx, should be %08lx\n",
641 * Based on code whose Original Author and Copyright
642 * information follows: Copyright (c) 1998 by Michael
643 * Barr. This software is placed into the public
644 * domain and may be used for any purpose. However,
645 * this notice must not be changed or removed and no
646 * warranty is either expressed or implied by its
647 * publication or distribution.
653 * Description: Test the address bus wiring in a
654 * memory region by performing a walking
655 * 1's test on the relevant bits of the
656 * address and checking for aliasing.
657 * This test will find single-bit
658 * address failures such as stuck-high,
659 * stuck-low, and shorted pins. The base
660 * address and size of the region are
661 * selected by the caller.
663 * Notes: For best results, the selected base
664 * address should have enough LSB 0's to
665 * guarantee single address bit changes.
666 * For example, to test a 64-Kbyte
667 * region, select a base address on a
668 * 64-Kbyte boundary. Also, select the
669 * region size as a power-of-two if at
672 * Returns: 0 if the test succeeds, 1 if the test fails.
674 pattern = (vu_long) 0xaaaaaaaa;
675 anti_pattern = (vu_long) 0x55555555;
677 debug("%s:%d: length = 0x%.8lx\n", __func__, __LINE__, num_words);
679 * Write the default pattern at each of the
680 * power-of-two offsets.
682 for (offset = 1; offset < num_words; offset <<= 1)
683 addr[offset] = pattern;
686 * Check for address bits stuck high.
689 addr[test_offset] = anti_pattern;
691 for (offset = 1; offset < num_words; offset <<= 1) {
693 if (temp != pattern) {
694 printf("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
695 " expected 0x%.8lx, actual 0x%.8lx\n",
696 start_addr + offset*sizeof(vu_long),
703 addr[test_offset] = pattern;
707 * Check for addr bits stuck low or shorted.
709 for (test_offset = 1; test_offset < num_words; test_offset <<= 1) {
710 addr[test_offset] = anti_pattern;
712 for (offset = 1; offset < num_words; offset <<= 1) {
714 if ((temp != pattern) && (offset != test_offset)) {
715 printf("\nFAILURE: Address bit stuck low or"
716 " shorted @ 0x%.8lx: expected 0x%.8lx,"
718 start_addr + offset*sizeof(vu_long),
725 addr[test_offset] = pattern;
729 * Description: Test the integrity of a physical
730 * memory device by performing an
731 * increment/decrement test over the
732 * entire region. In the process every
733 * storage bit in the device is tested
734 * as a zero and a one. The base address
735 * and the size of the region are
736 * selected by the caller.
738 * Returns: 0 if the test succeeds, 1 if the test fails.
743 * Fill memory with a known pattern.
745 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
747 addr[offset] = pattern;
751 * Check each location and invert it for the second pass.
753 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
756 if (temp != pattern) {
757 printf("\nFAILURE (read/write) @ 0x%.8lx:"
758 " expected 0x%.8lx, actual 0x%.8lx)\n",
759 start_addr + offset*sizeof(vu_long),
766 anti_pattern = ~pattern;
767 addr[offset] = anti_pattern;
771 * Check each location for the inverted pattern and zero it.
773 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
775 anti_pattern = ~pattern;
777 if (temp != anti_pattern) {
778 printf("\nFAILURE (read/write): @ 0x%.8lx:"
779 " expected 0x%.8lx, actual 0x%.8lx)\n",
780 start_addr + offset*sizeof(vu_long),
792 static int compare_regions(volatile unsigned long *bufa,
793 volatile unsigned long *bufb, size_t count)
795 volatile unsigned long *p1 = bufa;
796 volatile unsigned long *p2 = bufb;
800 for (i = 0; i < count; i++, p1++, p2++) {
802 printf("FAILURE: 0x%08lx != 0x%08lx (delta=0x%08lx -> bit %ld) at offset 0x%08lx\n",
803 (unsigned long)*p1, (unsigned long)*p2,
804 *p1 ^ *p2, __ffs(*p1 ^ *p2),
805 (unsigned long)(i * sizeof(unsigned long)));
813 static ulong test_bitflip_comparison(volatile unsigned long *bufa,
814 volatile unsigned long *bufb, size_t count)
816 volatile unsigned long *p1 = bufa;
817 volatile unsigned long *p2 = bufb;
824 max = sizeof(unsigned long) * 8;
825 for (k = 0; k < max; k++) {
826 q = 0x00000001L << k;
827 for (j = 0; j < 8; j++) {
830 p1 = (volatile unsigned long *)bufa;
831 p2 = (volatile unsigned long *)bufb;
832 for (i = 0; i < count; i++)
833 *p1++ = *p2++ = (i % 2) == 0 ? q : ~q;
835 errs += compare_regions(bufa, bufb, count);
845 static ulong mem_test_quick(vu_long *buf, ulong start_addr, ulong end_addr,
846 vu_long pattern, int iteration)
854 /* Alternate the pattern */
859 * Flip the pattern each time to make lots of zeros and
860 * then, the next time, lots of ones. We decrement
861 * the "negative" patterns and increment the "positive"
862 * patterns to preserve this feature.
864 if (pattern & 0x80000000)
865 pattern = -pattern; /* complement & increment */
869 length = (end_addr - start_addr) / sizeof(ulong);
871 printf("\rPattern %08lX Writing..."
873 "\b\b\b\b\b\b\b\b\b\b",
876 for (addr = buf, val = pattern; addr < end; addr++) {
884 for (addr = buf, val = pattern; addr < end; addr++) {
887 if (readback != val) {
888 ulong offset = addr - buf;
890 printf("\nMem error @ 0x%08X: "
891 "found %08lX, expected %08lX\n",
892 (uint)(uintptr_t)(start_addr + offset*sizeof(vu_long)),
905 * Perform a memory test. A more complete alternative test can be
906 * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until
907 * interrupted by ctrl-c or by a failure of one of the sub-tests.
909 static int do_mem_mtest(struct cmd_tbl *cmdtp, int flag, int argc,
913 vu_long scratch_space;
914 vu_long *buf, *dummy = &scratch_space;
915 ulong iteration_limit = 0;
917 ulong errs = 0; /* number of errors, or -1 if interrupted */
921 start = CONFIG_SYS_MEMTEST_START;
922 end = CONFIG_SYS_MEMTEST_END;
925 if (strict_strtoul(argv[1], 16, &start) < 0)
926 return CMD_RET_USAGE;
929 if (strict_strtoul(argv[2], 16, &end) < 0)
930 return CMD_RET_USAGE;
933 if (strict_strtoul(argv[3], 16, &pattern) < 0)
934 return CMD_RET_USAGE;
937 if (strict_strtoul(argv[4], 16, &iteration_limit) < 0)
938 return CMD_RET_USAGE;
941 printf("Refusing to do empty test\n");
945 printf("Testing %08lx ... %08lx:\n", start, end);
946 debug("%s:%d: start %#08lx end %#08lx\n", __func__, __LINE__,
949 buf = map_sysmem(start, end - start);
951 !iteration_limit || iteration < iteration_limit;
958 printf("Iteration: %6d\r", iteration + 1);
960 if (IS_ENABLED(CONFIG_SYS_ALT_MEMTEST)) {
961 errs = mem_test_alt(buf, start, end, dummy);
965 errs = test_bitflip_comparison(buf,
966 buf + (end - start) / 2,
968 sizeof(unsigned long));
970 errs = mem_test_quick(buf, start, end, pattern,
978 unmap_sysmem((void *)buf);
981 /* Memory test was aborted - write a newline to finish off */
984 printf("Tested %d iteration(s) with %lu errors.\n", iteration, count);
988 #endif /* CONFIG_CMD_MEMTEST */
993 * mm{.b, .w, .l, .q} {addr}
996 mod_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc,
1000 ulong i; /* 64-bit if SUPPORT_64BIT_DATA */
1005 return CMD_RET_USAGE;
1007 bootretry_reset_cmd_timeout(); /* got a good command to get here */
1008 /* We use the last specified parameters, unless new ones are
1011 addr = mm_last_addr;
1012 size = mm_last_size;
1014 if ((flag & CMD_FLAG_REPEAT) == 0) {
1015 /* New command specified. Check for a size specification.
1016 * Defaults to long if no or incorrect specification.
1018 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
1021 /* Address is specified since argc > 1
1023 addr = simple_strtoul(argv[1], NULL, 16);
1024 addr += base_address;
1027 /* Print the address, followed by value. Then accept input for
1028 * the next value. A non-converted value exits.
1031 ptr = map_sysmem(addr, size);
1032 printf("%08lx:", addr);
1034 printf(" %08x", *((u32 *)ptr));
1035 else if (SUPPORT_64BIT_DATA && size == 8)
1036 printf(" %0lx", *((ulong *)ptr));
1038 printf(" %04x", *((u16 *)ptr));
1040 printf(" %02x", *((u8 *)ptr));
1042 nbytes = cli_readline(" ? ");
1043 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
1044 /* <CR> pressed as only input, don't modify current
1045 * location and move to next. "-" pressed will go back.
1048 addr += nbytes ? -size : size;
1050 /* good enough to not time out */
1051 bootretry_reset_cmd_timeout();
1053 #ifdef CONFIG_BOOT_RETRY_TIME
1054 else if (nbytes == -2) {
1055 break; /* timed out, exit the command */
1060 if (SUPPORT_64BIT_DATA)
1061 i = simple_strtoull(console_buffer, &endp, 16);
1063 i = simple_strtoul(console_buffer, &endp, 16);
1064 nbytes = endp - console_buffer;
1066 /* good enough to not time out
1068 bootretry_reset_cmd_timeout();
1071 else if (SUPPORT_64BIT_DATA && size == 8)
1072 *((ulong *)ptr) = i;
1085 mm_last_addr = addr;
1086 mm_last_size = size;
1090 #ifdef CONFIG_CMD_CRC32
1092 static int do_mem_crc(struct cmd_tbl *cmdtp, int flag, int argc,
1100 return CMD_RET_USAGE;
1104 #ifdef CONFIG_CRC32_VERIFY
1105 if (strcmp(*av, "-v") == 0) {
1106 flags |= HASH_FLAG_VERIFY | HASH_FLAG_ENV;
1112 return hash_command("crc32", flags, cmdtp, flag, ac, av);
1117 #ifdef CONFIG_CMD_RANDOM
1118 static int do_random(struct cmd_tbl *cmdtp, int flag, int argc,
1121 unsigned long addr, len;
1122 unsigned long seed; // NOT INITIALIZED ON PURPOSE
1123 unsigned int *buf, *start;
1124 unsigned char *buf8;
1127 if (argc < 3 || argc > 4)
1128 return CMD_RET_USAGE;
1130 len = simple_strtoul(argv[2], NULL, 16);
1131 addr = simple_strtoul(argv[1], NULL, 16);
1134 seed = simple_strtoul(argv[3], NULL, 16);
1136 printf("The seed cannot be 0. Using 0xDEADBEEF.\n");
1140 seed = get_timer(0) ^ rand();
1144 start = map_sysmem(addr, len);
1146 for (i = 0; i < (len / 4); i++)
1149 buf8 = (unsigned char *)buf;
1150 for (i = 0; i < (len % 4); i++)
1151 *buf8++ = rand() & 0xFF;
1153 unmap_sysmem(start);
1154 printf("%lu bytes filled with random data\n", len);
1156 return CMD_RET_SUCCESS;
1160 /**************************************************/
1162 md, 3, 1, do_mem_md,
1164 "[.b, .w, .l" HELP_Q "] address [# of objects]"
1169 mm, 2, 1, do_mem_mm,
1170 "memory modify (auto-incrementing address)",
1171 "[.b, .w, .l" HELP_Q "] address"
1176 nm, 2, 1, do_mem_nm,
1177 "memory modify (constant address)",
1178 "[.b, .w, .l" HELP_Q "] address"
1182 mw, 4, 1, do_mem_mw,
1183 "memory write (fill)",
1184 "[.b, .w, .l" HELP_Q "] address value [count]"
1188 cp, 4, 1, do_mem_cp,
1190 "[.b, .w, .l" HELP_Q "] source target count"
1194 cmp, 4, 1, do_mem_cmp,
1196 "[.b, .w, .l" HELP_Q "] addr1 addr2 count"
1199 #ifdef CONFIG_CMD_CRC32
1201 #ifndef CONFIG_CRC32_VERIFY
1204 crc32, 4, 1, do_mem_crc,
1205 "checksum calculation",
1206 "address count [addr]\n - compute CRC32 checksum [save at addr]"
1209 #else /* CONFIG_CRC32_VERIFY */
1212 crc32, 5, 1, do_mem_crc,
1213 "checksum calculation",
1214 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1215 "-v address count crc\n - verify crc of memory area"
1218 #endif /* CONFIG_CRC32_VERIFY */
1222 #ifdef CONFIG_CMD_MEMINFO
1223 static int do_mem_info(struct cmd_tbl *cmdtp, int flag, int argc,
1227 print_size(gd->ram_size, "\n");
1234 base, 2, 1, do_mem_base,
1235 "print or set address offset",
1236 "\n - print address offset for memory commands\n"
1237 "base off\n - set address offset for memory commands to 'off'"
1241 loop, 3, 1, do_mem_loop,
1242 "infinite loop on address range",
1243 "[.b, .w, .l" HELP_Q "] address number_of_objects"
1248 loopw, 4, 1, do_mem_loopw,
1249 "infinite write loop on address range",
1250 "[.b, .w, .l" HELP_Q "] address number_of_objects data_to_write"
1252 #endif /* CONFIG_LOOPW */
1254 #ifdef CONFIG_CMD_MEMTEST
1256 mtest, 5, 1, do_mem_mtest,
1257 "simple RAM read/write test",
1258 "[start [end [pattern [iterations]]]]"
1260 #endif /* CONFIG_CMD_MEMTEST */
1262 #ifdef CONFIG_CMD_MX_CYCLIC
1264 mdc, 4, 1, do_mem_mdc,
1265 "memory display cyclic",
1266 "[.b, .w, .l" HELP_Q "] address count delay(ms)"
1270 mwc, 4, 1, do_mem_mwc,
1271 "memory write cyclic",
1272 "[.b, .w, .l" HELP_Q "] address value delay(ms)"
1274 #endif /* CONFIG_CMD_MX_CYCLIC */
1276 #ifdef CONFIG_CMD_MEMINFO
1278 meminfo, 3, 1, do_mem_info,
1279 "display memory information",
1284 #ifdef CONFIG_CMD_RANDOM
1286 random, 4, 0, do_random,
1287 "fill memory with random pattern",
1288 "<addr> <len> [<seed>]\n"
1289 " - Fill 'len' bytes of memory starting at 'addr' with random data\n"