rdram.c
2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* This test consists of two parts. The first part is for stressing both the in- */
/* ternal and external address buses of RDRAMs. Then we check if there is any */
/* short circuit between bits in the second part. */
/* The meaning of the argument is: */
/* 0: Test from 0x0000_0000 to 0x002f_ffff */
/* 1: Test from 0x0030_0000 to 0x003f_ffff */
/* 2: Test from 0x0030_0000 to 0x005f_ffff */
/* 3: Test from 0x0030_0000 to 0x007f_ffff */
/* This routine is ensured *ONLY* for argument 1. */
#include <ultra64.h>
#include <assert.h>
#include "main.h"
extern u32 checkShort(u32 *, u32 *);
extern u32 stressInternalAddressBus(u32 *, u32 *);
extern u32 stressExternalBus(u32);
u32 rdramCheck(u32 test_flag)
{
u32 error_cnt=0;
u32 *begadr, *endadr;
/* Both begadr and endadr should be on the word boundary */
switch(test_flag)
{
case 0: /* test from 0x0000_0000 to 0x002f_ffff */
begadr = (u32 *)OS_PHYSICAL_TO_K1(START_ADDRESS0);
endadr = (u32 *)OS_PHYSICAL_TO_K1(END_ADDRESS0);
break;
case 1: /* test from 0x0030_0000 to 0x003f_ffff (for 4M test) */
begadr = (u32 *)OS_PHYSICAL_TO_K1(START_ADDRESS1);
endadr = (u32 *)OS_PHYSICAL_TO_K1(END_ADDRESS1);
break;
case 2: /* test from 0x0030_0000 to 0x005f_ffff (for 6M test) */
begadr = (u32 *)OS_PHYSICAL_TO_K1(START_ADDRESS2);
endadr = (u32 *)OS_PHYSICAL_TO_K1(END_ADDRESS2);
break;
case 3: /* test from 0x0030_0000 to 0x007f_ffff (for 8M test) */
begadr = (u32 *)OS_PHYSICAL_TO_K1(START_ADDRESS3);
endadr = (u32 *)OS_PHYSICAL_TO_K1(END_ADDRESS3);
break;
}
begadr = (u32 *)((u32)begadr & ~(0x3));
endadr = ((u32)endadr & 0x3)? (u32 *)(((u32)endadr & ~(0x3)) + 0x4) : endadr;
#ifdef DEBUG
SOAKPRINTF("beg -- %04x end -- %04x\n", begadr, endadr);
#endif
/* First part. Stress the buses of RDRAMS. */
#ifdef DEBUG
SOAKPRINTF("First Part\n");
#endif
error_cnt += stressInternalAddressBus(begadr, endadr);
error_cnt += stressExternalBus(10);
/* Second part. Is there any short between bits? */
#ifdef DEBUG
SOAKPRINTF("Second Part\n");
#endif
error_cnt += checkShort(begadr, endadr);
#ifdef DEBUG
if(error_cnt)
SOAKPRINTF("Rdram test ---- FAIL\n");
else
SOAKPRINTF("Rdram test ---- PASS\n");
#endif
return error_cnt;
}