Return the count of failures from ram_check.
Will be necessary for DBE61 automatic memory size selection.
Signed-off-by: Mart Raudsepp mart.raudsepp@artecdesign.ee --- include/lib.h | 2 +- lib/ramtest.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/include/lib.h b/include/lib.h index 31c685d..2132b2f 100644 --- a/include/lib.h +++ b/include/lib.h @@ -50,6 +50,6 @@ void beep_short(void); void beep_long(void);
/* Optional ramtest. */ -void ram_check(unsigned long start, unsigned long stop); +int ram_check(unsigned long start, unsigned long stop);
#endif /* LIB_H */ diff --git a/lib/ramtest.c b/lib/ramtest.c index 8a0f4b1..02a4bdb 100644 --- a/lib/ramtest.c +++ b/lib/ramtest.c @@ -84,7 +84,7 @@ static void ram_fill(unsigned long start, unsigned long stop) * @param start The beginning of the RAM area. * @param stop The end of the RAM area. */ -static void ram_verify(unsigned long start, unsigned long stop) +static int ram_verify(unsigned long start, unsigned long stop) { unsigned long addr, value; int i = 0; @@ -112,6 +112,7 @@ static void ram_verify(unsigned long start, unsigned long stop)
/* Print whether or not the verify failed. */ printk(BIOS_DEBUG, "\nDRAM range %sverified.", i ? "_NOT_ " : ""); + return i; }
/** @@ -123,11 +124,14 @@ static void ram_verify(unsigned long start, unsigned long stop) * * @param start The beginning of the RAM area. * @param stop The end of the RAM area. + * @return verify failure count */ -void ram_check(unsigned long start, unsigned long stop) +int ram_check(unsigned long start, unsigned long stop) { + int result; printk(BIOS_DEBUG, "Testing DRAM: %lx-%lx\n", start, stop); ram_fill(start, stop); - ram_verify(start, stop); + result = ram_verify(start, stop); printk(BIOS_DEBUG, "Done.\n"); + return result; }
On 13.11.2008 01:18, Mart Raudsepp wrote:
Return the count of failures from ram_check.
Will be necessary for DBE61 automatic memory size selection.
Signed-off-by: Mart Raudsepp mart.raudsepp@artecdesign.ee
We really want __attribute__((warn_unused_result)) for ram_check.
Besides that, lib/ramtest.c could use some cleanups. ram_read_phys() and ram_write_phys() are nothing but really complicated versions of readl() and writel(). It would be cool if you could tackle that in another patch.
Anyway, this patch improves the current situation, so it is Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Regards, Carl-Daniel