summaryrefslogtreecommitdiffstats
path: root/common/memtest.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-10-23 14:51:52 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-11-04 08:03:43 +0100
commit8f2549abb7b4c4b93ee38aba5ed2156e0d4efece (patch)
treed18874b47c119174dfec01b8b1476d501f12d99e /common/memtest.c
parent4ff9e28abc2e31dabde6d71503219b3e50d9f4e3 (diff)
downloadbarebox-8f2549abb7b4c4b93ee38aba5ed2156e0d4efece.tar.gz
memtest: By default only test biggest region
Often enough the biggest free region spans most free RAM, so it doesn't add much value to test the remaining free regions. This patch changes the default behaviour to only test the biggest free region and adds the -t option to test all regions. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/memtest.c')
-rw-r--r--common/memtest.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/common/memtest.c b/common/memtest.c
index 026fd0d..401b902 100644
--- a/common/memtest.c
+++ b/common/memtest.c
@@ -139,6 +139,22 @@ void mem_test_release_regions(struct list_head *list)
}
}
+struct mem_test_resource *mem_test_biggest_region(struct list_head *list)
+{
+ struct mem_test_resource *r, *best = NULL;
+ resource_size_t size = 0;
+
+ list_for_each_entry(r, list, list) {
+ resource_size_t now = resource_size(r->r);
+ if (now > size) {
+ size = now;
+ best = r;
+ }
+ }
+
+ return best;
+}
+
static void mem_test_report_failure(const char *failure_description,
resource_size_t expected_value,
resource_size_t actual_value,