3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * SPDX-License-Identifier: GPL-2.0+
11 * Copied from FADS ROM, Dan Malek (dmalek@jlc.net)
16 #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(cmd_tbl_t
*, 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(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
52 ulong addr
, length
, bytes
;
57 /* We use the last specified parameters, unless new ones are
62 length
= dp_last_length
;
67 if ((flag
& CMD_FLAG_REPEAT
) == 0) {
68 /* New command specified. Check for a size specification.
69 * Defaults to long if no or incorrect specification.
71 if ((size
= cmd_get_data_size(argv
[0], 4)) < 0)
74 /* Address is specified since argc > 1
76 addr
= simple_strtoul(argv
[1], NULL
, 16);
79 /* If another parameter, it is the length to display.
80 * Length is the number of objects, not number of bytes.
83 length
= simple_strtoul(argv
[2], NULL
, 16);
86 bytes
= size
* length
;
87 buf
= map_sysmem(addr
, bytes
);
89 /* Print the lines. */
90 print_buffer(addr
, buf
, size
, length
, DISP_LINE_LEN
/ size
);
95 dp_last_length
= length
;
100 static int do_mem_mm(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
102 return mod_mem (cmdtp
, 1, flag
, argc
, argv
);
104 static int do_mem_nm(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
106 return mod_mem (cmdtp
, 0, flag
, argc
, argv
);
109 static int do_mem_mw(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
111 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
121 if ((argc
< 3) || (argc
> 4))
122 return CMD_RET_USAGE
;
124 /* Check for size specification.
126 if ((size
= cmd_get_data_size(argv
[0], 4)) < 1)
129 /* Address is specified since argc > 1
131 addr
= simple_strtoul(argv
[1], NULL
, 16);
132 addr
+= base_address
;
134 /* Get the value to write.
136 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
137 writeval
= simple_strtoull(argv
[2], NULL
, 16);
139 writeval
= simple_strtoul(argv
[2], NULL
, 16);
144 count
= simple_strtoul(argv
[3], NULL
, 16);
149 bytes
= size
* count
;
150 start
= map_sysmem(addr
, bytes
);
152 while (count
-- > 0) {
154 *((u32
*)buf
) = (u32
)writeval
;
155 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
157 *((u64
*)buf
) = (u64
)writeval
;
160 *((u16
*)buf
) = (u16
)writeval
;
162 *((u8
*)buf
) = (u8
)writeval
;
169 #ifdef CONFIG_MX_CYCLIC
170 static int do_mem_mdc(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
176 return CMD_RET_USAGE
;
178 count
= simple_strtoul(argv
[3], NULL
, 10);
181 do_mem_md (NULL
, 0, 3, argv
);
183 /* delay for <count> ms... */
184 for (i
=0; i
<count
; i
++)
187 /* check for ctrl-c to abort... */
197 static int do_mem_mwc(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
203 return CMD_RET_USAGE
;
205 count
= simple_strtoul(argv
[3], NULL
, 10);
208 do_mem_mw (NULL
, 0, 3, argv
);
210 /* delay for <count> ms... */
211 for (i
=0; i
<count
; i
++)
214 /* check for ctrl-c to abort... */
223 #endif /* CONFIG_MX_CYCLIC */
225 static int do_mem_cmp(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
227 ulong addr1
, addr2
, count
, ngood
, bytes
;
231 const void *buf1
, *buf2
, *base
;
232 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
239 return CMD_RET_USAGE
;
241 /* Check for size specification.
243 if ((size
= cmd_get_data_size(argv
[0], 4)) < 0)
245 type
= size
== 8 ? "double word" :
247 size
== 2 ? "halfword" : "byte";
249 addr1
= simple_strtoul(argv
[1], NULL
, 16);
250 addr1
+= base_address
;
252 addr2
= simple_strtoul(argv
[2], NULL
, 16);
253 addr2
+= base_address
;
255 count
= simple_strtoul(argv
[3], NULL
, 16);
257 bytes
= size
* count
;
258 base
= buf1
= map_sysmem(addr1
, bytes
);
259 buf2
= map_sysmem(addr2
, bytes
);
260 for (ngood
= 0; ngood
< count
; ++ngood
) {
262 word1
= *(u32
*)buf1
;
263 word2
= *(u32
*)buf2
;
264 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
265 } else if (size
== 8) {
266 word1
= *(u64
*)buf1
;
267 word2
= *(u64
*)buf2
;
269 } else if (size
== 2) {
270 word1
= *(u16
*)buf1
;
271 word2
= *(u16
*)buf2
;
276 if (word1
!= word2
) {
277 ulong offset
= buf1
- base
;
278 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
279 printf("%s at 0x%p (%#0*"PRIx64
") != %s at 0x%p (%#0*"
281 type
, (void *)(addr1
+ offset
), size
, word1
,
282 type
, (void *)(addr2
+ offset
), size
, word2
);
284 printf("%s at 0x%08lx (%#0*lx) != %s at 0x%08lx (%#0*lx)\n",
285 type
, (ulong
)(addr1
+ offset
), size
, word1
,
286 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(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
308 ulong addr
, dest
, count
;
312 return CMD_RET_USAGE
;
314 /* Check for size specification.
316 if ((size
= cmd_get_data_size(argv
[0], 4)) < 0)
319 addr
= simple_strtoul(argv
[1], NULL
, 16);
320 addr
+= base_address
;
322 dest
= simple_strtoul(argv
[2], NULL
, 16);
323 dest
+= base_address
;
325 count
= simple_strtoul(argv
[3], NULL
, 16);
328 puts ("Zero length ???\n");
332 #ifdef CONFIG_MTD_NOR_FLASH
333 /* check if we are copying to Flash */
334 if (addr2info(dest
) != NULL
) {
337 puts ("Copy to Flash... ");
339 rc
= flash_write ((char *)addr
, dest
, count
*size
);
349 memcpy((void *)dest
, (void *)addr
, count
* size
);
354 static int do_mem_base(cmd_tbl_t
*cmdtp
, int flag
, int argc
,
358 /* Set new base address.
360 base_address
= simple_strtoul(argv
[1], NULL
, 16);
362 /* Print the current base address.
364 printf("Base Address: 0x%08lx\n", base_address
);
368 static int do_mem_loop(cmd_tbl_t
*cmdtp
, int flag
, int argc
,
371 ulong addr
, length
, i
, bytes
;
373 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
377 volatile u16
*shortp
;
382 return CMD_RET_USAGE
;
385 * Check for a size specification.
386 * Defaults to long if no or incorrect specification.
388 if ((size
= cmd_get_data_size(argv
[0], 4)) < 0)
391 /* Address is always specified.
393 addr
= simple_strtoul(argv
[1], NULL
, 16);
395 /* Length is the number of objects, not number of bytes.
397 length
= simple_strtoul(argv
[2], NULL
, 16);
399 bytes
= size
* length
;
400 buf
= map_sysmem(addr
, bytes
);
402 /* We want to optimize the loops to run as fast as possible.
403 * If we have only one object, just run infinite loops.
406 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
428 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
466 static int do_mem_loopw(cmd_tbl_t
*cmdtp
, int flag
, int argc
,
469 ulong addr
, length
, i
, bytes
;
471 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
478 volatile u16
*shortp
;
483 return CMD_RET_USAGE
;
486 * Check for a size specification.
487 * Defaults to long if no or incorrect specification.
489 if ((size
= cmd_get_data_size(argv
[0], 4)) < 0)
492 /* Address is always specified.
494 addr
= simple_strtoul(argv
[1], NULL
, 16);
496 /* Length is the number of objects, not number of bytes.
498 length
= simple_strtoul(argv
[2], NULL
, 16);
501 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
502 data
= simple_strtoull(argv
[3], NULL
, 16);
504 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 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
536 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
569 #endif /* CONFIG_LOOPW */
571 #ifdef CONFIG_CMD_MEMTEST
572 static ulong
mem_test_alt(vu_long
*buf
, ulong start_addr
, ulong end_addr
,
583 vu_long anti_pattern
;
585 static const ulong bitpattern
[] = {
586 0x00000001, /* single bit */
587 0x00000003, /* two adjacent bits */
588 0x00000007, /* three adjacent bits */
589 0x0000000F, /* four adjacent bits */
590 0x00000005, /* two non-adjacent bits */
591 0x00000015, /* three non-adjacent bits */
592 0x00000055, /* four non-adjacent bits */
593 0xaaaaaaaa, /* alternating 1/0 */
596 num_words
= (end_addr
- start_addr
) / sizeof(vu_long
);
599 * Data line test: write a pattern to the first
600 * location, write the 1's complement to a 'parking'
601 * address (changes the state of the data bus so a
602 * floating bus doesn't give a false OK), and then
603 * read the value back. Note that we read it back
604 * into a variable because the next time we read it,
605 * it might be right (been there, tough to explain to
606 * the quality guys why it prints a failure when the
607 * "is" and "should be" are obviously the same in the
610 * Rather than exhaustively testing, we test some
611 * patterns by shifting '1' bits through a field of
612 * '0's and '0' bits through a field of '1's (i.e.
613 * pattern and ~pattern).
616 for (j
= 0; j
< sizeof(bitpattern
) / sizeof(bitpattern
[0]); j
++) {
618 for (; val
!= 0; val
<<= 1) {
620 *dummy
= ~val
; /* clear the test data off the bus */
622 if (readback
!= val
) {
623 printf("FAILURE (data line): "
624 "expected %08lx, actual %08lx\n",
633 if (readback
!= ~val
) {
634 printf("FAILURE (data line): "
635 "Is %08lx, should be %08lx\n",
645 * Based on code whose Original Author and Copyright
646 * information follows: Copyright (c) 1998 by Michael
647 * Barr. This software is placed into the public
648 * domain and may be used for any purpose. However,
649 * this notice must not be changed or removed and no
650 * warranty is either expressed or implied by its
651 * publication or distribution.
657 * Description: Test the address bus wiring in a
658 * memory region by performing a walking
659 * 1's test on the relevant bits of the
660 * address and checking for aliasing.
661 * This test will find single-bit
662 * address failures such as stuck-high,
663 * stuck-low, and shorted pins. The base
664 * address and size of the region are
665 * selected by the caller.
667 * Notes: For best results, the selected base
668 * address should have enough LSB 0's to
669 * guarantee single address bit changes.
670 * For example, to test a 64-Kbyte
671 * region, select a base address on a
672 * 64-Kbyte boundary. Also, select the
673 * region size as a power-of-two if at
676 * Returns: 0 if the test succeeds, 1 if the test fails.
678 pattern
= (vu_long
) 0xaaaaaaaa;
679 anti_pattern
= (vu_long
) 0x55555555;
681 debug("%s:%d: length = 0x%.8lx\n", __func__
, __LINE__
, num_words
);
683 * Write the default pattern at each of the
684 * power-of-two offsets.
686 for (offset
= 1; offset
< num_words
; offset
<<= 1)
687 addr
[offset
] = pattern
;
690 * Check for address bits stuck high.
693 addr
[test_offset
] = anti_pattern
;
695 for (offset
= 1; offset
< num_words
; offset
<<= 1) {
697 if (temp
!= pattern
) {
698 printf("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
699 " expected 0x%.8lx, actual 0x%.8lx\n",
700 start_addr
+ offset
*sizeof(vu_long
),
707 addr
[test_offset
] = pattern
;
711 * Check for addr bits stuck low or shorted.
713 for (test_offset
= 1; test_offset
< num_words
; test_offset
<<= 1) {
714 addr
[test_offset
] = anti_pattern
;
716 for (offset
= 1; offset
< num_words
; offset
<<= 1) {
718 if ((temp
!= pattern
) && (offset
!= test_offset
)) {
719 printf("\nFAILURE: Address bit stuck low or"
720 " shorted @ 0x%.8lx: expected 0x%.8lx,"
722 start_addr
+ offset
*sizeof(vu_long
),
729 addr
[test_offset
] = pattern
;
733 * Description: Test the integrity of a physical
734 * memory device by performing an
735 * increment/decrement test over the
736 * entire region. In the process every
737 * storage bit in the device is tested
738 * as a zero and a one. The base address
739 * and the size of the region are
740 * selected by the caller.
742 * Returns: 0 if the test succeeds, 1 if the test fails.
747 * Fill memory with a known pattern.
749 for (pattern
= 1, offset
= 0; offset
< num_words
; pattern
++, offset
++) {
751 addr
[offset
] = pattern
;
755 * Check each location and invert it for the second pass.
757 for (pattern
= 1, offset
= 0; offset
< num_words
; pattern
++, offset
++) {
760 if (temp
!= pattern
) {
761 printf("\nFAILURE (read/write) @ 0x%.8lx:"
762 " expected 0x%.8lx, actual 0x%.8lx)\n",
763 start_addr
+ offset
*sizeof(vu_long
),
770 anti_pattern
= ~pattern
;
771 addr
[offset
] = anti_pattern
;
775 * Check each location for the inverted pattern and zero it.
777 for (pattern
= 1, offset
= 0; offset
< num_words
; pattern
++, offset
++) {
779 anti_pattern
= ~pattern
;
781 if (temp
!= anti_pattern
) {
782 printf("\nFAILURE (read/write): @ 0x%.8lx:"
783 " expected 0x%.8lx, actual 0x%.8lx)\n",
784 start_addr
+ offset
*sizeof(vu_long
),
796 static ulong
mem_test_quick(vu_long
*buf
, ulong start_addr
, ulong end_addr
,
797 vu_long pattern
, int iteration
)
805 /* Alternate the pattern */
810 * Flip the pattern each time to make lots of zeros and
811 * then, the next time, lots of ones. We decrement
812 * the "negative" patterns and increment the "positive"
813 * patterns to preserve this feature.
815 if (pattern
& 0x80000000)
816 pattern
= -pattern
; /* complement & increment */
820 length
= (end_addr
- start_addr
) / sizeof(ulong
);
822 printf("\rPattern %08lX Writing..."
824 "\b\b\b\b\b\b\b\b\b\b",
827 for (addr
= buf
, val
= pattern
; addr
< end
; addr
++) {
835 for (addr
= buf
, val
= pattern
; addr
< end
; addr
++) {
838 if (readback
!= val
) {
839 ulong offset
= addr
- buf
;
841 printf("\nMem error @ 0x%08X: "
842 "found %08lX, expected %08lX\n",
843 (uint
)(uintptr_t)(start_addr
+ offset
*sizeof(vu_long
)),
856 * Perform a memory test. A more complete alternative test can be
857 * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until
858 * interrupted by ctrl-c or by a failure of one of the sub-tests.
860 static int do_mem_mtest(cmd_tbl_t
*cmdtp
, int flag
, int argc
,
864 vu_long
*buf
, *dummy
;
865 ulong iteration_limit
= 0;
867 ulong errs
= 0; /* number of errors, or -1 if interrupted */
870 #if defined(CONFIG_SYS_ALT_MEMTEST)
871 const int alt_test
= 1;
873 const int alt_test
= 0;
876 start
= CONFIG_SYS_MEMTEST_START
;
877 end
= CONFIG_SYS_MEMTEST_END
;
880 if (strict_strtoul(argv
[1], 16, &start
) < 0)
881 return CMD_RET_USAGE
;
884 if (strict_strtoul(argv
[2], 16, &end
) < 0)
885 return CMD_RET_USAGE
;
888 if (strict_strtoul(argv
[3], 16, &pattern
) < 0)
889 return CMD_RET_USAGE
;
892 if (strict_strtoul(argv
[4], 16, &iteration_limit
) < 0)
893 return CMD_RET_USAGE
;
896 printf("Refusing to do empty test\n");
900 printf("Testing %08lx ... %08lx:\n", start
, end
);
901 debug("%s:%d: start %#08lx end %#08lx\n", __func__
, __LINE__
,
904 buf
= map_sysmem(start
, end
- start
);
905 dummy
= map_sysmem(CONFIG_SYS_MEMTEST_SCRATCH
, sizeof(vu_long
));
907 !iteration_limit
|| iteration
< iteration_limit
;
914 printf("Iteration: %6d\r", iteration
+ 1);
917 errs
= mem_test_alt(buf
, start
, end
, dummy
);
919 errs
= mem_test_quick(buf
, start
, end
, pattern
,
927 * Work-around for eldk-4.2 which gives this warning if we try to
928 * case in the unmap_sysmem() call:
929 * warning: initialization discards qualifiers from pointer target type
932 void *vbuf
= (void *)buf
;
933 void *vdummy
= (void *)dummy
;
936 unmap_sysmem(vdummy
);
940 /* Memory test was aborted - write a newline to finish off */
944 printf("Tested %d iteration(s) with %lu errors.\n",
951 #endif /* CONFIG_CMD_MEMTEST */
956 * mm{.b, .w, .l, .q} {addr}
957 * nm{.b, .w, .l, .q} {addr}
960 mod_mem(cmd_tbl_t
*cmdtp
, int incrflag
, int flag
, int argc
, char * const argv
[])
963 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
972 return CMD_RET_USAGE
;
974 bootretry_reset_cmd_timeout(); /* got a good command to get here */
975 /* We use the last specified parameters, unless new ones are
981 if ((flag
& CMD_FLAG_REPEAT
) == 0) {
982 /* New command specified. Check for a size specification.
983 * Defaults to long if no or incorrect specification.
985 if ((size
= cmd_get_data_size(argv
[0], 4)) < 0)
988 /* Address is specified since argc > 1
990 addr
= simple_strtoul(argv
[1], NULL
, 16);
991 addr
+= base_address
;
994 /* Print the address, followed by value. Then accept input for
995 * the next value. A non-converted value exits.
998 ptr
= map_sysmem(addr
, size
);
999 printf("%08lx:", addr
);
1001 printf(" %08x", *((u32
*)ptr
));
1002 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1004 printf(" %016" PRIx64
, *((u64
*)ptr
));
1007 printf(" %04x", *((u16
*)ptr
));
1009 printf(" %02x", *((u8
*)ptr
));
1011 nbytes
= cli_readline(" ? ");
1012 if (nbytes
== 0 || (nbytes
== 1 && console_buffer
[0] == '-')) {
1013 /* <CR> pressed as only input, don't modify current
1014 * location and move to next. "-" pressed will go back.
1017 addr
+= nbytes
? -size
: size
;
1019 /* good enough to not time out */
1020 bootretry_reset_cmd_timeout();
1022 #ifdef CONFIG_BOOT_RETRY_TIME
1023 else if (nbytes
== -2) {
1024 break; /* timed out, exit the command */
1029 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1030 i
= simple_strtoull(console_buffer
, &endp
, 16);
1032 i
= simple_strtoul(console_buffer
, &endp
, 16);
1034 nbytes
= endp
- console_buffer
;
1036 /* good enough to not time out
1038 bootretry_reset_cmd_timeout();
1041 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1057 mm_last_addr
= addr
;
1058 mm_last_size
= size
;
1062 #ifdef CONFIG_CMD_CRC32
1064 static int do_mem_crc(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
1071 return CMD_RET_USAGE
;
1075 #ifdef CONFIG_CRC32_VERIFY
1076 if (strcmp(*av
, "-v") == 0) {
1077 flags
|= HASH_FLAG_VERIFY
| HASH_FLAG_ENV
;
1083 return hash_command("crc32", flags
, cmdtp
, flag
, ac
, av
);
1088 /**************************************************/
1090 md
, 3, 1, do_mem_md
,
1092 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1093 "[.b, .w, .l, .q] address [# of objects]"
1095 "[.b, .w, .l] address [# of objects]"
1101 mm
, 2, 1, do_mem_mm
,
1102 "memory modify (auto-incrementing address)",
1103 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1104 "[.b, .w, .l, .q] address"
1106 "[.b, .w, .l] address"
1112 nm
, 2, 1, do_mem_nm
,
1113 "memory modify (constant address)",
1114 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1115 "[.b, .w, .l, .q] address"
1117 "[.b, .w, .l] address"
1122 mw
, 4, 1, do_mem_mw
,
1123 "memory write (fill)",
1124 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1125 "[.b, .w, .l, .q] address value [count]"
1127 "[.b, .w, .l] address value [count]"
1132 cp
, 4, 1, do_mem_cp
,
1134 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1135 "[.b, .w, .l, .q] source target count"
1137 "[.b, .w, .l] source target count"
1142 cmp
, 4, 1, do_mem_cmp
,
1144 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1145 "[.b, .w, .l, .q] addr1 addr2 count"
1147 "[.b, .w, .l] addr1 addr2 count"
1151 #ifdef CONFIG_CMD_CRC32
1153 #ifndef CONFIG_CRC32_VERIFY
1156 crc32
, 4, 1, do_mem_crc
,
1157 "checksum calculation",
1158 "address count [addr]\n - compute CRC32 checksum [save at addr]"
1161 #else /* CONFIG_CRC32_VERIFY */
1164 crc32
, 5, 1, do_mem_crc
,
1165 "checksum calculation",
1166 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1167 "-v address count crc\n - verify crc of memory area"
1170 #endif /* CONFIG_CRC32_VERIFY */
1174 #ifdef CONFIG_CMD_MEMINFO
1175 __weak
void board_show_dram(phys_size_t size
)
1178 print_size(size
, "\n");
1181 static int do_mem_info(cmd_tbl_t
*cmdtp
, int flag
, int argc
,
1182 char * const argv
[])
1184 board_show_dram(gd
->ram_size
);
1191 base
, 2, 1, do_mem_base
,
1192 "print or set address offset",
1193 "\n - print address offset for memory commands\n"
1194 "base off\n - set address offset for memory commands to 'off'"
1198 loop
, 3, 1, do_mem_loop
,
1199 "infinite loop on address range",
1200 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1201 "[.b, .w, .l, .q] address number_of_objects"
1203 "[.b, .w, .l] address number_of_objects"
1209 loopw
, 4, 1, do_mem_loopw
,
1210 "infinite write loop on address range",
1211 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1212 "[.b, .w, .l, .q] address number_of_objects data_to_write"
1214 "[.b, .w, .l] address number_of_objects data_to_write"
1217 #endif /* CONFIG_LOOPW */
1219 #ifdef CONFIG_CMD_MEMTEST
1221 mtest
, 5, 1, do_mem_mtest
,
1222 "simple RAM read/write test",
1223 "[start [end [pattern [iterations]]]]"
1225 #endif /* CONFIG_CMD_MEMTEST */
1227 #ifdef CONFIG_MX_CYCLIC
1229 mdc
, 4, 1, do_mem_mdc
,
1230 "memory display cyclic",
1231 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1232 "[.b, .w, .l, .q] address count delay(ms)"
1234 "[.b, .w, .l] address count delay(ms)"
1239 mwc
, 4, 1, do_mem_mwc
,
1240 "memory write cyclic",
1241 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
1242 "[.b, .w, .l, .q] address value delay(ms)"
1244 "[.b, .w, .l] address value delay(ms)"
1247 #endif /* CONFIG_MX_CYCLIC */
1249 #ifdef CONFIG_CMD_MEMINFO
1251 meminfo
, 3, 1, do_mem_info
,
1252 "display memory information",