mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH/RFC 0/5] Another try for a new memtest implementation
@ 2013-06-03 23:13 Alexander Aring
  2013-06-03 23:13 ` [PATCH 1/5] common: fix codestyle in ALIGN macros Alexander Aring
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Alexander Aring @ 2013-06-03 23:13 UTC (permalink / raw)
  To: barebox

Hi,

this is a new try to get a new memtest implementation into barebox.

I removed the ADDRESS_IN_REGIONS macro, which was a very ugly solution.
The new memtest command used a list and save all unused sdram_regions
of each bank. Then running the mem_test routine on these regions.
After that the memtest command will release the requested sdram_regions.

I removed the start and stop command arguments to make the implementation
easier/understandable and it's not necessary anyway.

Maybe it's better to remove the silent ALIGN and ALIGN_DOWN from the start
and end address in the common mem_test routine, because addresses are already
align.
It is difficult to explain because a end address has the form of 0xXXXXffff
and a ALIGN_DOWN on it with a mask of 3 we have a calculated end address of
0xXXXXfffA which is wrong. (0xXXXXffff - 4) - 1...

Another question is:
Can someone test it with more than one bank, please? :-)

Regards
Alex

Alexander Aring (5):
  common: fix codestyle in ALIGN macros
  common: add ALIGN_DOWN macro
  memtest: remove memtest command
  common: add memtest.c  with mem_test routine
  commands: add new memtest command

 commands/Kconfig   |  17 +-
 commands/Makefile  |   2 +-
 commands/memtest.c | 489 +++++++++++++++++++++--------------------------------
 common/Makefile    |   1 +
 common/memtest.c   | 313 ++++++++++++++++++++++++++++++++++
 include/common.h   |   5 +-
 include/memtest.h  |  14 ++
 7 files changed, 535 insertions(+), 306 deletions(-)
 create mode 100644 common/memtest.c
 create mode 100644 include/memtest.h

-- 
1.8.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/5] common: fix codestyle in ALIGN macros
  2013-06-03 23:13 [PATCH/RFC 0/5] Another try for a new memtest implementation Alexander Aring
@ 2013-06-03 23:13 ` Alexander Aring
  2013-06-03 23:13 ` [PATCH 2/5] common: add ALIGN_DOWN macro Alexander Aring
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Alexander Aring @ 2013-06-03 23:13 UTC (permalink / raw)
  To: barebox

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 include/common.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/common.h b/include/common.h
index 59fcd35..293ca49 100644
--- a/include/common.h
+++ b/include/common.h
@@ -182,8 +182,8 @@ int run_shell(void);
 #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
 #define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
 
-#define ALIGN(x,a)		__ALIGN_MASK(x,(typeof(x))(a)-1)
-#define __ALIGN_MASK(x,mask)	(((x)+(mask))&~(mask))
+#define ALIGN(x, a)		__ALIGN_MASK(x, (typeof(x))(a) - 1)
+#define __ALIGN_MASK(x, mask)	(((x) + (mask)) & ~(mask))
 #define PTR_ALIGN(p, a)		((typeof(p))ALIGN((unsigned long)(p), (a)))
 #define IS_ALIGNED(x, a)		(((x) & ((typeof(x))(a) - 1)) == 0)
 
-- 
1.8.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/5] common: add ALIGN_DOWN macro
  2013-06-03 23:13 [PATCH/RFC 0/5] Another try for a new memtest implementation Alexander Aring
  2013-06-03 23:13 ` [PATCH 1/5] common: fix codestyle in ALIGN macros Alexander Aring
@ 2013-06-03 23:13 ` Alexander Aring
  2013-06-03 23:13 ` [PATCH 3/5] memtest: remove memtest command Alexander Aring
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Alexander Aring @ 2013-06-03 23:13 UTC (permalink / raw)
  To: barebox

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 include/common.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/common.h b/include/common.h
index 293ca49..fc2c8ca 100644
--- a/include/common.h
+++ b/include/common.h
@@ -184,6 +184,7 @@ int run_shell(void);
 
 #define ALIGN(x, a)		__ALIGN_MASK(x, (typeof(x))(a) - 1)
 #define __ALIGN_MASK(x, mask)	(((x) + (mask)) & ~(mask))
+#define ALIGN_DOWN(x, a)	((x) & ~((typeof(x))(a) - 1))
 #define PTR_ALIGN(p, a)		((typeof(p))ALIGN((unsigned long)(p), (a)))
 #define IS_ALIGNED(x, a)		(((x) & ((typeof(x))(a) - 1)) == 0)
 
-- 
1.8.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 3/5] memtest: remove memtest command
  2013-06-03 23:13 [PATCH/RFC 0/5] Another try for a new memtest implementation Alexander Aring
  2013-06-03 23:13 ` [PATCH 1/5] common: fix codestyle in ALIGN macros Alexander Aring
  2013-06-03 23:13 ` [PATCH 2/5] common: add ALIGN_DOWN macro Alexander Aring
@ 2013-06-03 23:13 ` Alexander Aring
  2013-06-03 23:13 ` [PATCH 4/5] common: add memtest.c with mem_test routine Alexander Aring
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Alexander Aring @ 2013-06-03 23:13 UTC (permalink / raw)
  To: barebox

Remove memtest command.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 commands/Kconfig   |   9 --
 commands/Makefile  |   1 -
 commands/memtest.c | 351 -----------------------------------------------------
 3 files changed, 361 deletions(-)
 delete mode 100644 commands/memtest.c

diff --git a/commands/Kconfig b/commands/Kconfig
index 6a759ce..add547f 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -561,15 +561,6 @@ config CMD_NANDTEST
 	select PARTITION_NEED_MTD
 	prompt "nandtest"
 
-config CMD_MTEST
-	tristate
-	prompt "mtest"
-
-config CMD_MTEST_ALTERNATIVE
-	bool
-	depends on CMD_MTEST
-	prompt "alternative mtest implementation"
-
 endmenu
 
 menu "video command"
diff --git a/commands/Makefile b/commands/Makefile
index 953ecc2..9d34a56 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -13,7 +13,6 @@ obj-$(CONFIG_CMD_MW)		+= mw.o
 obj-$(CONFIG_CMD_MEMCMP)	+= memcmp.o
 obj-$(CONFIG_CMD_MEMCPY)	+= memcpy.o
 obj-$(CONFIG_CMD_MEMSET)	+= memset.o
-obj-$(CONFIG_CMD_MTEST)		+= memtest.o
 obj-$(CONFIG_CMD_EDIT)		+= edit.o
 obj-$(CONFIG_CMD_EXEC)		+= exec.o
 obj-$(CONFIG_CMD_SLEEP)		+= sleep.o
diff --git a/commands/memtest.c b/commands/memtest.c
deleted file mode 100644
index 2d64d00..0000000
--- a/commands/memtest.c
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * mtest - Perform a memory test
- *
- * (C) Copyright 2000
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <common.h>
-#include <command.h>
-#include <types.h>
-
-/*
- * Perform a memory test. A more complete alternative test can be
- * configured using CONFIG_CMD_MTEST_ALTERNATIVE. The complete test
- * loops until interrupted by ctrl-c or by a failure of one of the
- * sub-tests.
- */
-#ifdef CONFIG_CMD_MTEST_ALTERNATIVE
-static int mem_test(ulong _start, ulong _end, ulong pattern_unused)
-{
-	vu_long *start = (vu_long *)_start;
-	vu_long *end   = (vu_long *)_end;
-	vu_long *addr;
-	ulong	val;
-	ulong	readback;
-	vu_long	addr_mask;
-	vu_long	offset;
-	vu_long	test_offset;
-	vu_long	pattern;
-	vu_long	temp;
-	vu_long	anti_pattern;
-	vu_long	num_words;
-#ifdef CFG_MEMTEST_SCRATCH
-	vu_long *dummy = (vu_long*)CFG_MEMTEST_SCRATCH;
-#else
-	vu_long *dummy = start;
-#endif
-	int	j;
-	int iterations = 1;
-
-	static const ulong bitpattern[] = {
-		0x00000001,	/* single bit */
-		0x00000003,	/* two adjacent bits */
-		0x00000007,	/* three adjacent bits */
-		0x0000000F,	/* four adjacent bits */
-		0x00000005,	/* two non-adjacent bits */
-		0x00000015,	/* three non-adjacent bits */
-		0x00000055,	/* four non-adjacent bits */
-		0xaaaaaaaa,	/* alternating 1/0 */
-	};
-
-	/* XXX: enforce alignment of start and end? */
-	for (;;) {
-		if (ctrlc()) {
-			putchar ('\n');
-			return 1;
-		}
-
-		printf("Iteration: %6d\r", iterations);
-		iterations++;
-
-		/*
-		 * Data line test: write a pattern to the first
-		 * location, write the 1's complement to a 'parking'
-		 * address (changes the state of the data bus so a
-		 * floating bus doen't give a false OK), and then
-		 * read the value back. Note that we read it back
-		 * into a variable because the next time we read it,
-		 * it might be right (been there, tough to explain to
-		 * the quality guys why it prints a failure when the
-		 * "is" and "should be" are obviously the same in the
-		 * error message).
-		 *
-		 * Rather than exhaustively testing, we test some
-		 * patterns by shifting '1' bits through a field of
-		 * '0's and '0' bits through a field of '1's (i.e.
-		 * pattern and ~pattern).
-		 */
-		addr = start;
-		/* XXX */
-		if (addr == dummy) ++addr;
-		for (j = 0; j < sizeof(bitpattern)/sizeof(bitpattern[0]); j++) {
-		    val = bitpattern[j];
-		    for(; val != 0; val <<= 1) {
-			*addr  = val;
-			*dummy  = ~val; /* clear the test data off of the bus */
-			readback = *addr;
-			if(readback != val) {
-			     printf ("FAILURE (data line): "
-				"expected 0x%08lx, actual 0x%08lx at address 0x%p\n",
-					  val, readback, addr);
-			}
-			*addr  = ~val;
-			*dummy  = val;
-			readback = *addr;
-			if(readback != ~val) {
-			    printf ("FAILURE (data line): "
-				"Is 0x%08lx, should be 0x%08lx at address 0x%p\n",
-					readback, ~val, addr);
-			}
-		    }
-		}
-
-		/*
-		 * Based on code whose Original Author and Copyright
-		 * information follows: Copyright (c) 1998 by Michael
-		 * Barr. This software is placed into the public
-		 * domain and may be used for any purpose. However,
-		 * this notice must not be changed or removed and no
-		 * warranty is either expressed or implied by its
-		 * publication or distribution.
-		 */
-
-		/*
-		 * Address line test
-		 *
-		 * Description: Test the address bus wiring in a
-		 *              memory region by performing a walking
-		 *              1's test on the relevant bits of the
-		 *              address and checking for aliasing.
-		 *              This test will find single-bit
-		 *              address failures such as stuck -high,
-		 *              stuck-low, and shorted pins. The base
-		 *              address and size of the region are
-		 *              selected by the caller.
-		 *
-		 * Notes:	For best results, the selected base
-		 *              address should have enough LSB 0's to
-		 *              guarantee single address bit changes.
-		 *              For example, to test a 64-Kbyte
-		 *              region, select a base address on a
-		 *              64-Kbyte boundary. Also, select the
-		 *              region size as a power-of-two if at
-		 *              all possible.
-		 *
-		 * Returns:     0 if the test succeeds, 1 if the test fails.
-		 *
-		 * ## NOTE ##	Be sure to specify start and end
-		 *              addresses such that addr_mask has
-		 *              lots of bits set. For example an
-		 *              address range of 01000000 02000000 is
-		 *              bad while a range of 01000000
-		 *              01ffffff is perfect.
-		 */
-		addr_mask = ((ulong)end - (ulong)start)/sizeof(vu_long);
-		pattern = (vu_long) 0xaaaaaaaa;
-		anti_pattern = (vu_long) 0x55555555;
-
-		debug("%s:%d: addr mask = 0x%.8lx\n",
-			__FUNCTION__, __LINE__,
-			addr_mask);
-		/*
-		 * Write the default pattern at each of the
-		 * power-of-two offsets.
-		 */
-		for (offset = 1; (offset & addr_mask) != 0; offset <<= 1)
-			start[offset] = pattern;
-
-		/*
-		 * Check for address bits stuck high.
-		 */
-		test_offset = 0;
-		start[test_offset] = anti_pattern;
-
-		for (offset = 1; (offset & addr_mask) != 0; offset <<= 1) {
-		    temp = start[offset];
-		    if (temp != pattern) {
-			printf ("\nFAILURE: Address bit stuck high @ 0x%.8lx:"
-				" expected 0x%.8lx, actual 0x%.8lx\n",
-				(ulong)&start[offset], pattern, temp);
-			return 1;
-		    }
-		}
-		start[test_offset] = pattern;
-
-		/*
-		 * Check for addr bits stuck low or shorted.
-		 */
-		for (test_offset = 1; (test_offset & addr_mask) != 0; test_offset <<= 1) {
-		    start[test_offset] = anti_pattern;
-
-		    for (offset = 1; (offset & addr_mask) != 0; offset <<= 1) {
-			temp = start[offset];
-			if ((temp != pattern) && (offset != test_offset)) {
-			    printf ("\nFAILURE: Address bit stuck low or shorted @"
-				" 0x%.8lx: expected 0x%.8lx, actual 0x%.8lx\n",
-				(ulong)&start[offset], pattern, temp);
-			    return 1;
-			}
-		    }
-		    start[test_offset] = pattern;
-		}
-
-		/*
-		 * Description: Test the integrity of a physical
-		 *		memory device by performing an
-		 *		increment/decrement test over the
-		 *		entire region. In the process every
-		 *		storage bit in the device is tested
-		 *		as a zero and a one. The base address
-		 *		and the size of the region are
-		 *		selected by the caller.
-		 *
-		 * Returns:     0 if the test succeeds, 1 if the test fails.
-		 */
-		num_words = ((ulong)end - (ulong)start)/sizeof(vu_long) + 1;
-
-		/*
-		 * Fill memory with a known pattern.
-		 */
-		for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
-			start[offset] = pattern;
-		}
-
-		/*
-		 * Check each location and invert it for the second pass.
-		 */
-		for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
-		    temp = start[offset];
-		    if (temp != pattern) {
-			printf ("\nFAILURE (read/write) @ 0x%.8lx:"
-				" expected 0x%.8lx, actual 0x%.8lx)\n",
-				(ulong)&start[offset], pattern, temp);
-			return 1;
-		    }
-
-		    anti_pattern = ~pattern;
-		    start[offset] = anti_pattern;
-		}
-
-		/*
-		 * Check each location for the inverted pattern and zero it.
-		 */
-		for (pattern = 1, offset = 0; offset < num_words; pattern++, offset++) {
-		    anti_pattern = ~pattern;
-		    temp = start[offset];
-		    if (temp != anti_pattern) {
-			printf ("\nFAILURE (read/write): @ 0x%.8lx:"
-				" expected 0x%.8lx, actual 0x%.8lx)\n",
-				(ulong)&start[offset], anti_pattern, temp);
-			return 1;
-		    }
-		    start[offset] = 0;
-		}
-	}
-
-}
-#else
-static int mem_test(ulong _start, ulong _end, ulong pattern)
-{
-	vu_long	*addr;
-	vu_long *start = (vu_long *)_start;
-	vu_long *end   = (vu_long *)_end;
-	ulong	val;
-	ulong	readback;
-	ulong	incr;
-	int rcode;
-
-	incr = 1;
-	for (;;) {
-		if (ctrlc()) {
-			putchar('\n');
-			return 1;
-		}
-
-		printf ("\rPattern 0x%08lX  Writing..."
-			"%12s"
-			"\b\b\b\b\b\b\b\b\b\b",
-			pattern, "");
-
-		for (addr=start,val=pattern; addr<end; addr++) {
-			*addr = val;
-			val  += incr;
-		}
-
-		puts ("Reading...");
-
-		for (addr=start,val=pattern; addr<end; addr++) {
-			readback = *addr;
-			if (readback != val) {
-				printf ("\nMem error @ 0x%08X: "
-					"found 0x%08lX, expected 0x%08lX\n",
-					(uint)addr, readback, val);
-				rcode = 1;
-			}
-			val += incr;
-		}
-
-		/*
-		 * Flip the pattern each time to make lots of zeros and
-		 * then, the next time, lots of ones.  We decrement
-		 * the "negative" patterns and increment the "positive"
-		 * patterns to preserve this feature.
-		 */
-		if(pattern & 0x80000000) {
-			pattern = -pattern;	/* complement & increment */
-		}
-		else {
-			pattern = ~pattern;
-		}
-		incr = -incr;
-	}
-	return rcode;
-}
-#endif
-
-static int do_mem_mtest(int argc, char *argv[])
-{
-	ulong start, end, pattern = 0;
-
-	if (argc < 3)
-		return COMMAND_ERROR_USAGE;
-
-	start = simple_strtoul(argv[1], NULL, 0);
-	end = simple_strtoul(argv[2], NULL, 0);
-
-	if (argc > 3)
-		pattern = simple_strtoul(argv[3], NULL, 0);
-
-	printf ("Testing 0x%08x ... 0x%08x:\n", (uint)start, (uint)end);
-	
-	return mem_test(start, end, pattern);
-}
-
-static const __maybe_unused char cmd_mtest_help[] =
-"Usage: <start> <end> "
-#ifdef CONFIG_CMD_MTEST_ALTERNATIVE
-"[pattern]"
-#endif
-"\nsimple RAM read/write test\n";
-
-BAREBOX_CMD_START(mtest)
-	.cmd		= do_mem_mtest,
-	.usage		= "simple RAM test",
-	BAREBOX_CMD_HELP(cmd_mtest_help)
-BAREBOX_CMD_END
-
-- 
1.8.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 4/5] common: add memtest.c  with mem_test routine
  2013-06-03 23:13 [PATCH/RFC 0/5] Another try for a new memtest implementation Alexander Aring
                   ` (2 preceding siblings ...)
  2013-06-03 23:13 ` [PATCH 3/5] memtest: remove memtest command Alexander Aring
@ 2013-06-03 23:13 ` Alexander Aring
  2013-06-03 23:13 ` [PATCH 5/5] commands: add new memtest command Alexander Aring
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Alexander Aring @ 2013-06-03 23:13 UTC (permalink / raw)
  To: barebox

Add mem_test routine. Useful to detect timing problems if someone
porting a new device to barebox. This test includes a data bus test,
address bus test and integrity check of memory.

This mem_test routine has as parameter start and end address of testing
space. The last parameter can skip the integrity check.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 common/Makefile   |   1 +
 common/memtest.c  | 313 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/memtest.h |  14 +++
 3 files changed, 328 insertions(+)
 create mode 100644 common/memtest.c
 create mode 100644 include/memtest.h

diff --git a/common/Makefile b/common/Makefile
index 2f0bd34..d18b6c6 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_MALLOC_DLMALLOC) += dlmalloc.o
 obj-$(CONFIG_MALLOC_TLSF) += tlsf_malloc.o
 obj-$(CONFIG_MALLOC_TLSF) += tlsf.o
 obj-$(CONFIG_MALLOC_DUMMY) += dummy_malloc.o
+obj-$(CONFIG_CMD_MEMTEST) += memtest.o
 obj-y += clock.o
 obj-$(CONFIG_BANNER) += version.o
 obj-$(CONFIG_MEMINFO) += meminfo.o
diff --git a/common/memtest.c b/common/memtest.c
new file mode 100644
index 0000000..22178cf
--- /dev/null
+++ b/common/memtest.c
@@ -0,0 +1,313 @@
+/*
+ * memory_test.c
+ *
+ * Copyright (c) 2013 Alexander Aring <aar@pengutronix.de>, Pengutronix
+ *
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <progress.h>
+#include <common.h>
+#include <memory.h>
+#include <types.h>
+#include <sizes.h>
+#include <memtest.h>
+
+static const resource_size_t bitpattern[] = {
+	0x00000001,	/* single bit */
+	0x00000003,	/* two adjacent bits */
+	0x00000007,	/* three adjacent bits */
+	0x0000000F,	/* four adjacent bits */
+	0x00000005,	/* two non-adjacent bits */
+	0x00000015,	/* three non-adjacent bits */
+	0x00000055,	/* four non-adjacent bits */
+	0xAAAAAAAA,	/* alternating 1/0 */
+};
+
+/*
+ * Perform a memory test. The complete test
+ * loops until interrupted by ctrl-c.
+ *
+ * Prameters:
+ * start: start address for memory test.
+ * end: end address of memory test.
+ * bus_only: skip integrity check and do only a address/data bus
+ *	     testing.
+ *
+ * Return value can be -EINVAL for invalid parameter or -EINTR
+ * if memory test was interrupted.
+ */
+int mem_test(resource_size_t _start,
+	       resource_size_t _end, int bus_only)
+{
+	volatile resource_size_t *start, *dummy, val, readback, offset,
+		offset2, pattern, temp, anti_pattern, num_words;
+	int i;
+
+	_start = ALIGN(_start, sizeof(resource_size_t));
+	_end = ALIGN_DOWN(_end, sizeof(resource_size_t)) - 1;
+
+	if (_end <= _start)
+		return -EINVAL;
+
+	start = (resource_size_t *)_start;
+	/*
+	 * Point the dummy to start[1]
+	 */
+	dummy = start + 1;
+	num_words = (_end - _start + 1)/sizeof(resource_size_t);
+
+	printf("Starting data line test.\n");
+
+	/*
+	 * Data line test: write a pattern to the first
+	 * location, write the 1's complement to a 'parking'
+	 * address (changes the state of the data bus so a
+	 * floating bus doen't give a false OK), and then
+	 * read the value back. Note that we read it back
+	 * into a variable because the next time we read it,
+	 * it might be right (been there, tough to explain to
+	 * the quality guys why it prints a failure when the
+	 * "is" and "should be" are obviously the same in the
+	 * error message).
+	 *
+	 * Rather than exhaustively testing, we test some
+	 * patterns by shifting '1' bits through a field of
+	 * '0's and '0' bits through a field of '1's (i.e.
+	 * pattern and ~pattern).
+	 */
+	for (i = 0; i < ARRAY_SIZE(bitpattern)/
+			sizeof(resource_size_t); i++) {
+		val = bitpattern[i];
+
+		for (; val != 0; val <<= 1) {
+			*start = val;
+			/* clear the test data off of the bus */
+			*dummy = ~val;
+			readback = *start;
+			if (readback != val) {
+				printf("FAILURE (data line): "
+					"expected 0x%08x, actual 0x%08x at address 0x%08x.\n",
+					val, readback, (resource_size_t)start);
+				return -EIO;
+			}
+
+			*start = ~val;
+			*dummy = val;
+			readback = *start;
+			if (readback != ~val) {
+				printf("FAILURE (data line): "
+					"Is 0x%08x, should be 0x%08x at address 0x%08x.\n",
+					readback,
+					~val, (resource_size_t)start);
+				return -EIO;
+			}
+		}
+	}
+
+
+	/*
+	 * Based on code whose Original Author and Copyright
+	 * information follows: Copyright (c) 1998 by Michael
+	 * Barr. This software is placed into the public
+	 * domain and may be used for any purpose. However,
+	 * this notice must not be changed or removed and no
+	 * warranty is either expressed or implied by its
+	 * publication or distribution.
+	 */
+
+	/*
+	 * Address line test
+	 *
+	 * Description: Test the address bus wiring in a
+	 *              memory region by performing a walking
+	 *              1's test on the relevant bits of the
+	 *              address and checking for aliasing.
+	 *              This test will find single-bit
+	 *              address failures such as stuck -high,
+	 *              stuck-low, and shorted pins. The base
+	 *              address and size of the region are
+	 *              selected by the caller.
+	 *
+	 * Notes:	For best results, the selected base
+	 *              address should have enough LSB 0's to
+	 *              guarantee single address bit changes.
+	 *              For example, to test a 64-Kbyte
+	 *              region, select a base address on a
+	 *              64-Kbyte boundary. Also, select the
+	 *              region size as a power-of-two if at
+	 *              all possible.
+	 *
+	 * ## NOTE ##	Be sure to specify start and end
+	 *              addresses such that num_words has
+	 *              lots of bits set. For example an
+	 *              address range of 01000000 02000000 is
+	 *              bad while a range of 01000000
+	 *              01ffffff is perfect.
+	 */
+
+	pattern = 0xAAAAAAAA;
+	anti_pattern = 0x55555555;
+
+	/*
+	 * Write the default pattern at each of the
+	 * power-of-two offsets.
+	 */
+	for (offset = 1; offset <= num_words; offset <<= 1)
+		start[offset] = pattern;
+
+	printf("Check for address bits stuck high.\n");
+
+	/*
+	 * Check for address bits stuck high.
+	 */
+	for (offset = 1; offset <= num_words; offset <<= 1) {
+		temp = start[offset];
+		if (temp != pattern) {
+			printf("FAILURE: Address bit "
+					"stuck high @ 0x%08x:"
+					" expected 0x%08x, actual 0x%08x.\n",
+					(resource_size_t)&start[offset],
+					pattern, temp);
+			return -EIO;
+		}
+	}
+
+	printf("Check for address bits stuck "
+			"low or shorted.\n");
+
+	/*
+	 * Check for address bits stuck low or shorted.
+	 */
+	for (offset2 = 1; offset2 <= num_words; offset2 <<= 1) {
+		start[offset2] = anti_pattern;
+
+		for (offset = 1; offset <= num_words; offset <<= 1) {
+			temp = start[offset];
+
+			if ((temp != pattern) &&
+					(offset != offset2)) {
+				printf("FAILURE: Address bit stuck"
+						" low or shorted @"
+						" 0x%08x: expected 0x%08x, actual 0x%08x.\n",
+						(resource_size_t)&start[offset],
+						pattern, temp);
+				return -EIO;
+			}
+		}
+		start[offset2] = pattern;
+	}
+
+	/*
+	 * We tested only the bus if != 0
+	 * leaving here
+	 */
+	if (bus_only)
+		return 0;
+
+	printf("Starting integrity check of physicaly ram.\n"
+			"Filling ram with patterns...\n");
+
+	/*
+	 * Description: Test the integrity of a physical
+	 *		memory device by performing an
+	 *		increment/decrement test over the
+	 *		entire region. In the process every
+	 *		storage bit in the device is tested
+	 *		as a zero and a one. The base address
+	 *		and the size of the region are
+	 *		selected by the caller.
+	 */
+
+	/*
+	 * Fill memory with a known pattern.
+	 */
+	init_progression_bar(num_words);
+	for (offset = 0; offset < num_words; offset++) {
+		/*
+		 * Every 4K we update the progressbar.
+		 */
+		if (!(offset & (SZ_4K - 1))) {
+			if (ctrlc())
+				return -EINTR;
+			show_progress(offset);
+		}
+
+		start[offset] = offset + 1;
+	}
+	show_progress(offset);
+
+	printf("\nCompare written patterns...\n");
+	/*
+	 * Check each location and invert it for the second pass.
+	 */
+	init_progression_bar(num_words - 1);
+	for (offset = 0; offset < num_words; offset++) {
+		if (!(offset & (SZ_4K - 1))) {
+			if (ctrlc())
+				return -EINTR;
+			show_progress(offset);
+		}
+
+		temp = start[offset];
+		if (temp != (offset + 1)) {
+			printf("\nFAILURE (read/write) @ 0x%08x:"
+					" expected 0x%08x, actual 0x%08x.\n",
+					(resource_size_t)&start[offset],
+					(offset + 1), temp);
+			return -EIO;
+		}
+
+		anti_pattern = ~(offset + 1);
+		start[offset] = anti_pattern;
+	}
+	show_progress(offset);
+
+	printf("\nFilling ram with inverted pattern and compare it...\n");
+	/*
+	 * Check each location for the inverted pattern and zero it.
+	 */
+	init_progression_bar(num_words - 1);
+	for (offset = 0; offset < num_words; offset++) {
+		if (!(offset & (SZ_4K - 1))) {
+			if (ctrlc())
+				return -EINTR;
+			show_progress(offset);
+		}
+
+		anti_pattern = ~(offset + 1);
+		temp = start[offset];
+
+		if (temp != anti_pattern) {
+			printf("\nFAILURE (read/write): @ 0x%08x:"
+					" expected 0x%08x, actual 0x%08x.\n",
+					(resource_size_t)&start[offset],
+					anti_pattern, temp);
+			return -EIO;
+		}
+
+		start[offset] = 0;
+	}
+	show_progress(offset);
+
+	/*
+	 * end of progressbar
+	 */
+	printf("\n");
+
+	return 0;
+}
diff --git a/include/memtest.h b/include/memtest.h
new file mode 100644
index 0000000..a337be8
--- /dev/null
+++ b/include/memtest.h
@@ -0,0 +1,14 @@
+#ifndef __MEMTEST_H
+#define __MEMTEST_H
+
+#include <linux/ioport.h>
+
+struct mem_test_resource {
+	struct resource *r;
+	struct list_head list;
+};
+
+int mem_test(resource_size_t _start,
+		resource_size_t _end, int bus_only);
+
+#endif /* __MEMTEST_H */
-- 
1.8.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 5/5] commands: add new memtest command
  2013-06-03 23:13 [PATCH/RFC 0/5] Another try for a new memtest implementation Alexander Aring
                   ` (3 preceding siblings ...)
  2013-06-03 23:13 ` [PATCH 4/5] common: add memtest.c with mem_test routine Alexander Aring
