mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 3/9] memtest: split tests in separate functions
Date: Tue, 27 Oct 2015 09:29:56 +0100	[thread overview]
Message-ID: <1445934602-25903-4-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1445934602-25903-1-git-send-email-s.hauer@pengutronix.de>

The memtest does a bus integrity check and a moving inversions test.
Split the tests into two separate functions so that the can be called
separately.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/memtest.c |  9 ++++++++-
 common/memtest.c   | 36 +-----------------------------------
 include/memtest.h  |  4 ++--
 3 files changed, 11 insertions(+), 38 deletions(-)

diff --git a/commands/memtest.c b/commands/memtest.c
index db9e3db..ccccc9c 100644
--- a/commands/memtest.c
+++ b/commands/memtest.c
@@ -41,7 +41,14 @@ static int __do_memtest(struct list_head *memtest_regions,
 		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);
+		ret = mem_test_bus_integrity(r->r->start, r->r->end);
+		if (ret < 0)
+			return ret;
+
+		if (bus_only)
+			continue;
+
+		ret = mem_test_moving_inversions(r->r->start, r->r->end);
 		if (ret < 0)
 			return ret;
 		printf("done.\n\n");
diff --git a/common/memtest.c b/common/memtest.c
index 467eea5..4a84dc3 100644
--- a/common/memtest.c
+++ b/common/memtest.c
@@ -331,8 +331,7 @@ int mem_test_bus_integrity(resource_size_t _start,
 	return 0;
 }
 
-int mem_test_dram(resource_size_t _start,
-		  resource_size_t _end)
+int mem_test_moving_inversions(resource_size_t _start, resource_size_t _end)
 {
 	volatile resource_size_t *start, num_words, offset, temp, anti_pattern;
 
@@ -438,36 +437,3 @@ int mem_test_dram(resource_size_t _start,
 
 	return 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)
-{
-	int ret;
-
-	ret = mem_test_bus_integrity(_start, _end);
-
-	if (ret < 0)
-		return ret;
-
-	/*
-	 * We tested only the bus if != 0
-	 * leaving here
-	 */
-	if (!bus_only)
-		ret = mem_test_dram(_start, _end);
-
-	return ret;
-}
diff --git a/include/memtest.h b/include/memtest.h
index 1c67a73..3979d65 100644
--- a/include/memtest.h
+++ b/include/memtest.h
@@ -11,7 +11,7 @@ struct mem_test_resource {
 int mem_test_request_regions(struct list_head *list);
 void mem_test_release_regions(struct list_head *list);
 
-int mem_test(resource_size_t _start,
-		resource_size_t _end, int bus_only);
+int mem_test_bus_integrity(resource_size_t _start, resource_size_t _end);
+int mem_test_moving_inversions(resource_size_t _start, resource_size_t _end);
 
 #endif /* __MEMTEST_H */
-- 
2.6.1


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

  parent reply	other threads:[~2015-10-27  8:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-27  8:29 memtest updates Sascha Hauer
2015-10-27  8:29 ` [PATCH 1/9] memtest: move request/release regions to common/ Sascha Hauer
2015-10-27  8:29 ` [PATCH 2/9] rework remap_range Sascha Hauer
2015-10-27  8:29 ` Sascha Hauer [this message]
2015-10-27  8:29 ` [PATCH 4/9] memtest: Make output more compact Sascha Hauer
2015-10-27  8:29 ` [PATCH 5/9] memtest: Make comments single line when appropriate Sascha Hauer
2015-10-27  8:29 ` [PATCH 6/9] memtest: move ctrlc check / progress showing into separate function Sascha Hauer
2015-10-27  8:30 ` [PATCH 7/9] memtest: move error handling to end of function Sascha Hauer
2015-10-27  8:30 ` [PATCH 8/9] memtest: By default only test biggest region Sascha Hauer
2015-10-27  8:30 ` [PATCH 9/9] memtest: Make cached/uncached test configurable Sascha Hauer
2015-10-27 16:55 ` memtest updates Alexander Aring
2015-10-27 17:27   ` Alexander Aring
2015-10-27 17:35     ` Alexander Aring
2015-10-28  6:17   ` Sascha Hauer
2015-10-28  9:11     ` Alexander Aring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1445934602-25903-4-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox