[U-Boot] [RFC PATCH] POST: add test before execution of post_run to avoid unneeded run

Valentin Longchamp valentin.longchamp at keymile.com
Mon Jul 25 16:07:13 CEST 2011


Some boards have the environment variables defined in a slow EEPROM. post_run
accesses these environment variables to define which tests have to be run (in
post_get_flags). This is very slow before the code relocation on some boards
with a slow I2C EEPROM for environement variables.

This patch adds a check at the beginning of post_run to avoid to run
post_get_flags (which may be slow on some boards for the above reason) for some
given POST flags if no tests are defined with these flags (for instance, no need
to run POST tests with POST_ROM if no tests for POST_ROM are defined).

Signed-off-by: Valentin Longchamp <valentin.longchamp at keymile.com>
cc: Holger Brunck <holger.brunck at keymile.com>
cc: Wolfgang Denk <wd at denx.de>
---
 post/post.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/post/post.c b/post/post.c
index 1b7f2aa..d97f330 100644
--- a/post/post.c
+++ b/post/post.c
@@ -169,6 +169,18 @@ static void post_bootmode_test_off (void)
 	post_word_store (word);
 }
 
+static int post_test_defined(int flags)
+{
+	int i;
+	int run_flags = flags & ~(POST_RAM | POST_ROM);
+
+	for (i = 0; i < post_list_size; i++)
+		if (post_list[i].flags & run_flags)
+			return 1;
+
+	return 0;
+}
+
 static void post_get_flags (int *test_flags)
 {
 	int  flag[] = {  POST_POWERON,   POST_NORMAL,   POST_SLOWTEST,
@@ -301,6 +313,9 @@ int post_run (char *name, int flags)
 	unsigned int i;
 	int test_flags[POST_MAX_NUMBER];
 
+	if (!post_test_defined(flags))
+		return 0;
+
 	post_get_flags (test_flags);
 
 	if (name == NULL) {
-- 
1.7.1



More information about the U-Boot mailing list