diff options
author | Sven Schnelle <svens@stackframe.org> | 2011-12-02 16:23:06 +0100 |
---|---|---|
committer | Sven Schnelle <svens@stackframe.org> | 2012-01-12 13:26:29 +0100 |
commit | 3ad8c54c01ab16b13eb9fe1cec8516aaed94c426 (patch) | |
tree | 9eb666fefafa01a649f748edf901db25f2c53563 /src | |
parent | 5db45b4d4aa318a7f5b9e9a46607762e74fac823 (diff) | |
download | coreboot-3ad8c54c01ab16b13eb9fe1cec8516aaed94c426.tar.xz |
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 <svens@stackframe.org>
Reviewed-on: http://review.coreboot.org/532
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/include/lib.h | 1 | ||||
-rw-r--r-- | 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 ba9684a0c1..bbe735f89a 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 b35c36d562..e118062c26 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) |