@ 2013-06-03 23:13 ` Alexander Aring
  2013-06-05 21:15 ` [PATCH/RFC 0/5] Another try for a new memtest implementation Sascha Hauer
  2013-06-06  7:52 ` antonynpavlov
  6 siblings, 0 replies; 9+ messages in thread
From: Alexander Aring @ 2013-06-03 23:13 UTC (permalink / raw)
  To: barebox

This new memtest can test the whole unused memory. The new memtest
command try to request the whole unused sdram regions on all banks and
run the mem_test routine from common/memtest.c on it.

The memtest command has only two parameters;
  -i	Amount of iterations, default 1, iteration of 0 is endless.
  -b	Set this to skip integrity check.(Do only a fast test for bus lines)

If MMU support is enable, memtest try to run memtest twice. The first with
cache enabled, the second with cache disabled.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 commands/Kconfig   |  10 +++
 commands/Makefile  |   1 +
 commands/memtest.c | 250 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 261 insertions(+)
 create mode 100644 commands/memtest.c

diff --git a/commands/Kconfig b/commands/Kconfig
index add547f..9135f5d 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -561,6 +561,16 @@ config CMD_NANDTEST
 	select PARTITION_NEED_MTD
 	prompt "nandtest"
 
+config CMD_MEMTEST
+    tristate
+    prompt "memtest"
+       help
+         The memtest command can test the registered barebox memory.
+         During this test barebox memory regions like heap, stack, ...
+	 will be skipped. If the tested architecture has MMU with PTE
+	 flags support, the memtest is running twice with cache enabled
+	 and with cache disabled
+
 endmenu
 
 menu "video command"
diff --git a/commands/Makefile b/commands/Makefile
index 9d34a56..0ae01a5 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -48,6 +48,7 @@ obj-$(CONFIG_CMD_SAVEENV)	+= saveenv.o
 obj-$(CONFIG_CMD_LOADENV)	+= loadenv.o
 obj-$(CONFIG_CMD_NAND)		+= nand.o
 obj-$(CONFIG_CMD_NANDTEST)	+= nandtest.o
+obj-$(CONFIG_CMD_MEMTEST)	+= memtest.o
 obj-$(CONFIG_CMD_TRUE)		+= true.o
 obj-$(CONFIG_CMD_FALSE)		+= false.o
 obj-$(CONFIG_CMD_VERSION)	+= version.o
diff --git a/commands/memtest.c b/commands/memtest.c
new file mode 100644
index 0000000..a67d868
--- /dev/null
+++ b/commands/memtest.c
@@ -0,0 +1,250 @@
+/*
+ * memtest - Perform a memory test
+ *
+ * (C) Copyright 2013
+ * Alexander Aring <aar@pengutronix.de>, Pengutronix
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <command.h>
+#include <getopt.h>
+#include <asm/mmu.h>
+#include <memory.h>
+
+#include <memtest.h>
+
+static int alloc_memtest_region(struct list_head *list,
+		resource_size_t start, resource_size_t size)
+{
+	struct resource *r_new;
+	struct mem_test_resource *r;
+
+	r = xzalloc(sizeof(struct mem_test_resource));
+	r_new = request_sdram_region("memtest", start, size);
+	if (!r_new)
+		return -EINVAL;
+
+	r->r = r_new;
+	list_add_tail(&r->list, list);
+
+	return 0;
+}
+
+static int request_memtest_regions(struct list_head *list)
+{
+	int ret;
+	struct memory_bank *bank;
+	struct resource *r, *r_prev = NULL;
+	resource_size_t start, end, size;
+
+	for_each_memory_bank(bank) {
+		/*
+		 * If we don't have any allocated region on bank,
+		 * we use the whole bank boundary
+		 */
+		if (list_empty(&bank->res->children)) {
+			start = PAGE_ALIGN(bank->res->start);
+			end = PAGE_ALIGN_DOWN(bank->res->end) - 1;
+			size = end - start + 1;
+
+			ret = alloc_memtest_region(list, start, size);
+			if (ret < 0)
+				return ret;
+
+			continue;
+		}
+
+		/*
+		 * We assume that the regions are sorted in this list
+		 * So the first element has start boundary on bank->res->start
+		 * and the last element hast end boundary on bank->res->end
+		 */
+		list_for_each_entry(r, &bank->res->children, sibling) {
+			/*
+			 * Do on head element for bank boundary
+			 */
+			if (r->sibling.prev == &bank->res->children) {
+				/*
+				 * remember last used element
+				 */
+				start = PAGE_ALIGN(bank->res->start);
+				end = PAGE_ALIGN_DOWN(r->start) - 1;
+				size = end - start + 1;
+				r_prev = r;
+				if (start >= end)
+					continue;
+
+				ret = alloc_memtest_region(list, start, size);
+				if (ret < 0)
+					return ret;
+				continue;
+			}
+			/*
+			 * Between used regions
+			 */
+			start = PAGE_ALIGN(r_prev->end);
+			end = PAGE_ALIGN_DOWN(r->start) - 1;
+			size = end - start + 1;
+			r_prev = r;
+			if (start >= end)
+				continue;
+
+			ret = alloc_memtest_region(list, start, size);
+			if (ret < 0)
+				return ret;
+
+			if (list_is_last(&r->sibling, &bank->res->children)) {
+				/*
+				 * Do on head element for bank boundary
+				 */
+				start = PAGE_ALIGN(r->end);
+				end = PAGE_ALIGN_DOWN(bank->res->end) - 1;
+				size = end - start + 1;
+				if (start >= end)
+					continue;
+
+				ret = alloc_memtest_region(list, start, size);
+				if (ret < 0)
+					return ret;
+			}
+		}
+	}
+
+	return 0;
+}
+
+static int __do_memtest(struct list_head *memtest_regions,
+		int bus_only, uint32_t cache_flag)
+{
+	struct mem_test_resource *r;
+	int ret;
+
+	list_for_each_entry(r, memtest_regions, list) {
+		printf("Testing memory space: "
+				"0x%08x -> 0x%08x:\n",
+				r->r->start,  r->r->end);
+		remap_range((void *)r->r->start, r->r->end -
+				r->r->start + 1, cache_flag);
+
+		ret = mem_test(r->r->start, r->r->end, bus_only);
+		if (ret < 0)
+			return ret;
+		printf("done.\n\n");
+	}
+
+	return 0;
+}
+
+static int do_memtest(int argc, char *argv[])
+{
+	int bus_only = 0, ret, opt;
+	uint32_t i, max_i = 1, pte_flags_cached, pte_flags_uncached;
+	struct mem_test_resource *r, *r_tmp;
+	struct list_head memtest_used_regions;
+
+	while ((opt = getopt(argc, argv, "i:b")) > 0) {
+		switch (opt) {
+		case 'i':
+			max_i = simple_strtoul(optarg, NULL, 0);
+			break;
+		case 'b':
+			bus_only = 1;
+			break;
+		default:
+			return COMMAND_ERROR_USAGE;
+		}
+	}
+
+	if (optind > argc)
+		return COMMAND_ERROR_USAGE;
+
+	/*
+	 * Get pte flags for enable and disable cache support on page.
+	 */
+	pte_flags_cached = mmu_get_pte_cached_flags();
+	pte_flags_uncached = mmu_get_pte_uncached_flags();
+
+	INIT_LIST_HEAD(&memtest_used_regions);
+
+	ret = request_memtest_regions(&memtest_used_regions);
+	if (ret < 0)
+		goto out;
+
+	for (i = 1; (i <= max_i) || !max_i; i++) {
+		if (max_i)
+			printf("Start iteration %u of %u.\n", i, max_i);
+		/*
+		 * First try a memtest with caching enabled.
+		 */
+		if (IS_ENABLED(CONFIG_MMU)) {
+			printf("Do memtest with caching enabled.\n");
+			ret = __do_memtest(&memtest_used_regions,
+					bus_only, pte_flags_cached);
+			if (ret < 0)
+				goto out;
+		}
+		/*
+		 * Second try a memtest with caching disabled.
+		 */
+		printf("Do memtest with caching disabled.\n");
+		ret = __do_memtest(&memtest_used_regions,
+				bus_only, pte_flags_uncached);
+		if (ret < 0)
+			goto out;
+	}
+
+out:
+	list_for_each_entry_safe(r, r_tmp, &memtest_used_regions, list) {
+		/*
+		 * Ensure to leave with a cached on non used sdram regions.
+		 */
+		remap_range((void *)r->r->start, r->r->end -
+				r->r->start + 1, pte_flags_cached);
+		release_sdram_region(r->r);
+		free(r);
+	}
+
+	if (ret < 0) {
+		/*
+		 * Set cursor to newline, because mem_test failed at
+		 * drawing of progressbar.
+		 */
+		if (ret == -EINTR)
+			printf("\n");
+
+		printf("Memtest failed.\n");
+		return 1;
+	} else {
+		printf("Memtest successful.\n");
+		return 1;
+	}
+}
+
+static const __maybe_unused char cmd_memtest_help[] =
+"Usage: memtest [OPTION]...\n"
+"memtest related commands\n"
+"	-i	<iterations>	iterations [default=1, endless=0].\n"
+"	-b			perform only a test on buslines.";
+
+BAREBOX_CMD_START(memtest)
+	.cmd		= do_memtest,
+	.usage		= "Memory Test",
+	BAREBOX_CMD_HELP(cmd_memtest_help)
+BAREBOX_CMD_END
-- 
1.8.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH/RFC 0/5] Another try for a new memtest implementation
  2013-06-03 23:13 [PATCH/RFC 0/5] Another try for a new memtest implementation Alexander Aring
                   ` (4 preceding siblings ...)
  2013-06-03 23:13 ` [PATCH 5/5] commands: add new memtest command Alexander Aring
@ 2013-06-05 21:15 ` Sascha Hauer
  2013-06-06  7:52 ` antonynpavlov
  6 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2013-06-05 21:15 UTC (permalink / raw)
  To: Alexander Aring; +Cc: barebox

Hi Alex,

On Tue, Jun 04, 2013 at 01:13:47AM +0200, Alexander Aring wrote:
> Hi,
> 
> this is a new try to get a new memtest implementation into barebox.
> 
> I removed the ADDRESS_IN_REGIONS macro, which was a very ugly solution.

Indeed, much nicer now.

> The new memtest command used a list and save all unused sdram_regions
> of each bank. Then running the mem_test routine on these regions.
> After that the memtest command will release the requested sdram_regions.
> 
> I removed the start and stop command arguments to make the implementation
> easier/understandable and it's not necessary anyway.

Specifying a region would be nice, but not really necessary.

> 
> Maybe it's better to remove the silent ALIGN and ALIGN_DOWN from the start
> and end address in the common mem_test routine, because addresses are already
> align.
> It is difficult to explain because a end address has the form of 0xXXXXffff
> and a ALIGN_DOWN on it with a mask of 3 we have a calculated end address of
> 0xXXXXfffA which is wrong. (0xXXXXffff - 4) - 1...
> 
> Another question is:
> Can someone test it with more than one bank, please? :-)

I gave it a test on a karo tx25 board which has two memory banks. It
works just like expected :)

Overall this looks really good now. I just applied it to -next.

Thanks
 Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH/RFC 0/5] Another try for a new memtest implementation
  2013-06-03 23:13 [PATCH/RFC 0/5] Another try for a new memtest implementation Alexander Aring
                   ` (5 preceding siblings ...)
  2013-06-05 21:15 ` [PATCH/RFC 0/5] Another try for a new memtest implementation Sascha Hauer
@ 2013-06-06  7:52 ` antonynpavlov
  2013-06-06 17:52   ` Alexander Aring
  6 siblings, 1 reply; 9+ messages in thread
From: antonynpavlov @ 2013-06-06  7:52 UTC (permalink / raw)
  To: Alexander Aring; +Cc: barebox

On Tue,  4 Jun 2013 01:13:47 +0200
Alexander Aring <alex.aring@gmail.com> wrote:

> Hi,
> 
> this is a new try to get a new memtest implementation into barebox.
> 

I have got the new memtest command from the next branch.

Here is my MIPS qemu-malta build log:

  CC      commands/memtest.o
commands/memtest.c: In function `alloc_memtest_region':
commands/memtest.c:39: warning: implicit declaration of function `xzalloc'
commands/memtest.c:39: warning: assignment makes pointer from integer without a cast
commands/memtest.c:42: error: `EINVAL' undeclared (first use in this function)
commands/memtest.c:42: error: (Each undeclared identifier is reported only once
commands/memtest.c:42: error: for each function it appears in.)
commands/memtest.c: In function `request_memtest_regions':
commands/memtest.c:57: warning: implicit declaration of function `container_of'
commands/memtest.c:57: error: syntax error before "typeof"
commands/memtest.c:57: error: syntax error before "typeof"
commands/memtest.c:64: warning: implicit declaration of function `PAGE_ALIGN_DOWN'
commands/memtest.c:71: error: continue statement not within a loop
commands/memtest.c: At top level:
commands/memtest.c:79: error: syntax error before "for"
commands/memtest.c:79: error: syntax error before '->' token
commands/memtest.c:79: warning: type defaults to `int' in declaration of `prefetch'
commands/memtest.c:79: warning: function declaration isn't a prototype
commands/memtest.c:79: error: conflicting types for 'prefetch'
include/linux/list.h:18: error: previous definition of 'prefetch' was here
commands/memtest.c:79: warning: type defaults to `int' in declaration of `r'
commands/memtest.c:79: error: invalid type argument of `->'
commands/memtest.c:79: error: syntax error before "typeof"
commands/memtest.c:88: warning: type defaults to `int' in declaration of `end'
commands/memtest.c:88: error: invalid type argument of `->'
commands/memtest.c:88: error: initializer element is not constant
commands/memtest.c:88: warning: data definition has no type or storage class
commands/memtest.c:89: warning: type defaults to `int' in declaration of `size'
commands/memtest.c:89: error: `start' undeclared here (not in a function)
commands/memtest.c:89: warning: data definition has no type or storage class
commands/memtest.c:90: warning: type defaults to `int' in declaration of `r_prev'
commands/memtest.c:90: error: initializer element is not constant
commands/memtest.c:90: warning: data definition has no type or storage class
commands/memtest.c:91: error: syntax error before "if"
commands/memtest.c:94: warning: type defaults to `int' in declaration of `ret'
commands/memtest.c:94: error: `list' undeclared here (not in a function)
commands/memtest.c:94: error: initializer element is not constant
commands/memtest.c:94: warning: data definition has no type or storage class
commands/memtest.c:95: error: syntax error before "if"
commands/memtest.c:102: warning: type defaults to `int' in declaration of `start'
commands/memtest.c:102: warning: implicit declaration of function `PAGE_ALIGN'
commands/memtest.c:102: error: invalid type argument of `->'
commands/memtest.c:102: error: initializer element is not constant
commands/memtest.c:102: warning: data definition has no type or storage class
commands/memtest.c:103: warning: type defaults to `int' in declaration of `end'
commands/memtest.c:103: error: redefinition of 'end'
commands/memtest.c:88: error: previous definition of 'end' was here
commands/memtest.c:103: error: invalid type argument of `->'
commands/memtest.c:103: error: initializer element is not constant
commands/memtest.c:103: warning: data definition has no type or storage class
commands/memtest.c:104: warning: type defaults to `int' in declaration of `size'
commands/memtest.c:104: error: redefinition of 'size'
commands/memtest.c:89: error: previous definition of 'size' was here
commands/memtest.c:104: error: initializer element is not constant
commands/memtest.c:104: warning: data definition has no type or storage class
commands/memtest.c:105: warning: type defaults to `int' in declaration of `r_prev'
commands/memtest.c:105: error: redefinition of 'r_prev'
commands/memtest.c:90: error: previous definition of 'r_prev' was here
commands/memtest.c:105: error: initializer element is not constant
commands/memtest.c:105: warning: data definition has no type or storage class
commands/memtest.c:106: error: syntax error before "if"
commands/memtest.c:109: warning: type defaults to `int' in declaration of `ret'
commands/memtest.c:109: error: redefinition of 'ret'
commands/memtest.c:94: error: previous definition of 'ret' was here
commands/memtest.c:109: error: initializer element is not constant
commands/memtest.c:109: warning: data definition has no type or storage class
commands/memtest.c:110: error: syntax error before "if"
commands/memtest.c:118: warning: type defaults to `int' in declaration of `end'
commands/memtest.c:118: error: redefinition of 'end'
commands/memtest.c:103: error: previous definition of 'end' was here
commands/memtest.c:118: error: redefinition of 'end'
commands/memtest.c:103: error: previous definition of 'end' was here
commands/memtest.c:118: error: `bank' undeclared here (not in a function)
commands/memtest.c:118: error: initializer element is not constant
commands/memtest.c:118: warning: data definition has no type or storage class
commands/memtest.c:119: warning: type defaults to `int' in declaration of `size'
commands/memtest.c:119: error: redefinition of 'size'
commands/memtest.c:104: error: previous definition of 'size' was here
commands/memtest.c:119: error: redefinition of 'size'
commands/memtest.c:104: error: previous definition of 'size' was here
commands/memtest.c:119: error: initializer element is not constant
commands/memtest.c:119: warning: data definition has no type or storage class
commands/memtest.c:120: error: syntax error before "if"
commands/memtest.c:123: warning: type defaults to `int' in declaration of `ret'
commands/memtest.c:123: error: redefinition of 'ret'
commands/memtest.c:109: error: previous definition of 'ret' was here
commands/memtest.c:123: error: redefinition of 'ret'
commands/memtest.c:109: error: previous definition of 'ret' was here
commands/memtest.c:123: error: initializer element is not constant
commands/memtest.c:123: warning: data definition has no type or storage class
commands/memtest.c:124: error: syntax error before "if"
commands/memtest.c: In function `__do_memtest':
commands/memtest.c:139: error: syntax error before "typeof"
commands/memtest.c:139: error: syntax error before "typeof"
commands/memtest.c:149: warning: implicit declaration of function `printf'
commands/memtest.c: At top level:
commands/memtest.c:152: error: syntax error before "return"
commands/memtest.c: In function `do_memtest':
commands/memtest.c:165: warning: implicit declaration of function `simple_strtoul'
commands/memtest.c:214: error: syntax error before "typeof"
commands/memtest.c:214: error: syntax error before "typeof"
commands/memtest.c:221: warning: implicit declaration of function `free'
commands/memtest.c: At top level:
commands/memtest.c:224: error: syntax error before "if"
commands/memtest.c:232: error: syntax error before string constant
commands/memtest.c:232: warning: type defaults to `int' in declaration of `printf'
commands/memtest.c:232: warning: function declaration isn't a prototype
commands/memtest.c:232: warning: data definition has no type or storage class
make[1]: *** [commands/memtest.o] Error 1
make: *** [commands] Error 2


