]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
POST: add progress API
authorMichael Zaidman <michael.zaidman@gmail.com>
Mon, 1 Mar 2010 09:47:36 +0000 (11:47 +0200)
committerWolfgang Denk <wd@denx.de>
Sun, 21 Mar 2010 21:44:58 +0000 (22:44 +0100)
Add POST progress API implemented as weak calls before and after
each call to the POST test callback in the post_run_single routine
of the post.c file.

Signed-off-by: Michael Zaidman <michael.zaidman@gmail.com>
Acked-by: Detlev Zundel <dzu@denx.de>
include/post.h
post/post.c

index 9fcd3cec2f6169bb2c43a12373d42de00cbb74c8..ff83bce6b4e9753d0d2587ae1a43becf69a3a895 100644 (file)
 
 #define POST_FAIL_SAVE         0x80
 
+#define POST_BEFORE            1
+#define POST_AFTER             0
+#define POST_PASSED            1
+#define POST_FAILED            0
+
 #ifndef        __ASSEMBLY__
 
 struct post_test {
index b29eb87fc2113701ca8c92618b62bdf568ee8e24..00e835325c55a6fef9c4f77def182b77c5d0d106 100644 (file)
@@ -231,6 +231,12 @@ static void post_get_flags (int *test_flags)
        }
 }
 
+void __show_post_progress (unsigned int test_num, int before, int result)
+{
+}
+void show_post_progress (unsigned int, int, int)
+                       __attribute__((weak, alias("__show_post_progress")));
+
 static int post_run_single (struct post_test *test,
                                int test_flags, int flags, unsigned int i)
 {
@@ -248,13 +254,18 @@ static int post_run_single (struct post_test *test,
                        if (test_flags & POST_PREREL)
                                post_log_mark_start ( test->testid );
                        else
-                       post_log ("POST %s ", test->cmd);
+                               post_log ("POST %s ", test->cmd);
                }
 
+               show_post_progress(i, POST_BEFORE, POST_FAILED);
+
                if (test_flags & POST_PREREL) {
-                       if ((*test->test) (flags) == 0)
+                       if ((*test->test) (flags) == 0) {
                                post_log_mark_succ ( test->testid );
+                               show_post_progress(i, POST_AFTER, POST_PASSED);
+                       }
                        else {
+                               show_post_progress(i, POST_AFTER, POST_FAILED);
                                if (test_flags & POST_CRITICAL)
                                        gd->flags |= GD_FLG_POSTFAIL;
                                if (test_flags & POST_STOP)
@@ -264,6 +275,7 @@ static int post_run_single (struct post_test *test,
                if ((*test->test) (flags) != 0) {
                        post_log ("FAILED\n");
                        show_boot_progress (-32);
+                       show_post_progress(i, POST_AFTER, POST_FAILED);
                        if (test_flags & POST_CRITICAL)
                                gd->flags |= GD_FLG_POSTFAIL;
                        if (test_flags & POST_STOP)
@@ -271,6 +283,7 @@ static int post_run_single (struct post_test *test,
                }
                else
                        post_log ("PASSED\n");
+                       show_post_progress(i, POST_AFTER, POST_PASSED);
                }
 
                if ((test_flags & POST_REBOOT) && !(flags & POST_MANUAL)) {