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>



git-svn-id: svn://coreboot.org/repository/coreboot-v3@635 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Uwe Hermann 2008-03-06 23:18:13 +00:00
parent 29dd0b58e3
commit d3799020d5

View file

@ -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 @@ static void write_phys(unsigned long addr, unsigned long value)
* @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 @@ static void ram_fill(unsigned long start, unsigned long stop)
/* 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 @@ static void ram_verify(unsigned long start, unsigned long stop)
/* 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 @@ static void ram_verify(unsigned long start, unsigned long stop)
/* 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_ " : "");
}
/**