]> git.sur5r.net Git - u-boot/commitdiff
The patch introduces the CRITICAL feature of POST tests. If the test marked as POST_C...
authorYuri Tikhonov <yur@pollux.denx.de>
Mon, 4 Feb 2008 13:11:03 +0000 (14:11 +0100)
committerWolfgang Denk <wd@denx.de>
Tue, 18 Mar 2008 21:24:48 +0000 (22:24 +0100)
Signed-off-by: Dmitry Rakhchev <rda@emcraft.com>
Signed-off-by: Yuri Tikhonov <yur@emcraft.com>
14 files changed:
common/main.c
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/post.h
post/post.c

index 163ba02e62b0df0ef4f37afa6172259abe6a4f70..21e7afab61fde2db49a1de071baafec77bc6f6c3 100644 (file)
@@ -40,7 +40,7 @@
 
 #include <post.h>
 
-#ifdef CONFIG_SILENT_CONSOLE
+#if defined(CONFIG_SILENT_CONSOLE) || defined(CONFIG_POST)
 DECLARE_GLOBAL_DATA_PTR;
 #endif
 
@@ -369,6 +369,12 @@ void main_loop (void)
        init_cmd_timeout ();
 # endif        /* CONFIG_BOOT_RETRY_TIME */
 
+#ifdef CONFIG_POST
+       if (gd->flags & GD_FLG_POSTFAIL) {
+               s = getenv("failbootcmd");
+       }
+       else
+#endif /* CONFIG_POST */
 #ifdef CONFIG_BOOTCOUNT_LIMIT
        if (bootlimit && (bootcount > bootlimit)) {
                printf ("Warning: Bootlimit (%u) exceeded. Using altbootcmd.\n",
index c2d52915a85fc4816dcff69c47e240a98462de8a..0410b5ef70c797ac71cbd337107c3957e41966d9 100644 (file)
@@ -60,6 +60,7 @@ 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 DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r8")
 
index 681c514ccf45d962abd5e5a10c44a8b282581673..daf64bc0089b6495a49aa134f2fd161b8f2631ae 100644 (file)
@@ -51,6 +51,7 @@ 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 DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm("r5")
 
index cb0dfc2d933b587c01c881efab31dad126ec2cfa..6debfc745130d5ee1fa4d84de46a4c2baf97ae78 100644 (file)
@@ -61,6 +61,7 @@ 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 DECLARE_GLOBAL_DATA_PTR     register gd_t * volatile gd asm ("P5")
 
index 1d309d5b50f8cca3d0ddaae06e7013b20b1ef677..68a9ad61eface7a2ea9e6adf543a77886f1a15a0 100644 (file)
@@ -54,6 +54,7 @@ typedef       struct {
 #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            */
 
 extern gd_t *global_data;
 
index 1e26eb037eef92b1a12e8e2d96921a044fe6f2f5..958736ec709d9131b8237dfa8bdd977b71ccfcd8 100644 (file)
@@ -68,6 +68,7 @@ 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            */
 
 #if 0
 extern gd_t *global_data;
index a6e783424efbe862de5ae03c7fb6e838e8b7d7d6..91243b22c02557814930be0d43b791f12b003c97 100644 (file)
@@ -52,6 +52,7 @@ 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 DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r31")
 
index a024194ba32498e532d40cb9f3b2c1ce37d0e5eb..bd9e4dd86210a65cd1ab247df296310d2252f7d7 100644 (file)
@@ -54,6 +54,7 @@ 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 DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("k0")
 
index fd1138920c7507cea4e8502d4c5de3380938b084..ddd66cfd4008e691907c87a91279384663d7ddfb 100644 (file)
@@ -45,6 +45,7 @@ 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 DECLARE_GLOBAL_DATA_PTR     register gd_t *gd asm ("%g7")
 
index a1ac288568260252a2440a0dcaed957cc9527b2b..ae5f61700e2496217e8507c69f034fa73b0570c0 100644 (file)
@@ -44,6 +44,7 @@ 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 DECLARE_GLOBAL_DATA_PTR     register gd_t *gd asm ("r15")
 
index 205f7ed74b8ac206d2dabc19fc21207be3ade6a4..e07092baa4d8573d77c4f04208850cdef7cabf95 100644 (file)
@@ -164,6 +164,7 @@ 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            */
 
 #if 1
 #define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r2")
index 0a44a34cef4a4d50b5239af9eea34f307bdca2c2..521a66ffc30b8e8938b5cff4ef763d4318c3b428 100644 (file)
@@ -44,6 +44,7 @@ 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 DECLARE_GLOBAL_DATA_PTR        register gd_t *gd asm ("r13")
 
index 12c0e920010f3b2da4a163ff3fe694197e2c28a5..ee07d2caa2e56edfb7f0eb13a331bfc26ac92c8c 100644 (file)
 #define POST_REBOOT            0x0800  /* test may cause rebooting */
 #define POST_PREREL             0x1000  /* test runs before relocation */
 
+#define POST_CRITICAL          0x2000  /* Use failbootcmd if test failed */
+
 #define POST_MEM               (POST_RAM | POST_ROM)
 #define POST_ALWAYS            (POST_NORMAL    | \
                                 POST_SLOWTEST  | \
                                 POST_MANUAL    | \
                                 POST_POWERON   )
 
+#define POST_FAIL_SAVE         0x80
+
 #ifndef        __ASSEMBLY__
 
 struct post_test {
index 4ff75ee4b12abe44157e4d807516e63c12d2b5c9..1df0657d8b6130d27dce75bab46e63071d27aecb 100644 (file)
@@ -157,8 +157,10 @@ static void post_bootmode_test_off (void)
 
 static void post_get_flags (int *test_flags)
 {
-       int  flag[] = {  POST_POWERON,   POST_NORMAL,   POST_SLOWTEST };
-       char *var[] = { "post_poweron", "post_normal", "post_slowtest" };
+       int  flag[] = {  POST_POWERON,   POST_NORMAL,   POST_SLOWTEST,
+                        POST_CRITICAL };
+       char *var[] = { "post_poweron", "post_normal", "post_slowtest",
+                       "post_critical" };
        int varnum = sizeof (var) / sizeof (var[0]);
        char list[128];                 /* long enough for POST list */
        char *name;
@@ -224,7 +226,9 @@ static int post_run_single (struct post_test *test,
 
                if (!(flags & POST_REBOOT)) {
                        if ((test_flags & POST_REBOOT) && !(flags & POST_MANUAL)) {
-                               post_bootmode_test_on (i);
+                               post_bootmode_test_on (
+                                       (gd->flags & GD_FLG_POSTFAIL) ?
+                                               POST_FAIL_SAVE | i : i);
                        }
 
                        if (test_flags & POST_PREREL)
@@ -236,10 +240,14 @@ 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->test) (flags) != 0) {
                        post_log ("FAILED\n");
                        show_boot_progress (-32);
+                       if (test_flags & POST_CRITICAL)
+                               gd->flags |= GD_FLG_POSTFAIL;
                }
                else
                        post_log ("PASSED\n");
@@ -266,6 +274,10 @@ int post_run (char *name, int flags)
                unsigned int last;
 
                if (post_bootmode_get (&last) & POST_POWERTEST) {
+                       if (last & POST_FAIL_SAVE) {
+                               last &= ~POST_FAIL_SAVE;
+                               gd->flags |= GD_FLG_POSTFAIL;
+                       }
                        if (last < post_list_size &&
                                (flags & test_flags[last] & POST_ALWAYS) &&
                                (flags & test_flags[last] & POST_MEM)) {