Two hda_verb.h files: Add more comments.
[coreboot.git] / src / arch / i386 / llshell / ramtest.inc
1         /*
2          * This is much more of a "Is my SDRAM properly configured?"
3          * test than a "Is my SDRAM faulty?" test.  Not all bits
4          * are tested.   -Tyson
5          */
6
7         jmp     rt_skip
8 #define RAMTEST 1
9 #if RAMTEST
10         .section ".rom.data"
11
12 rt_test:        .string "Testing SDRAM : "
13 rt_fill:        .string "SDRAM fill:\r\n"
14 rt_verify:      .string "SDRAM verify:\r\n"
15 rt_toomany:     .string "Too many errors.\r\n"
16 rt_done:        .string "Done.\r\n"
17         .previous
18 #endif
19
20 ramtest:
21 #if RAMTEST
22         mov %eax, %esi
23         mov %ebx, %edi
24         mov %esp, %ebp
25
26         CONSOLE_INFO_TX_STRING($rt_test)
27         CONSOLE_INFO_TX_HEX32(%esi)
28         CONSOLE_INFO_TX_CHAR($'-')
29         CONSOLE_INFO_TX_HEX32(%edi)
30         CONSOLE_INFO_TX_CHAR($'\r')
31         CONSOLE_INFO_TX_CHAR($'\n')
32
33         /* ============== Fill ram block ==== */
34
35         CONSOLE_INFO_TX_STRING($rt_fill)
36
37         mov %esi, %ebx
38 1:
39         cmp $0, %bx
40         jne 2f
41
42         /* Display address being filled */
43         /* CONSOLE_INFO_TX_HEX32(arg) will overwrite %ebx with arg */
44
45         CONSOLE_INFO_TX_HEX32(%ebx)
46         CONSOLE_INFO_TX_CHAR($'\r')
47 2:
48 #if     i786
49         /* Use a non temporal store to go faster and
50          * to bypass the cache.
51          */
52         movnti  %ebx, (%ebx)
53 #else
54         mov %ebx, (%ebx)
55 #endif
56         add $4, %ebx
57         cmp %edi, %ebx
58         jl 1b
59
60         /* Display final address */
61
62         CONSOLE_INFO_TX_HEX32(%edi)
63         CONSOLE_INFO_TX_CHAR($'\r')
64         CONSOLE_INFO_TX_CHAR($'\n')
65
66         /* ========= Verify ram block ========== */
67
68         CONSOLE_INFO_TX_STRING($rt_verify)
69         mov %esi, %ebx
70
71 1:
72         cmp $0, %bx
73         jne 2f
74
75         /* Display address being tested */
76
77         CONSOLE_INFO_TX_HEX32(%ebx)
78         CONSOLE_INFO_TX_CHAR($'\r')
79 2:
80         cmp %ebx, (%ebx)
81         jne 4f
82 3:
83         add $4, %ebx
84         cmp %edi, %ebx
85         jl 1b
86
87         /* Display final address */
88         CONSOLE_INFO_TX_HEX32(%edi)
89         CONSOLE_INFO_TX_CHAR($'\r')
90         CONSOLE_INFO_TX_CHAR($'\n')
91         jmp 6f
92
93 4:
94         /* Display address with error */
95
96         CONSOLE_INFO_TX_HEX32(%ebx)
97         CONSOLE_INFO_TX_CHAR($':')
98
99         /* Display data in address with error */
100
101         /* CONSOLE_INFO_TX_HEX32(arg) will overwrite %ebx with arg */
102
103         mov %ebx, %esi
104         mov 0(%ebx), %eax
105         CONSOLE_INFO_TX_HEX32(%eax)
106         mov %esi, %ebx
107
108         CONSOLE_INFO_TX_CHAR($'\r')
109         CONSOLE_INFO_TX_CHAR($'\n')
110         sub $1, %ecx
111         jz 5f
112         jmp 3b
113 5:
114         CONSOLE_INFO_TX_STRING($rt_toomany)
115         post_code(0xf1)
116         jmp     .Lhlt
117
118 6:
119         CONSOLE_INFO_TX_STRING($rt_done)
120         mov %ebp, %esp
121
122 #endif
123         RETSP
124
125 rt_skip: