POST: add POST_STOP flag
authorYuri Tikhonov <yur@emcraft.com>
Thu, 8 May 2008 13:45:26 +0000 (15:45 +0200)
committerWolfgang Denk <wd@denx.de>
Tue, 20 May 2008 21:24:37 +0000 (23:24 +0200)
Don't run futher tests in case of a test fails that is marked as
POST_STOP.

Signed-off-by: Ilya Yanok <yanok@emcraft.com>
Signed-off-by: Yuri Tikhonov <yur@emcraft.com>
14 files changed:
include/asm-arm/global_data.h
include/asm-avr32/global_data.h
include/asm-blackfin/global_data.h
include/asm-i386/global_data.h
include/asm-m68k/global_data.h
include/asm-microblaze/global_data.h
include/asm-mips/global_data.h
include/asm-nios/global_data.h
include/asm-nios2/global_data.h
include/asm-ppc/global_data.h
include/asm-sh/global_data.h
include/asm-sparc/global_data.h
include/post.h
post/post.c

index 0410b5ef70c797ac71cbd337107c3957e41966d9..b470d04072286c29897b217ed373561b2da0cc4b 100644 (file)
@@ -61,6 +61,7 @@ typedef       struct  global_data {
 #define        GD_FLG_DEVINIT  0x00002         /* Devices have been initialized        */
 #define        GD_FLG_SILENT   0x00004         /* Silent mode                          */
 #define        GD_FLG_POSTFAIL 0x00008         /* Critical POST test failed            */
+#define        GD_FLG_POSTSTOP 0x00010         /* POST seqeunce aborted                */
 
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r8")
 
index daf64bc0089b6495a49aa134f2fd161b8f2631ae..1863b6a4f19c2828db98feef9aa697dc8816d5f2 100644 (file)
@@ -52,6 +52,7 @@ typedef       struct  global_data {
 #define GD_FLG_DEVINIT 0x00002         /* Devices have been initialized */
 #define GD_FLG_SILENT  0x00004         /* Silent mode                   */
 #define GD_FLG_POSTFAIL        0x00008         /* Critical POST test failed     */
+#define GD_FLG_POSTSTOP        0x00010         /* POST seqeunce aborted         */
 
 #define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm("r5")
 
index 6debfc745130d5ee1fa4d84de46a4c2baf97ae78..8d283cfeca19e7c93c9ec7a93b530c914f2354b2 100644 (file)
@@ -62,6 +62,7 @@ typedef struct global_data {
 #define        GD_FLG_DEVINIT  0x00002 /* Devices have been initialized */
 #define        GD_FLG_SILENT   0x00004 /* Silent mode                   */
 #define        GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed     */
+#define        GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted         */
 
 #define DECLARE_GLOBAL_DATA_PTR     register gd_t * volatile gd asm ("P5")
 
index 68a9ad61eface7a2ea9e6adf543a77886f1a15a0..be41b13c336e4f6142f426f39447234a64b896b4 100644 (file)
@@ -55,6 +55,7 @@ typedef       struct {
 #define        GD_FLG_DEVINIT  0x00002         /* Devices have been initialized        */
 #define        GD_FLG_SILENT   0x00004         /* Silent mode                          */
 #define        GD_FLG_POSTFAIL 0x00008         /* Critical POST test failed            */
+#define        GD_FLG_POSTSTOP 0x00010         /* POST seqeunce aborted                */
 
 extern gd_t *global_data;
 
index c897f2b2a856078f165a9573bfdcb13e1698506f..05191c790a69f4f5243bac24cfdb774015a086b1 100644 (file)
@@ -73,6 +73,7 @@ typedef       struct  global_data {
 #define        GD_FLG_DEVINIT  0x00002         /* Devices have been initialized        */
 #define        GD_FLG_SILENT   0x00004         /* Silent mode                          */
 #define        GD_FLG_POSTFAIL 0x00008         /* Critical POST test failed            */
+#define        GD_FLG_POSTSTOP 0x00010         /* POST seqeunce aborted                */
 
 #if 0
 extern gd_t *global_data;
index 91243b22c02557814930be0d43b791f12b003c97..e7a8c20204dc2c2ba89ff5c402cd96431cb94d35 100644 (file)
@@ -53,6 +53,7 @@ typedef       struct  global_data {
 #define        GD_FLG_DEVINIT  0x00002         /* Devices have been initialized        */
 #define        GD_FLG_SILENT   0x00004         /* Silent mode                          */
 #define        GD_FLG_POSTFAIL 0x00008         /* Critical POST test failed            */
+#define        GD_FLG_POSTSTOP 0x00010         /* POST seqeunce aborted                */
 
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r31")
 
index bd9e4dd86210a65cd1ab247df296310d2252f7d7..e7b28538d2c303ed7755751de1bb4023d45a5677 100644 (file)
@@ -55,6 +55,7 @@ typedef       struct  global_data {
 #define        GD_FLG_DEVINIT  0x00002         /* Devices have been initialized */
 #define        GD_FLG_SILENT   0x00004         /* Silent mode                   */
 #define        GD_FLG_POSTFAIL 0x00008         /* Critical POST test failed     */
+#define        GD_FLG_POSTSTOP 0x00010         /* POST seqeunce aborted         */
 
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("k0")
 
index ddd66cfd4008e691907c87a91279384663d7ddfb..bceb4176410197e7a9bfae0d8b3165e49b1ae6c7 100644 (file)
@@ -46,6 +46,7 @@ typedef       struct  global_data {
 #define        GD_FLG_DEVINIT  0x00002         /* Devices have been initialized        */
 #define        GD_FLG_SILENT   0x00004         /* Silent mode                          */
 #define        GD_FLG_POSTFAIL 0x00008         /* Critical POST test failed            */
+#define        GD_FLG_POSTSTOP 0x00010         /* POST seqeunce aborted                */
 
 #define DECLARE_GLOBAL_DATA_PTR     register gd_t *gd asm ("%g7")
 
index ae5f61700e2496217e8507c69f034fa73b0570c0..0e723597331cb1e1fea055c22d594dfad44f9703 100644 (file)
@@ -45,6 +45,7 @@ typedef       struct  global_data {
 #define        GD_FLG_DEVINIT  0x00002         /* Devices have been initialized        */
 #define        GD_FLG_SILENT   0x00004         /* Silent mode                          */
 #define        GD_FLG_POSTFAIL 0x00008         /* Critical POST test failed            */
+#define        GD_FLG_POSTSTOP 0x00010         /* POST seqeunce aborted                */
 
 #define DECLARE_GLOBAL_DATA_PTR     register gd_t *gd asm ("r15")
 
index 202c8441c26aeca1fd6082b4f8ad921d004c24ce..341a3bd947613eeccf1cd40e499cbd8ac025798f 100644 (file)
@@ -168,6 +168,7 @@ typedef     struct  global_data {
 #define        GD_FLG_DEVINIT  0x00002         /* Devices have been initialized        */
 #define        GD_FLG_SILENT   0x00004         /* Silent mode                          */
 #define        GD_FLG_POSTFAIL 0x00008         /* Critical POST test failed            */
+#define        GD_FLG_POSTSTOP 0x00010         /* POST seqeunce aborted                */
 
 #if 1
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r2")
index 521a66ffc30b8e8938b5cff4ef763d4318c3b428..3bfbdb00bfbfae53f70bddef73272b9872e6b69f 100644 (file)
@@ -45,6 +45,7 @@ typedef       struct global_data
 #define        GD_FLG_DEVINIT  0x00002         /* Devices have been initialized        */
 #define        GD_FLG_SILENT   0x00004         /* Silent mode                          */
 #define        GD_FLG_POSTFAIL 0x00008         /* Critical POST test failed            */
+#define        GD_FLG_POSTSTOP 0x00010         /* POST seqeunce aborted                */
 
 #define DECLARE_GLOBAL_DATA_PTR        register gd_t *gd asm ("r13")
 
index 7c29fc6840257b3fc386ea5620669ebe5c57ef68..e3ef679c58cba15b5e0d8c9b113b82b3a90c82f1 100644 (file)
@@ -79,6 +79,8 @@ typedef struct global_data {
 #define        GD_FLG_RELOC    0x00001 /* Code was relocated to RAM            */
 #define        GD_FLG_DEVINIT  0x00002 /* Devices have been initialized        */
 #define        GD_FLG_SILENT   0x00004 /* Silent mode                          */
+#define        GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed            */
+#define        GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted                */
 
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("%g7")
 
index dfed24b48fa24ece301280c4b0682c3c457800a6..123623f5c85981cf465262916252303f0b47d3af 100644 (file)
@@ -43,6 +43,7 @@
 #define POST_PREREL             0x1000  /* test runs before relocation */
 
 #define POST_CRITICAL          0x2000  /* Use failbootcmd if test failed */
+#define POST_STOP              0x4000  /* Interrupt POST sequence on fail */
 
 #define POST_MEM               (POST_RAM | POST_ROM)
 #define POST_ALWAYS            (POST_NORMAL    | \
index c016c3ae4062b8575ee2194697e627168ea244f4..d31829ba162b41c30d5e0672cf5104cd725e3dfc 100644 (file)
@@ -238,14 +238,20 @@ static int post_run_single (struct post_test *test,
                if (test_flags & POST_PREREL) {
                        if ((*test->test) (flags) == 0)
                                post_log_mark_succ ( test->testid );
-                       else if (test_flags & POST_CRITICAL)
-                               gd->flags |= GD_FLG_POSTFAIL;
+                       else {
+                               if (test_flags & POST_CRITICAL)
+                                       gd->flags |= GD_FLG_POSTFAIL;
+                               if (test_flags & POST_STOP)
+                                       gd->flags |= GD_FLG_POSTSTOP;
+                       }
                } else {
                if ((*test->test) (flags) != 0) {
                        post_log ("FAILED\n");
                        show_boot_progress (-32);
                        if (test_flags & POST_CRITICAL)
                                gd->flags |= GD_FLG_POSTFAIL;
+                       if (test_flags & POST_STOP)
+                               gd->flags |= GD_FLG_POSTSTOP;
                }
                else
                        post_log ("PASSED\n");
@@ -271,6 +277,9 @@ int post_run (char *name, int flags)
        if (name == NULL) {
                unsigned int last;
 
+               if (gd->flags & GD_FLG_POSTSTOP)
+                       return 0;
+
                if (post_bootmode_get (&last) & POST_POWERTEST) {
                        if (last & POST_FAIL_SAVE) {
                                last &= ~POST_FAIL_SAVE;
@@ -285,6 +294,8 @@ int post_run (char *name, int flags)
                                                 flags | POST_REBOOT, last);
 
                                for (i = last + 1; i < post_list_size; i++) {
+                                       if (gd->flags & GD_FLG_POSTSTOP)
+                                               break;
                                        post_run_single (post_list + i,
                                                         test_flags[i],
                                                         flags, i);
@@ -292,6 +303,8 @@ int post_run (char *name, int flags)
                        }
                } else {
                        for (i = 0; i < post_list_size; i++) {
+                               if (gd->flags & GD_FLG_POSTSTOP)
+                                       break;
                                post_run_single (post_list + i,
                                                 test_flags[i],
                                                 flags, i);