Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

bios: print number of memory errors

  • Loading branch information...
commit 5e6505b94624d3c9e256c94f4ef503899b55a6f0 1 parent b854f1a
Sébastien Bourdeauducq authored February 24, 2013
24  software/bios/sdram.c
@@ -174,6 +174,7 @@ int memtest_silent(void)
174 174
 	volatile unsigned int *array = (unsigned int *)SDRAM_BASE;
175 175
 	int i;
176 176
 	unsigned int prv;
  177
+	unsigned int error_cnt;
177 178
 	
178 179
 	prv = 0;
179 180
 	for(i=0;i<TEST_SIZE/4;i++) {
@@ -182,20 +183,27 @@ int memtest_silent(void)
182 183
 	}
183 184
 	
184 185
 	prv = 0;
  186
+	error_cnt = 0;
185 187
 	for(i=0;i<TEST_SIZE/4;i++) {
186 188
 		prv = 1664525*prv + 1013904223;
187 189
 		if(array[i] != prv)
188  
-			return 0;
  190
+			error_cnt++;
189 191
 	}
190  
-	return 1;
  192
+	return error_cnt;
191 193
 }
192 194
 
193  
-void memtest(void)
  195
+int memtest(void)
194 196
 {
195  
-	if(memtest_silent())
196  
-		printf("OK\n");
197  
-	else
198  
-		printf("Failed\n");
  197
+	unsigned int e;
  198
+
  199
+	e = memtest_silent();
  200
+	if(e != 0) {
  201
+		printf("Memtest failed: %d/%d words incorrect\n", e, TEST_SIZE/4);
  202
+		return 0;
  203
+	} else {
  204
+		printf("Memtest OK\n");
  205
+		return 1;
  206
+	}
199 207
 }
200 208
 
201 209
 int ddrinit(void)
@@ -204,7 +212,7 @@ int ddrinit(void)
204 212
 	
205 213
 	init_sequence();
206 214
 	CSR_DFII_CONTROL = DFII_CONTROL_SEL|DFII_CONTROL_CKE;
207  
-	if(!memtest_silent())
  215
+	if(!memtest())
208 216
 		return 0;
209 217
 	
210 218
 	return 1;
2  software/bios/sdram.h
@@ -7,7 +7,7 @@ void ddrrow(char *_row);
7 7
 void ddrrd(char *startaddr);
8 8
 void ddrwr(char *startaddr);
9 9
 int memtest_silent(void);
10  
-void memtest(void);
  10
+int memtest(void);
11 11
 int ddrinit(void);
12 12
 
13 13
 void asmiprobe(void);

0 notes on commit 5e6505b

Please sign in to comment.
Something went wrong with that request. Please try again.