3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 * Copied from FADS ROM, Dan Malek (dmalek@jlc.net)
32 #if (CONFIG_COMMANDS & CFG_CMD_MMC)
35 #ifdef CONFIG_HAS_DATAFLASH
36 #include <dataflash.h>
39 #if (CONFIG_COMMANDS & (CFG_CMD_MEMORY | \
44 int cmd_get_data_size(char* arg, int default_size)
46 /* Check for a size specification .b, .w or .l.
48 int len = strlen(arg);
49 if (len > 2 && arg[len-2] == '.') {
67 #if (CONFIG_COMMANDS & CFG_CMD_MEMORY)
70 #define PRINTF(fmt,args...) printf (fmt ,##args)
72 #define PRINTF(fmt,args...)
75 static int mod_mem(cmd_tbl_t *, int, int, int, char *[]);
77 /* Display values from last command.
78 * Memory modify remembered values are different from display memory.
80 uint dp_last_addr, dp_last_size;
81 uint dp_last_length = 0x40;
82 uint mm_last_addr, mm_last_size;
84 static ulong base_address = 0;
89 * md{.b, .w, .l} {addr} {len}
91 #define DISP_LINE_LEN 16
92 int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
95 ulong i, nbytes, linebytes;
100 /* We use the last specified parameters, unless new ones are
105 length = dp_last_length;
108 printf ("Usage:\n%s\n", cmdtp->usage);
112 if ((flag & CMD_FLAG_REPEAT) == 0) {
113 /* New command specified. Check for a size specification.
114 * Defaults to long if no or incorrect specification.
116 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
119 /* Address is specified since argc > 1
121 addr = simple_strtoul(argv[1], NULL, 16);
122 addr += base_address;
124 /* If another parameter, it is the length to display.
125 * Length is the number of objects, not number of bytes.
128 length = simple_strtoul(argv[2], NULL, 16);
133 * We buffer all read data, so we can make sure data is read only
134 * once, and all accesses are with the specified bus width.
136 nbytes = length * size;
138 char linebuf[DISP_LINE_LEN];
139 uint *uip = (uint *)linebuf;
140 ushort *usp = (ushort *)linebuf;
141 u_char *ucp = (u_char *)linebuf;
142 #ifdef CONFIG_HAS_DATAFLASH
145 printf("%08lx:", addr);
146 linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes;
148 #ifdef CONFIG_HAS_DATAFLASH
149 if ((rc = read_dataflash(addr, (linebytes/size)*size, linebuf)) == DATAFLASH_OK){
150 /* if outside dataflash */
152 dataflash_perror (rc);
155 for (i=0; i<linebytes; i+= size) {
157 printf(" %08x", *uip++);
158 } else if (size == 2) {
159 printf(" %04x", *usp++);
161 printf(" %02x", *ucp++);
166 } else { /* addr does not correspond to DataFlash */
168 for (i=0; i<linebytes; i+= size) {
170 printf(" %08x", (*uip++ = *((uint *)addr)));
171 } else if (size == 2) {
172 printf(" %04x", (*usp++ = *((ushort *)addr)));
174 printf(" %02x", (*ucp++ = *((u_char *)addr)));
178 #ifdef CONFIG_HAS_DATAFLASH
183 for (i=0; i<linebytes; i++) {
184 if ((*cp < 0x20) || (*cp > 0x7e))
196 } while (nbytes > 0);
199 dp_last_length = length;
204 int do_mem_mm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
206 return mod_mem (cmdtp, 1, flag, argc, argv);
208 int do_mem_nm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
210 return mod_mem (cmdtp, 0, flag, argc, argv);
213 int do_mem_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
215 ulong addr, writeval, count;
218 if ((argc < 3) || (argc > 4)) {
219 printf ("Usage:\n%s\n", cmdtp->usage);
223 /* Check for size specification.
225 if ((size = cmd_get_data_size(argv[0], 4)) < 1)
228 /* Address is specified since argc > 1
230 addr = simple_strtoul(argv[1], NULL, 16);
231 addr += base_address;
233 /* Get the value to write.
235 writeval = simple_strtoul(argv[2], NULL, 16);
239 count = simple_strtoul(argv[3], NULL, 16);
244 while (count-- > 0) {
246 *((ulong *)addr) = (ulong )writeval;
248 *((ushort *)addr) = (ushort)writeval;
250 *((u_char *)addr) = (u_char)writeval;
256 int do_mem_cmp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
258 ulong addr1, addr2, count, ngood;
263 printf ("Usage:\n%s\n", cmdtp->usage);
267 /* Check for size specification.
269 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
272 addr1 = simple_strtoul(argv[1], NULL, 16);
273 addr1 += base_address;
275 addr2 = simple_strtoul(argv[2], NULL, 16);
276 addr2 += base_address;
278 count = simple_strtoul(argv[3], NULL, 16);
280 #ifdef CONFIG_HAS_DATAFLASH
281 if (addr_dataflash(addr1) | addr_dataflash(addr2)){
282 puts ("Comparison with DataFlash space not supported.\n\r");
289 while (count-- > 0) {
291 ulong word1 = *(ulong *)addr1;
292 ulong word2 = *(ulong *)addr2;
293 if (word1 != word2) {
294 printf("word at 0x%08lx (0x%08lx) "
295 "!= word at 0x%08lx (0x%08lx)\n",
296 addr1, word1, addr2, word2);
301 else if (size == 2) {
302 ushort hword1 = *(ushort *)addr1;
303 ushort hword2 = *(ushort *)addr2;
304 if (hword1 != hword2) {
305 printf("halfword at 0x%08lx (0x%04x) "
306 "!= halfword at 0x%08lx (0x%04x)\n",
307 addr1, hword1, addr2, hword2);
313 u_char byte1 = *(u_char *)addr1;
314 u_char byte2 = *(u_char *)addr2;
315 if (byte1 != byte2) {
316 printf("byte at 0x%08lx (0x%02x) "
317 "!= byte at 0x%08lx (0x%02x)\n",
318 addr1, byte1, addr2, byte2);
328 printf("Total of %ld %s%s were the same\n",
329 ngood, size == 4 ? "word" : size == 2 ? "halfword" : "byte",
330 ngood == 1 ? "" : "s");
334 int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
336 ulong addr, dest, count;
340 printf ("Usage:\n%s\n", cmdtp->usage);
344 /* Check for size specification.
346 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
349 addr = simple_strtoul(argv[1], NULL, 16);
350 addr += base_address;
352 dest = simple_strtoul(argv[2], NULL, 16);
353 dest += base_address;
355 count = simple_strtoul(argv[3], NULL, 16);
358 puts ("Zero length ???\n");
363 /* check if we are copying to Flash */
364 if ( (addr2info(dest) != NULL)
365 #ifdef CONFIG_HAS_DATAFLASH
366 && (!addr_dataflash(addr))
371 puts ("Copy to Flash... ");
373 rc = flash_write ((uchar *)addr, dest, count*size);
383 #if (CONFIG_COMMANDS & CFG_CMD_MMC)
384 if (mmc2info(dest)) {
387 puts ("Copy to MMC... ");
388 switch (rc = mmc_write ((uchar *)addr, dest, count*size)) {
396 printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc);
403 if (mmc2info(addr)) {
406 puts ("Copy from MMC... ");
407 switch (rc = mmc_read (addr, (uchar *)dest, count*size)) {
415 printf ("%s[%d] FIXME: rc=%d\n",__FILE__,__LINE__,rc);
423 #ifdef CONFIG_HAS_DATAFLASH
424 /* Check if we are copying from RAM or Flash to DataFlash */
425 if (addr_dataflash(dest) && !addr_dataflash(addr)){
428 puts ("Copy to DataFlash... ");
430 rc = write_dataflash (dest, addr, count*size);
433 dataflash_perror (rc);
440 /* Check if we are copying from DataFlash to RAM */
441 if (addr_dataflash(addr) && !addr_dataflash(dest) && (addr2info(dest)==NULL) ){
443 rc = read_dataflash(addr, count * size, (char *) dest);
445 dataflash_perror (rc);
451 if (addr_dataflash(addr) && addr_dataflash(dest)){
452 puts ("Unsupported combination of source/destination.\n\r");
457 while (count-- > 0) {
459 *((ulong *)dest) = *((ulong *)addr);
461 *((ushort *)dest) = *((ushort *)addr);
463 *((u_char *)dest) = *((u_char *)addr);
470 int do_mem_base (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
473 /* Set new base address.
475 base_address = simple_strtoul(argv[1], NULL, 16);
477 /* Print the current base address.
479 printf("Base Address: 0x%08lx\n", base_address);
483 int do_mem_loop (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
485 ulong addr, length, i, junk;
487 volatile uint *longp;
488 volatile ushort *shortp;
492 printf ("Usage:\n%s\n", cmdtp->usage);
496 /* Check for a size spefication.
497 * Defaults to long if no or incorrect specification.
499 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
502 /* Address is always specified.
504 addr = simple_strtoul(argv[1], NULL, 16);
506 /* Length is the number of objects, not number of bytes.
508 length = simple_strtoul(argv[2], NULL, 16);
510 /* We want to optimize the loops to run as fast as possible.
511 * If we have only one object, just run infinite loops.
515 longp = (uint *)addr;
520 shortp = (ushort *)addr;
531 longp = (uint *)addr;
539 shortp = (ushort *)addr;
554 * Perform a memory test. A more complete alternative test can be
555 * configured using CFG_ALT_MEMTEST. The complete test loops until
556 * interrupted by ctrl-c or by a failure of one of the sub-tests.
558 int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
560 vu_long *addr, *start, *end;
564 #if defined(CFG_ALT_MEMTEST)
570 vu_long anti_pattern;
572 #if defined(CFG_MEMTEST_SCRATCH)
573 vu_long *dummy = (vu_long*)CFG_MEMTEST_SCRATCH;
575 vu_long *dummy = NULL;
580 static const ulong bitpattern[] = {
581 0x00000001, /* single bit */
582 0x00000003, /* two adjacent bits */
583 0x00000007, /* three adjacent bits */
584 0x0000000F, /* four adjacent bits */
585 0x00000005, /* two non-adjacent bits */
586 0x00000015, /* three non-adjacent bits */
587 0x00000055, /* four non-adjacent bits */
588 0xaaaaaaaa, /* alternating 1/0 */
597 start = (ulong *)simple_strtoul(argv[1], NULL, 16);
599 start = (ulong *)CFG_MEMTEST_START;
603 end = (ulong *)simple_strtoul(argv[2], NULL, 16);
605 end = (ulong *)(CFG_MEMTEST_END);
609 pattern = (ulong)simple_strtoul(argv[3], NULL, 16);
614 #if defined(CFG_ALT_MEMTEST)
615 printf ("Testing %08x ... %08x:\n", (uint)start, (uint)end);
616 PRINTF("%s:%d: start 0x%p end 0x%p\n",
617 __FUNCTION__, __LINE__, start, end);
625 printf("Iteration: %6d\r", iterations);
626 PRINTF("Iteration: %6d\n", iterations);
630 * Data line test: write a pattern to the first
631 * location, write the 1's complement to a 'parking'
632 * address (changes the state of the data bus so a
633 * floating bus doen't give a false OK), and then
634 * read the value back. Note that we read it back
635 * into a variable because the next time we read it,
636 * it might be right (been there, tough to explain to
637 * the quality guys why it prints a failure when the
638 * "is" and "should be" are obviously the same in the
641 * Rather than exhaustively testing, we test some
642 * patterns by shifting '1' bits through a field of
643 * '0's and '0' bits through a field of '1's (i.e.
644 * pattern and ~pattern).
647 for (j = 0; j < sizeof(bitpattern)/sizeof(bitpattern[0]); j++) {
649 for(; val != 0; val <<= 1) {
651 *dummy = ~val; /* clear the test data off of the bus */
653 if(readback != val) {
654 printf ("FAILURE (data line): "
655 "expected %08lx, actual %08lx\n",
661 if(readback != ~val) {
662 printf ("FAILURE (data line): "
663 "Is %08lx, should be %08lx\n",
670 * Based on code whose Original Author and Copyright
671 * information follows: Copyright (c) 1998 by Michael
672 * Barr. This software is placed into the public
673 * domain and may be used for any purpose. However,
674 * this notice must not be changed or removed and no
675 * warranty is either expressed or implied by its
676 * publication or distribution.
682 * Description: Test the address bus wiring in a
683 * memory region by performing a walking
684 * 1's test on the relevant bits of the
685 * address and checking for aliasing.
686 * This test will find single-bit
687 * address failures such as stuck -high,
688 * stuck-low, and shorted pins. The base
689 * address and size of the region are
690 * selected by the caller.
692 * Notes: For best results, the selected base
693 * address should have enough LSB 0's to
694 * guarantee single address bit changes.
695 * For example, to test a 64-Kbyte
696 * region, select a base address on a
697 * 64-Kbyte boundary. Also, select the
698 * region size as a power-of-two if at
701 * Returns: 0 if the test succeeds, 1 if the test fails.
703 * ## NOTE ## Be sure to specify start and end
704 * addresses such that addr_mask has
705 * lots of bits set. For example an
706 * address range of 01000000 02000000 is
707 * bad while a range of 01000000
708 * 01ffffff is perfect.
710 addr_mask = ((ulong)end - (ulong)start)/sizeof(vu_long);
711 pattern = (vu_long) 0xaaaaaaaa;
712 anti_pattern = (vu_long) 0x55555555;
714 PRINTF("%s:%d: addr mask = 0x%.8lx\n",
715 __FUNCTION__, __LINE__,
718 * Write the default pattern at each of the
719 * power-of-two offsets.
721 for (offset = 1; (offset & addr_mask) != 0; offset <<= 1) {
722 start[offset] = pattern;
726 * Check for address bits stuck high.
729 start[test_offset] = anti_pattern;
731 for (offset = 1; (offset & addr_mask) != 0; offset <<= 1) {
732 temp = start[offset];
733 if (temp != pattern) {
734 printf ("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
735 " expected 0x%.8lx, actual 0x%.8lx\n",
736 (ulong)&start[offset], pattern, temp);
740 start[test_offset] = pattern;
743 * Check for addr bits stuck low or shorted.
745 for (test_offset = 1; (test_offset & addr_mask) != 0; test_offset <<= 1) {
746 start[test_offset] = anti_pattern;
748 for (offset = 1; (offset & addr_mask) != 0; offset <<= 1) {
749 temp = start[offset];
750 if ((temp != pattern) && (offset != test_offset)) {
751 printf ("\nFAILURE: Address bit stuck low or shorted @"
752 " 0x%.8lx: expected 0x%.8lx, actual 0x%.8lx\n",
753 (ulong)&start[offset], pattern, temp);
757 start[test_offset] = pattern;
761 * Description: Test the integrity of a physical
762 * memory device by performing an
763 * increment/decrement test over the
764 * entire region. In the process every
765 * storage bit in the device is tested
766 * as a zero and a one. The base address
767 * and the size of the region are
768 * selected by the caller.
770 * Returns: 0 if the test succeeds, 1 if the test fails.
772 num_words = ((ulong)end - (ulong)start)/sizeof(vu_long) + 1;
775 * Fill memory with a known pattern.
777 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
778 start[offset] = pattern;
782 * Check each location and invert it for the second pass.
784 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
785 temp = start[offset];
786 if (temp != pattern) {
787 printf ("\nFAILURE (read/write) @ 0x%.8lx:"
788 " expected 0x%.8lx, actual 0x%.8lx)\n",
789 (ulong)&start[offset], pattern, temp);
793 anti_pattern = ~pattern;
794 start[offset] = anti_pattern;
798 * Check each location for the inverted pattern and zero it.
800 for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
801 anti_pattern = ~pattern;
802 temp = start[offset];
803 if (temp != anti_pattern) {
804 printf ("\nFAILURE (read/write): @ 0x%.8lx:"
805 " expected 0x%.8lx, actual 0x%.8lx)\n",
806 (ulong)&start[offset], anti_pattern, temp);
813 #else /* The original, quickie test */
821 printf ("\rPattern %08lX Writing..."
823 "\b\b\b\b\b\b\b\b\b\b",
826 for (addr=start,val=pattern; addr<end; addr++) {
833 for (addr=start,val=pattern; addr<end; addr++) {
835 if (readback != val) {
836 printf ("\nMem error @ 0x%08X: "
837 "found %08lX, expected %08lX\n",
838 (uint)addr, readback, val);
845 * Flip the pattern each time to make lots of zeros and
846 * then, the next time, lots of ones. We decrement
847 * the "negative" patterns and increment the "positive"
848 * patterns to preserve this feature.
850 if(pattern & 0x80000000) {
851 pattern = -pattern; /* complement & increment */
866 * mm{.b, .w, .l} {addr}
867 * nm{.b, .w, .l} {addr}
870 mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
874 extern char console_buffer[];
877 printf ("Usage:\n%s\n", cmdtp->usage);
881 #ifdef CONFIG_BOOT_RETRY_TIME
882 reset_cmd_timeout(); /* got a good command to get here */
884 /* We use the last specified parameters, unless new ones are
890 if ((flag & CMD_FLAG_REPEAT) == 0) {
891 /* New command specified. Check for a size specification.
892 * Defaults to long if no or incorrect specification.
894 if ((size = cmd_get_data_size(argv[0], 4)) < 0)
897 /* Address is specified since argc > 1
899 addr = simple_strtoul(argv[1], NULL, 16);
900 addr += base_address;
903 #ifdef CONFIG_HAS_DATAFLASH
904 if (addr_dataflash(addr)){
905 puts ("Can't modify DataFlash in place. Use cp instead.\n\r");
910 /* Print the address, followed by value. Then accept input for
911 * the next value. A non-converted value exits.
914 printf("%08lx:", addr);
916 printf(" %08x", *((uint *)addr));
918 printf(" %04x", *((ushort *)addr));
920 printf(" %02x", *((u_char *)addr));
922 nbytes = readline (" ? ");
923 if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
924 /* <CR> pressed as only input, don't modify current
925 * location and move to next. "-" pressed will go back.
928 addr += nbytes ? -size : size;
930 #ifdef CONFIG_BOOT_RETRY_TIME
931 reset_cmd_timeout(); /* good enough to not time out */
934 #ifdef CONFIG_BOOT_RETRY_TIME
935 else if (nbytes == -2) {
936 break; /* timed out, exit the command */
941 i = simple_strtoul(console_buffer, &endp, 16);
942 nbytes = endp - console_buffer;
944 #ifdef CONFIG_BOOT_RETRY_TIME
945 /* good enough to not time out
952 *((ushort *)addr) = i;
954 *((u_char *)addr) = i;
966 #ifndef CONFIG_CRC32_VERIFY
968 int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
975 printf ("Usage:\n%s\n", cmdtp->usage);
979 addr = simple_strtoul (argv[1], NULL, 16);
980 addr += base_address;
982 length = simple_strtoul (argv[2], NULL, 16);
984 crc = crc32 (0, (const uchar *) addr, length);
986 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
987 addr, addr + length - 1, crc);
990 ptr = (ulong *) simple_strtoul (argv[3], NULL, 16);
997 #else /* CONFIG_CRC32_VERIFY */
999 int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
1011 printf ("Usage:\n%s\n", cmdtp->usage);
1017 if (strcmp(*av, "-v") == 0) {
1026 addr = simple_strtoul(*av++, NULL, 16);
1027 addr += base_address;
1028 length = simple_strtoul(*av++, NULL, 16);
1030 crc = crc32(0, (const uchar *) addr, length);
1033 printf ("CRC32 for %08lx ... %08lx ==> %08lx\n",
1034 addr, addr + length - 1, crc);
1036 ptr = (ulong *) simple_strtoul (*av++, NULL, 16);
1040 vcrc = simple_strtoul(*av++, NULL, 16);
1042 printf ("CRC32 for %08lx ... %08lx ==> %08lx != %08lx ** ERROR **\n",
1043 addr, addr + length - 1, crc, vcrc);
1051 #endif /* CONFIG_CRC32_VERIFY */
1053 /**************************************************/
1054 #if (CONFIG_COMMANDS & CFG_CMD_MEMORY)
1056 md, 3, 1, do_mem_md,
1057 "md - memory display\n",
1058 "[.b, .w, .l] address [# of objects]\n - memory display\n"
1063 mm, 2, 1, do_mem_mm,
1064 "mm - memory modify (auto-incrementing)\n",
1065 "[.b, .w, .l] address\n" " - memory modify, auto increment address\n"
1070 nm, 2, 1, do_mem_nm,
1071 "nm - memory modify (constant address)\n",
1072 "[.b, .w, .l] address\n - memory modify, read and keep address\n"
1076 mw, 4, 1, do_mem_mw,
1077 "mw - memory write (fill)\n",
1078 "[.b, .w, .l] address value [count]\n - write memory\n"
1082 cp, 4, 1, do_mem_cp,
1083 "cp - memory copy\n",
1084 "[.b, .w, .l] source target count\n - copy memory\n"
1088 cmp, 4, 1, do_mem_cmp,
1089 "cmp - memory compare\n",
1090 "[.b, .w, .l] addr1 addr2 count\n - compare memory\n"
1093 #ifndef CONFIG_CRC32_VERIFY
1096 crc32, 4, 1, do_mem_crc,
1097 "crc32 - checksum calculation\n",
1098 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1101 #else /* CONFIG_CRC32_VERIFY */
1104 crc32, 5, 1, do_mem_crc,
1105 "crc32 - checksum calculation\n",
1106 "address count [addr]\n - compute CRC32 checksum [save at addr]\n"
1107 "-v address count crc\n - verify crc of memory area\n"
1110 #endif /* CONFIG_CRC32_VERIFY */
1113 base, 2, 1, do_mem_base,
1114 "base - print or set address offset\n",
1115 "\n - print address offset for memory commands\n"
1116 "base off\n - set address offset for memory commands to 'off'\n"
1120 loop, 3, 1, do_mem_loop,
1121 "loop - infinite loop on address range\n",
1122 "[.b, .w, .l] address number_of_objects\n"
1123 " - loop on a set of addresses\n"
1127 mtest, 4, 1, do_mem_mtest,
1128 "mtest - simple RAM test\n",
1129 "[start [end [pattern]]]\n"
1130 " - simple RAM read/write test\n"
1134 #endif /* CFG_CMD_MEMORY */