Browse Source

fix address of error message in mtest command

This patch deal with error message of mtest command.
When test failed, the mtest command will output error information
that include memory address and value. But the address field is
not correct or misleading.

Signed-off-by: David Feng <fenghua@phytium.com.cn>
David Feng 11 years ago
parent
commit
102c051fcc
1 changed files with 9 additions and 5 deletions
  1. 9 5
      common/cmd_mem.c

+ 9 - 5
common/cmd_mem.c

@@ -746,7 +746,8 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
 		if (temp != pattern) {
 		if (temp != pattern) {
 			printf("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
 			printf("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
 				" expected 0x%.8lx, actual 0x%.8lx\n",
 				" expected 0x%.8lx, actual 0x%.8lx\n",
-				start_addr + offset, pattern, temp);
+				start_addr + offset*sizeof(vu_long),
+				pattern, temp);
 			errs++;
 			errs++;
 			if (ctrlc())
 			if (ctrlc())
 				return -1;
 				return -1;
@@ -767,7 +768,8 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
 				printf("\nFAILURE: Address bit stuck low or"
 				printf("\nFAILURE: Address bit stuck low or"
 					" shorted @ 0x%.8lx: expected 0x%.8lx,"
 					" shorted @ 0x%.8lx: expected 0x%.8lx,"
 					" actual 0x%.8lx\n",
 					" actual 0x%.8lx\n",
-					start_addr + offset, pattern, temp);
+					start_addr + offset*sizeof(vu_long),
+					pattern, temp);
 				errs++;
 				errs++;
 				if (ctrlc())
 				if (ctrlc())
 					return -1;
 					return -1;
@@ -807,7 +809,8 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
 		if (temp != pattern) {
 		if (temp != pattern) {
 			printf("\nFAILURE (read/write) @ 0x%.8lx:"
 			printf("\nFAILURE (read/write) @ 0x%.8lx:"
 				" expected 0x%.8lx, actual 0x%.8lx)\n",
 				" expected 0x%.8lx, actual 0x%.8lx)\n",
-				start_addr + offset, pattern, temp);
+				start_addr + offset*sizeof(vu_long),
+				pattern, temp);
 			errs++;
 			errs++;
 			if (ctrlc())
 			if (ctrlc())
 				return -1;
 				return -1;
@@ -827,7 +830,8 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
 		if (temp != anti_pattern) {
 		if (temp != anti_pattern) {
 			printf("\nFAILURE (read/write): @ 0x%.8lx:"
 			printf("\nFAILURE (read/write): @ 0x%.8lx:"
 				" expected 0x%.8lx, actual 0x%.8lx)\n",
 				" expected 0x%.8lx, actual 0x%.8lx)\n",
-				start_addr + offset, anti_pattern, temp);
+				start_addr + offset*sizeof(vu_long),
+				anti_pattern, temp);
 			errs++;
 			errs++;
 			if (ctrlc())
 			if (ctrlc())
 				return -1;
 				return -1;
@@ -885,7 +889,7 @@ static ulong mem_test_quick(vu_long *buf, ulong start_addr, ulong end_addr,
 
 
 			printf("\nMem error @ 0x%08X: "
 			printf("\nMem error @ 0x%08X: "
 				"found %08lX, expected %08lX\n",
 				"found %08lX, expected %08lX\n",
-				(uint)(uintptr_t)(start_addr + offset),
+				(uint)(uintptr_t)(start_addr + offset*sizeof(vu_long)),
 				readback, val);
 				readback, val);
 			errs++;
 			errs++;
 			if (ctrlc())
 			if (ctrlc())