-- 
-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH/RFC 0/5] Another try for a new memtest implementation
  2013-06-06  7:52 ` antonynpavlov
@ 2013-06-06 17:52   ` Alexander Aring
  0 siblings, 0 replies; 9+ messages in thread
From: Alexander Aring @ 2013-06-06 17:52 UTC (permalink / raw)
  To: antonynpavlov; +Cc: barebox

Hi Antony,

On Thu, Jun 06, 2013 at 11:52:45AM +0400, antonynpavlov@gmail.com wrote:
> On Tue,  4 Jun 2013 01:13:47 +0200
> Alexander Aring <alex.aring@gmail.com> wrote:
> 
> > Hi,
> > 
> > this is a new try to get a new memtest implementation into barebox.
> > 
> 
> I have got the new memtest command from the next branch.
> 
> Here is my MIPS qemu-malta build log:
> 
>   CC      commands/memtest.o
> commands/memtest.c: In function `alloc_memtest_region':
> commands/memtest.c:39: warning: implicit declaration of function `xzalloc'
> commands/memtest.c:39: warning: assignment makes pointer from integer without a cast

thanks for send this notice. I know why this happend.

We get an include from architecure specific header file "asm/mmu.h" and
some mmu.h in other architecure don't include "inside of arch specific
asm/mmu.h" headers like "malloc.h", "errno.h".

I simple forgot to handle this.

I will send a patch "for-next" to add these header files to memtest.

Regards
Alex

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-06-06 17:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-03 23:13 [PATCH/RFC 0/5] Another try for a new memtest implementation Alexander Aring
2013-06-03 23:13 ` [PATCH 1/5] common: fix codestyle in ALIGN macros Alexander Aring
2013-06-03 23:13 ` [PATCH 2/5] common: add ALIGN_DOWN macro Alexander Aring
2013-06-03 23:13 ` [PATCH 3/5] memtest: remove memtest command Alexander Aring
2013-06-03 23:13 ` [PATCH 4/5] common: add memtest.c with mem_test routine Alexander Aring
2013-06-03 23:13 ` [PATCH 5/5] commands: add new memtest command Alexander Aring
2013-06-05 21:15 ` [PATCH/RFC 0/5] Another try for a new memtest implementation Sascha Hauer
2013-06-06  7:52 ` antonynpavlov
2013-06-06 17:52   ` Alexander Aring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox