From 6891260bdd935a382c95d9fa333922b0dfded68a Mon Sep 17 00:00:00 2001 From: Yuri Tikhonov Date: Thu, 8 May 2008 15:40:39 +0200 Subject: POST: typo fix Signed-off-by: Ilya Yanok --- post/tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'post') diff --git a/post/tests.c b/post/tests.c index 36473e311..5db59d64b 100644 --- a/post/tests.c +++ b/post/tests.c @@ -270,7 +270,7 @@ struct post_test post_list[] = #if CONFIG_POST & CFG_POST_BSPEC4 CONFIG_POST_BSPEC4, #endif -#if CONFIG_POST & CFG_POST_BSPEC4 +#if CONFIG_POST & CFG_POST_BSPEC5 CONFIG_POST_BSPEC5, #endif }; -- cgit v1.2.3 From 6e8ec682268493b8d098f99e17b1ce71b4448977 Mon Sep 17 00:00:00 2001 From: Yuri Tikhonov Date: Thu, 8 May 2008 15:42:47 +0200 Subject: POST: OCM test added. Added OCM test to POST layer. This version runs before all other tests but doesn't yet interrupt post sequence on failure. Signed-off-by: Ilya Yanok Signed-off-by: Yuri Tikhonov --- include/post.h | 1 + post/cpu/ppc4xx/Makefile | 1 + post/cpu/ppc4xx/ocm.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++ post/tests.c | 13 +++++++ 4 files changed, 104 insertions(+) create mode 100644 post/cpu/ppc4xx/ocm.c (limited to 'post') diff --git a/include/post.h b/include/post.h index ee07d2caa..a108c7d7b 100644 --- a/include/post.h +++ b/include/post.h @@ -102,6 +102,7 @@ extern int post_hotkeys_pressed(void); #define CFG_POST_BSPEC3 0x00040000 #define CFG_POST_BSPEC4 0x00080000 #define CFG_POST_BSPEC5 0x00100000 +#define CFG_POST_OCM 0x00200000 #endif /* CONFIG_POST */ diff --git a/post/cpu/ppc4xx/Makefile b/post/cpu/ppc4xx/Makefile index f19dc5d3c..1cfd3bb59 100644 --- a/post/cpu/ppc4xx/Makefile +++ b/post/cpu/ppc4xx/Makefile @@ -29,6 +29,7 @@ COBJS-$(CONFIG_HAS_POST) += cache.o COBJS-$(CONFIG_HAS_POST) += denali_ecc.o COBJS-$(CONFIG_HAS_POST) += ether.o COBJS-$(CONFIG_HAS_POST) += fpu.o +COBJS-$(CONFIG_HAS_POST) += ocm.o COBJS-$(CONFIG_HAS_POST) += spr.o COBJS-$(CONFIG_HAS_POST) += uart.o COBJS-$(CONFIG_HAS_POST) += watchdog.o diff --git a/post/cpu/ppc4xx/ocm.c b/post/cpu/ppc4xx/ocm.c new file mode 100644 index 000000000..88aa93ea1 --- /dev/null +++ b/post/cpu/ppc4xx/ocm.c @@ -0,0 +1,89 @@ +/* + * (C) Copyright 2008 Ilya Yanok, EmCraft Systems, yanok@emcraft.com + * + * Developed for DENX Software Engineering GmbH + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ +#include + +/* + * This test attempts to verify on-chip memory (OCM). Result is written + * to the scratch register and if test succeed it won't be run till next + * power on. + */ + +#include + +#include + +DECLARE_GLOBAL_DATA_PTR; + +#define OCM_TEST_PATTERN1 0x55555555 +#define OCM_TEST_PATTERN2 0xAAAAAAAA + +#if CONFIG_POST & CFG_POST_OCM + +static uint ocm_status_read(void) +{ + return in_be32((void *)CFG_OCM_STATUS_ADDR) & + CFG_OCM_STATUS_MASK; +} + +static void ocm_status_write(uint value) +{ + out_be32((void *)CFG_OCM_STATUS_ADDR, value | + (in_be32((void *)CFG_OCM_STATUS_ADDR) & + ~CFG_OCM_STATUS_MASK)); +} + +static inline int ocm_test_word(uint value, uint *address) +{ + uint read_value; + + *address = value; + sync(); + read_value = *address; + + return (read_value != value); +} + +int ocm_post_test(int flags) +{ + uint old_value; + int ret = 0; + uint *address = (uint*)CFG_OCM_BASE; + + if (ocm_status_read() == CFG_OCM_STATUS_OK) + return 0; + for (; address < (uint*)(CFG_OCM_BASE + CFG_OCM_SIZE); address++) { + old_value = *address; + if (ocm_test_word(OCM_TEST_PATTERN1, address) || + ocm_test_word(OCM_TEST_PATTERN2, address)) { + ret = 1; + *address = old_value; + printf("OCM POST failed at %p!\n", address); + break; + } + *address = old_value; + } + ocm_status_write(ret ? CFG_OCM_STATUS_FAIL : CFG_OCM_STATUS_OK); + return ret; +} +#endif /* CONFIG_POST & CFG_POST_OCM */ diff --git a/post/tests.c b/post/tests.c index 5db59d64b..cdf4c8641 100644 --- a/post/tests.c +++ b/post/tests.c @@ -29,6 +29,7 @@ #include +extern int ocm_post_test (int flags); extern int cache_post_test (int flags); extern int watchdog_post_test (int flags); extern int i2c_post_test (int flags); @@ -60,6 +61,18 @@ extern void sysmon_reloc (void); struct post_test post_list[] = { +#if CONFIG_POST & CFG_POST_OCM + { + "OCM test", + "ocm", + "This test checks on chip memory (OCM).", + POST_ROM | POST_ALWAYS | POST_PREREL | POST_CRITICAL, + &ocm_post_test, + NULL, + NULL, + CFG_POST_OCM + }, +#endif #if CONFIG_POST & CFG_POST_CACHE { "Cache test", -- cgit v1.2.3 From 28a385065882d6cb6ac5f443311ff87887ed7c13 Mon Sep 17 00:00:00 2001 From: Yuri Tikhonov Date: Thu, 8 May 2008 15:45:26 +0200 Subject: POST: add POST_STOP flag Don't run futher tests in case of a test fails that is marked as POST_STOP. Signed-off-by: Ilya Yanok Signed-off-by: Yuri Tikhonov --- include/asm-arm/global_data.h | 1 + include/asm-avr32/global_data.h | 1 + include/asm-blackfin/global_data.h | 1 + include/asm-i386/global_data.h | 1 + include/asm-m68k/global_data.h | 1 + include/asm-microblaze/global_data.h | 1 + include/asm-mips/global_data.h | 1 + include/asm-nios/global_data.h | 1 + include/asm-nios2/global_data.h | 1 + include/asm-ppc/global_data.h | 1 + include/asm-sh/global_data.h | 1 + include/asm-sparc/global_data.h | 2 ++ include/post.h | 1 + post/post.c | 17 +++++++++++++++-- 14 files changed, 29 insertions(+), 2 deletions(-) (limited to 'post') diff --git a/include/asm-arm/global_data.h b/include/asm-arm/global_data.h index 0410b5ef7..b470d0407 100644 --- a/include/asm-arm/global_data.h +++ b/include/asm-arm/global_data.h @@ -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") diff --git a/include/asm-avr32/global_data.h b/include/asm-avr32/global_data.h index daf64bc00..1863b6a4f 100644 --- a/include/asm-avr32/global_data.h +++ b/include/asm-avr32/global_data.h @@ -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") diff --git a/include/asm-blackfin/global_data.h b/include/asm-blackfin/global_data.h index 6debfc745..8d283cfec 100644 --- a/include/asm-blackfin/global_data.h +++ b/include/asm-blackfin/global_data.h @@ -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") diff --git a/include/asm-i386/global_data.h b/include/asm-i386/global_data.h index 68a9ad61e..be41b13c3 100644 --- a/include/asm-i386/global_data.h +++ b/include/asm-i386/global_data.h @@ -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; diff --git a/include/asm-m68k/global_data.h b/include/asm-m68k/global_data.h index c897f2b2a..05191c790 100644 --- a/include/asm-m68k/global_data.h +++ b/include/asm-m68k/global_data.h @@ -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; diff --git a/include/asm-microblaze/global_data.h b/include/asm-microblaze/global_data.h index 91243b22c..e7a8c2020 100644 --- a/include/asm-microblaze/global_data.h +++ b/include/asm-microblaze/global_data.h @@ -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") diff --git a/include/asm-mips/global_data.h b/include/asm-mips/global_data.h index bd9e4dd86..e7b28538d 100644 --- a/include/asm-mips/global_data.h +++ b/include/asm-mips/global_data.h @@ -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") diff --git a/include/asm-nios/global_data.h b/include/asm-nios/global_data.h index ddd66cfd4..bceb41764 100644 --- a/include/asm-nios/global_data.h +++ b/include/asm-nios/global_data.h @@ -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") diff --git a/include/asm-nios2/global_data.h b/include/asm-nios2/global_data.h index ae5f61700..0e7235973 100644 --- a/include/asm-nios2/global_data.h +++ b/include/asm-nios2/global_data.h @@ -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") diff --git a/include/asm-ppc/global_data.h b/include/asm-ppc/global_data.h index 202c8441c..341a3bd94 100644 --- a/include/asm-ppc/global_data.h +++ b/include/asm-ppc/global_data.h @@ -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") diff --git a/include/asm-sh/global_data.h b/include/asm-sh/global_data.h index 521a66ffc..3bfbdb00b 100644 --- a/include/asm-sh/global_data.h +++ b/include/asm-sh/global_data.h @@ -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") diff --git a/include/asm-sparc/global_data.h b/include/asm-sparc/global_data.h index 7c29fc684..e3ef679c5 100644 --- a/include/asm-sparc/global_data.h +++ b/include/asm-sparc/global_data.h @@ -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") diff --git a/include/post.h b/include/post.h index dfed24b48..123623f5c 100644 --- a/include/post.h +++ b/include/post.h @@ -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 | \ diff --git a/post/post.c b/post/post.c index c016c3ae4..d31829ba1 100644 --- a/post/post.c +++ b/post/post.c @@ -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); -- cgit v1.2.3 From 7845d49094c81321021b50a4dbb8864d2f3777e4 Mon Sep 17 00:00:00 2001 From: Yuri Tikhonov Date: Thu, 8 May 2008 15:46:02 +0200 Subject: POST: mark OCM test as POST_STOP Signed-off-by: Ilya Yanok --- post/tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'post') diff --git a/post/tests.c b/post/tests.c index cdf4c8641..a790c789d 100644 --- a/post/tests.c +++ b/post/tests.c @@ -66,7 +66,7 @@ struct post_test post_list[] = "OCM test", "ocm", "This test checks on chip memory (OCM).", - POST_ROM | POST_ALWAYS | POST_PREREL | POST_CRITICAL, + POST_ROM | POST_ALWAYS | POST_PREREL | POST_CRITICAL | POST_STOP, &ocm_post_test, NULL, NULL, -- cgit v1.2.3