Sven Schnelle ([email protected]) just uploaded a new patch set to gerrit, 
which you can find at http://review.coreboot.org/532

-gerrit

commit 616b146ce9c61753407b061c18a687807e4ba238
Author: Sven Schnelle <[email protected]>
Date:   Fri Dec 2 16:23:06 2011 +0100

    lib: add ram_check_nodie
    
    The current implementation calls die() if memory checking fails.
    This isn't always what we want: one might want to print error registers,
    or do some other error handling. Introduce ram_check_nodie() for that
    reason. It returns 0 if ram check succeeded, otherwise 1.
    
    Change-Id: Ib9a9279120755cf63b5b3ba5e0646492c3c29ac2
    Signed-off-by: Sven Schnelle <[email protected]>
---
 src/include/lib.h |    1 +
 src/lib/ramtest.c |   40 +++++++++++++++++++++++++++++++++++++---
 2 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/src/include/lib.h b/src/include/lib.h
index ba9684a..bbe735f 100644
--- a/src/include/lib.h
+++ b/src/include/lib.h
@@ -37,6 +37,7 @@ void move_gdt(void);
 
 /* Defined in src/lib/ramtest.c */
 void ram_check(unsigned long start, unsigned long stop);
+int ram_check_nodie(unsigned long start, unsigned long stop);
 void quick_ram_check(void);
 
 /* Defined in romstage.c */
diff --git a/src/lib/ramtest.c b/src/lib/ramtest.c
index b35c36d..e118062 100644
--- a/src/lib/ramtest.c
+++ b/src/lib/ramtest.c
@@ -83,7 +83,7 @@ static void ram_fill(unsigned long start, unsigned long stop)
 #endif
 }
 
-static void ram_verify(unsigned long start, unsigned long stop)
+static int ram_verify_nodie(unsigned long start, unsigned long stop)
 {
        unsigned long addr;
        int i = 0;
@@ -146,15 +146,17 @@ static void ram_verify(unsigned long start, unsigned long 
stop)
 #else
                print_debug("\nDRAM did _NOT_ verify!\n");
 #endif
-               die("DRAM ERROR");
+               return 1;
        }
        else {
 #if !defined(__ROMCC__)
                printk(BIOS_DEBUG, "\nDRAM range verified.\n");
 #else
                print_debug("\nDRAM range verified.\n");
+               return 0;
 #endif
        }
+       return 0;
 }
 
 
@@ -177,12 +179,44 @@ void ram_check(unsigned long start, unsigned long stop)
        ram_fill(start, stop);
        /* Make sure we don't read before we wrote */
        phys_memory_barrier();
-       ram_verify(start, stop);
+       if (ram_verify_nodie(start, stop))
+               die("DRAM ERROR");
+#if !defined(__ROMCC__)
+       printk(BIOS_DEBUG, "Done.\n");
+#else
+       print_debug("Done.\n");
+#endif
+}
+
+
+int ram_check_nodie(unsigned long start, unsigned long stop)
+{
+       int ret;
+       /*
+        * This is much more of a "Is my DRAM properly configured?"
+        * test than a "Is my DRAM faulty?" test.  Not all bits
+        * are tested.   -Tyson
+        */
+#if !defined(__ROMCC__)
+       printk(BIOS_DEBUG, "Testing DRAM : %08lx - %08lx\n", start, stop);
+#else
+       print_debug("Testing DRAM : ");
+       print_debug_hex32(start);
+       print_debug("-");
+       print_debug_hex32(stop);
+       print_debug("\n");
+#endif
+       ram_fill(start, stop);
+       /* Make sure we don't read before we wrote */
+       phys_memory_barrier();
+       ret = ram_verify_nodie(start, stop);
+
 #if !defined(__ROMCC__)
        printk(BIOS_DEBUG, "Done.\n");
 #else
        print_debug("Done.\n");
 #endif
+       return ret;
 }
 
 void quick_ram_check(void)

-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to