[U-Boot] [PATCH 5/7] Add check for ECC errors during SDRAM POST and mtest

Peter Tyser ptyser at xes-inc.com
Tue Nov 10 00:37:08 CET 2009


Add a CONFIG_CHECK_ECC_ERRORS define which causes the SDRAM POST and
mtest command to check for ECC errors during execution.

The 83xx, 85xx, and 86xx architectures currently support enabling
CONFIG_CHECK_ECC_ERRORS.  Other architectures/boards can use it if they
implement an ecc_count() and ecc_info() function.

Signed-off-by: Peter Tyser <ptyser at xes-inc.com>
---
 common/cmd_mem.c      |   10 ++++++++++
 include/common.h      |    6 ++++++
 post/drivers/memory.c |    5 +++++
 3 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index a34b342..efedf79 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -691,6 +691,11 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 		__FUNCTION__, __LINE__, start, end);
 
 	for (;;) {
+#ifdef CONFIG_CHECK_ECC_ERRORS
+		if (ecc_count())
+			ecc_info();
+#endif
+
 		if (ctrlc()) {
 			putc ('\n');
 			return 1;
@@ -917,6 +922,11 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 #else /* The original, quickie test */
 	incr = 1;
 	for (;;) {
+#ifdef CONFIG_CHECK_ECC_ERRORS
+		if (ecc_count())
+			ecc_info();
+#endif
+
 		if (ctrlc()) {
 			putc ('\n');
 			return 1;
diff --git a/include/common.h b/include/common.h
index 7df9afa..e606a74 100644
--- a/include/common.h
+++ b/include/common.h
@@ -310,6 +310,12 @@ void	api_init (void);
 /* common/memsize.c */
 long	get_ram_size  (volatile long *, long);
 
+/* driver/edac/ */
+#ifdef CONFIG_CHECK_ECC_ERRORS
+void ecc_info(void);
+int ecc_count(void);
+#endif
+
 /* $(BOARD)/$(BOARD).c */
 void	reset_phy     (void);
 void	fdc_hw_init   (void);
diff --git a/post/drivers/memory.c b/post/drivers/memory.c
index 0062360..b8bbac5 100644
--- a/post/drivers/memory.c
+++ b/post/drivers/memory.c
@@ -477,6 +477,11 @@ int memory_post_test (int flags)
 		}
 	}
 
+#ifdef CONFIG_CHECK_ECC_ERRORS
+	if (ecc_count())
+		printf("WARNING: %d ECC errors detected!!\n", ecc_count());
+#endif
+
 	return ret;
 }
 
-- 
1.6.2.1



More information about the U-Boot mailing list