Kyösti Mälkki (kyosti.malkki@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/294
-gerrit
commit 1680aa2c434c9899c02241b13e8eba54ea724bc7 Author: Kyösti Mälkki kyosti.malkki@gmail.com Date: Tue Oct 18 14:32:10 2011 +0300
Add test pattern to assist in DIMM configuration.
This is developer's tool. Output from this "rotate ones" -style pattern helps figure out how DIMM addresses are encoded or routed on a certain mainboard.
Change-Id: I533a7a873bcc434f99e7faed9dc9337d9ab64196 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- src/lib/ramtest.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/src/lib/ramtest.c b/src/lib/ramtest.c index 3f4657f..56ce6ed 100644 --- a/src/lib/ramtest.c +++ b/src/lib/ramtest.c @@ -47,6 +47,62 @@ static void phys_memory_barrier(void) #endif }
+static void ram_bitset(unsigned long start) +{ + unsigned long value, value2; + unsigned long addr; + uint8_t i; + uint8_t verbose = 0; + /* + * Fill. + */ +#if CONFIG_CACHE_AS_RAM + printk(BIOS_DEBUG, "DRAM bitset write: 0x%08lx\n", start); +#else + print_debug("DRAM bitset write: 0x"); + print_debug_hex32(start); + print_debug("\n"); +#endif + value = 0x01010101; + for(addr = start; addr < (start + 0x80) ; addr += 4) { + + if ((addr & 0xf0) && (! (addr & 0x0f))) + value <<= 1; + write_phys(addr, value); + }; + phys_memory_barrier(); +#if CONFIG_CACHE_AS_RAM + printk(BIOS_DEBUG, "DRAM bitset verify: 0x%08lx\n", start); +#else + print_debug("DRAM bitset verify: 0x"); + print_debug_hex32(start); + print_debug("\n"); +#endif + value = 0x01010101; + for(addr = start; addr < (start + 0x80) ; addr += 4) { + + if ((addr & 0xf0) && (! (addr & 0x0f))) + value <<= 1; + + value2 = read_phys(addr); + i = (value2 != value); + + if ( i || verbose ) { + print_err_hex32(addr); + print_err(" wr: 0x"); + print_err_hex32(value); + print_err(" rd: 0x"); + print_err_hex32(value2); + } + if (i) + print_err(" FAIL\n"); + else if (verbose) + print_err("\n"); + }; + +} + + static void ram_fill(unsigned long start, unsigned long stop) { unsigned long addr; @@ -174,6 +230,7 @@ void ram_check(unsigned long start, unsigned long stop) print_debug_hex32(stop); print_debug("\n"); #endif + ram_bitset(start); ram_fill(start, stop); /* Make sure we don't read before we wrote */ phys_memory_barrier();