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 9/9] memtest: Make cached/uncached test configurable
Date: Tue, 27 Oct 2015 09:30:02 +0100	[thread overview]
Message-ID: <1445934602-25903-10-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1445934602-25903-1-git-send-email-s.hauer@pengutronix.de>

Add options to explicitly test cached/uncached tests. Without these
options still both cached and uncached is tested if remapping is
supported.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/memtest.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/commands/memtest.c b/commands/memtest.c
index 7853cc5..42bc0b2 100644
--- a/commands/memtest.c
+++ b/commands/memtest.c
@@ -88,10 +88,11 @@ static int do_memtest(int argc, char *argv[])
 	uint32_t i, max_i = 1;
 	struct list_head memtest_used_regions;
 	int (*memtest)(struct list_head *, int, unsigned);
+	int cached = 0, uncached = 0;
 
 	memtest = do_memtest_biggest;
 
-	while ((opt = getopt(argc, argv, "i:bt")) > 0) {
+	while ((opt = getopt(argc, argv, "i:btcu")) > 0) {
 		switch (opt) {
 		case 'i':
 			max_i = simple_strtoul(optarg, NULL, 0);
@@ -102,11 +103,22 @@ static int do_memtest(int argc, char *argv[])
 		case 't':
 			memtest = do_memtest_thorough;
 			break;
+		case 'c':
+			cached = 1;
+			break;
+		case 'u':
+			uncached = 1;
+			break;
 		default:
 			return COMMAND_ERROR_USAGE;
 		}
 	}
 
+	if (!arch_can_remap() && (cached || uncached)) {
+		printf("Cannot map cached or uncached\n");
+		return -EINVAL;
+	}
+
 	if (optind > argc)
 		return COMMAND_ERROR_USAGE;
 
@@ -120,21 +132,23 @@ static int do_memtest(int argc, char *argv[])
 		if (max_i)
 			printf("Start iteration %u of %u.\n", i, max_i);
 
-		if (arch_can_remap()) {
-			/* First do a memtest with caching enabled. */
+		if (cached) {
 			printf("Do memtest with caching enabled.\n");
 			ret = memtest(&memtest_used_regions,
 					bus_only, MAP_CACHED);
 			if (ret < 0)
 				goto out;
+		}
 
-			/* Second do a memtest with caching disabled. */
+		if (uncached) {
 			printf("Do memtest with caching disabled.\n");
 			ret = memtest(&memtest_used_regions,
 					bus_only, MAP_UNCACHED);
 			if (ret < 0)
 				goto out;
-		} else {
+		}
+
+		if (!cached && !uncached) {
 			ret = memtest(&memtest_used_regions,
 					bus_only, MAP_DEFAULT);
 			if (ret < 0)
@@ -166,6 +180,8 @@ BAREBOX_CMD_HELP_START(memtest)
 BAREBOX_CMD_HELP_TEXT("Options:")
 BAREBOX_CMD_HELP_OPT("-i ITERATIONS", "perform number of iterations (default 1, 0 is endless)")
 BAREBOX_CMD_HELP_OPT("-b", "perform only a test on bus lines")
+BAREBOX_CMD_HELP_OPT("-c", "cached. Test using cached memory")
+BAREBOX_CMD_HELP_OPT("-u", "uncached. Test using uncached memory")
 BAREBOX_CMD_HELP_OPT("-t", "thorough. test all free areas. If unset, only test biggest free area")
 BAREBOX_CMD_HELP_END
 
-- 
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 ` [PATCH 3/9] memtest: split tests in separate functions Sascha Hauer
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 ` Sascha Hauer [this message]
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-10-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