Author: uwe Date: 2008-03-07 00:18:13 +0100 (Fri, 07 Mar 2008) New Revision: 635
Modified: coreboot-v3/lib/ramtest.c Log: Small fixes for lib/ramtest.c:
- Don't make write_phys/read_phys static, they can be useful elsewhere.
- Rename write_phys/read_phys to ram_write_phys/ram_read_phys for consistency with the other RAM-related functions.
- Simplify some parts of the code a bit.
Signed-off-by: Uwe Hermann uwe@hermann-uwe.de Acked-by: Ronald G. Minnich rminnich@gmail.com
Modified: coreboot-v3/lib/ramtest.c =================================================================== --- coreboot-v3/lib/ramtest.c 2008-03-06 18:26:45 UTC (rev 634) +++ coreboot-v3/lib/ramtest.c 2008-03-06 23:18:13 UTC (rev 635) @@ -29,7 +29,7 @@ * @param addr The memory address to write to. * @param value The value to write into the specified memory address. */ -static void write_phys(unsigned long addr, unsigned long value) +void ram_write_phys(unsigned long addr, unsigned long value) { volatile unsigned long *ptr; ptr = (void *)addr; @@ -42,7 +42,7 @@ * @param addr The memory address to read from. * @return The value read from the specified memory address. */ -static unsigned long read_phys(unsigned long addr) +unsigned long ram_read_phys(unsigned long addr) { volatile unsigned long *ptr; ptr = (void *)addr; @@ -68,7 +68,7 @@ /* Display address being filled. */ if (!(addr & 0xffff)) printk(BIOS_DEBUG, "%lx\r", addr); - write_phys(addr, addr); + ram_write_phys(addr, addr); }; /* Display final address. */ printk(BIOS_DEBUG, "%lx\nDRAM filled.\n", addr); @@ -94,14 +94,13 @@ /* Display address being tested. */ if (!(addr & 0xffff)) printk(BIOS_DEBUG, "%lx\r", addr); - value = read_phys(addr); + value = ram_read_phys(addr); if (value != addr) { /* Display address with error. */ printk(BIOS_ERR, "Fail @%lx Read value=%lx\n", addr, value); - i++; /* Abort after 256 verify errors. */ - if (i > 256) { + if (++i > 256) { printk(BIOS_ERR, "Aborting.\n"); break; } @@ -111,11 +110,8 @@ /* Display final address. */ printk(BIOS_DEBUG, "%lx\r", addr);
- if (i) { - printk(BIOS_DEBUG, "\nDRAM did _NOT_ verify!\n"); - } else { - printk(BIOS_DEBUG, "\nDRAM range verified.\n"); - } + /* Print whether or not the verify failed. */ + printk(BIOS_DEBUG, "\nDRAM range %sverified.", i ? "_NOT_ " : ""); }
/**