Skip to contentSkip to conversation

POST: add test before execution of post_run to avoid unneeded run

RFC PATCH New Valentin Longchamp 2 participants 3 messages Jul 25, 2011 – Jul 27, 2011

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 POST: add test before execution of post_run to avoid unneeded run

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).

cc Holger Brunck <[email protected]>
cc Wolfgang Denk <[email protected]>
---
 post/post.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
post/post.c +15 -0
index 1b7f2aa..d97f330 100644
@@ -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) {
Signature · 1 line
1.7.1
#1 lore raw

RFC PATCH 1/1 POST: add test before execution of post_run to avoid unneeded run

Dear Valentin Longchamp,

Quoted 9 lines · In message <[email protected]>…

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).

I think I understand what you are tying to do, but I'm sorry, I cannot understand your code.

post/post.c static void post_bootmode_test_off (void) · line 175

Quoted 12 lines
post/post.c +4 -0
index 1b7f2aa..d97f330 100644
@@ -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);

Why are you masking out the POST_RAM and POST_ROM bits here?

Assuming your intention is to shortcut post_run(), then this should be done always, independent of the mode.

post/post.c static void post_bootmode_test_off (void) · line 179

Quoted 3 lines
post/post.c +3 -0
+	for (i = 0; i < post_list_size; i++)
+		if (post_list[i].flags & run_flags)
+			return 1;

Please try if omitting run_flags and testing

if (post_list[i].flags & flags)

instead still has the intended effect. If so, then please resubmit a cleaned up patch.

If not, then please explain in detail how your patch is supposed to work.

Thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Women are more easily and more deeply terrified ...  generating  more
sheer horror than the male of the species.
	-- Spock, "Wolf in the Fold", stardate 3615.4
#2 lore raw

RFC PATCH 1/1 POST: add test before execution of post_run to avoid unneeded run

Quoted 11 lines · Wolfgang Denk

Please try if omitting run_flags and testing

if (post_list[i].flags & flags)

instead still has the intended effect. If so, then please resubmit a cleaned up patch.

If not, then please explain in detail how your patch is supposed to work.

I agree with you and will test this version and if it works resubmit the patch.

Signature · 13 lines
Valentin Longchamp
Embedded Software Engineer
Hardware and Chip Integration
______________________________________
KEYMILE AG
Schwarzenburgstr. 73
CH-3097 Liebefeld
Phone +41 31 377 1318
Fax   +41 31 377 1212
valentin.longchamp at keymile.com
www.keymile.com
______________________________________
KEYMILE: A Specialist as a Partner