Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

bios: print number of memory errors

  • Loading branch information...
commit 5e6505b94624d3c9e256c94f4ef503899b55a6f0 1 parent b854f1a
Sébastien Bourdeauducq sbourdeauducq authored
Showing with 17 additions and 9 deletions.
  1. +16 −8 software/bios/sdram.c
  2. +1 −1  software/bios/sdram.h
24 software/bios/sdram.c
View
@@ -174,6 +174,7 @@ int memtest_silent(void)
volatile unsigned int *array = (unsigned int *)SDRAM_BASE;
int i;
unsigned int prv;
+ unsigned int error_cnt;
prv = 0;
for(i=0;i<TEST_SIZE/4;i++) {
@@ -182,20 +183,27 @@ int memtest_silent(void)
}
prv = 0;
+ error_cnt = 0;
for(i=0;i<TEST_SIZE/4;i++) {
prv = 1664525*prv + 1013904223;
if(array[i] != prv)
- return 0;
+ error_cnt++;
}
- return 1;
+ return error_cnt;
}
-void memtest(void)
+int memtest(void)
{
- if(memtest_silent())
- printf("OK\n");
- else
- printf("Failed\n");
+ unsigned int e;
+
+ e = memtest_silent();
+ if(e != 0) {
+ printf("Memtest failed: %d/%d words incorrect\n", e, TEST_SIZE/4);
+ return 0;
+ } else {
+ printf("Memtest OK\n");
+ return 1;
+ }
}
int ddrinit(void)
@@ -204,7 +212,7 @@ int ddrinit(void)
init_sequence();
CSR_DFII_CONTROL = DFII_CONTROL_SEL|DFII_CONTROL_CKE;
- if(!memtest_silent())
+ if(!memtest())
return 0;
return 1;
2  software/bios/sdram.h
View
@@ -7,7 +7,7 @@ void ddrrow(char *_row);
void ddrrd(char *startaddr);
void ddrwr(char *startaddr);
int memtest_silent(void);
-void memtest(void);
+int memtest(void);
int ddrinit(void);
void asmiprobe(void);
Please sign in to comment.
Something went wrong with that request. Please try again.