xref: /openbmc/u-boot/post/tests.c (revision 8e6f1a8e)
1 /*
2  * (C) Copyright 2002
3  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4  *
5  * See file CREDITS for list of people who contributed to this
6  * project.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  * MA 02111-1307 USA
22  *
23  * Be sure to mark tests to be run before relocation as such with the
24  * CFG_POST_PREREL flag so that logging is done correctly if the
25  * logbuffer support is enabled.
26  */
27 
28 #include <common.h>
29 
30 #ifdef CONFIG_POST
31 
32 #include <post.h>
33 
34 extern int cache_post_test (int flags);
35 extern int watchdog_post_test (int flags);
36 extern int i2c_post_test (int flags);
37 extern int rtc_post_test (int flags);
38 extern int memory_post_test (int flags);
39 extern int cpu_post_test (int flags);
40 extern int uart_post_test (int flags);
41 extern int ether_post_test (int flags);
42 extern int spi_post_test (int flags);
43 extern int usb_post_test (int flags);
44 extern int spr_post_test (int flags);
45 extern int sysmon_post_test (int flags);
46 extern int dsp_post_test (int flags);
47 extern int codec_post_test (int flags);
48 
49 extern int sysmon_init_f (void);
50 
51 extern void sysmon_reloc (void);
52 
53 
54 struct post_test post_list[] =
55 {
56 #if CONFIG_POST & CFG_POST_CACHE
57     {
58 	"Cache test",
59 	"cache",
60 	"This test verifies the CPU cache operation.",
61 	POST_RAM | POST_ALWAYS,
62 	&cache_post_test,
63 	NULL,
64 	NULL,
65 	CFG_POST_CACHE
66     },
67 #endif
68 #if CONFIG_POST & CFG_POST_WATCHDOG
69     {
70 	"Watchdog timer test",
71 	"watchdog",
72 	"This test checks the watchdog timer.",
73 	POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT,
74 	&watchdog_post_test,
75 	NULL,
76 	NULL,
77 	CFG_POST_WATCHDOG
78     },
79 #endif
80 #if CONFIG_POST & CFG_POST_I2C
81     {
82 	"I2C test",
83 	"i2c",
84 	"This test verifies the I2C operation.",
85 	POST_RAM | POST_ALWAYS,
86 	&i2c_post_test,
87 	NULL,
88 	NULL,
89 	CFG_POST_I2C
90     },
91 #endif
92 #if CONFIG_POST & CFG_POST_RTC
93     {
94 	"RTC test",
95 	"rtc",
96 	"This test verifies the RTC operation.",
97 	POST_RAM | POST_SLOWTEST | POST_MANUAL,
98 	&rtc_post_test,
99 	NULL,
100 	NULL,
101 	CFG_POST_RTC
102     },
103 #endif
104 #if CONFIG_POST & CFG_POST_MEMORY
105     {
106 	"Memory test",
107 	"memory",
108 	"This test checks RAM.",
109 	POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL,
110 	&memory_post_test,
111 	NULL,
112 	NULL,
113 	CFG_POST_MEMORY
114     },
115 #endif
116 #if CONFIG_POST & CFG_POST_CPU
117     {
118 	"CPU test",
119 	"cpu",
120 	"This test verifies the arithmetic logic unit of"
121 	" CPU.",
122 	POST_RAM | POST_ALWAYS,
123 	&cpu_post_test,
124 	NULL,
125 	NULL,
126 	CFG_POST_CPU
127     },
128 #endif
129 #if CONFIG_POST & CFG_POST_UART
130     {
131 	"UART test",
132 	"uart",
133 	"This test verifies the UART operation.",
134 	POST_RAM | POST_SLOWTEST | POST_MANUAL,
135 	&uart_post_test,
136 	NULL,
137 	NULL,
138 	CFG_POST_UART
139     },
140 #endif
141 #if CONFIG_POST & CFG_POST_ETHER
142     {
143 	"ETHERNET test",
144 	"ethernet",
145 	"This test verifies the ETHERNET operation.",
146 	POST_RAM | POST_ALWAYS | POST_MANUAL,
147 	&ether_post_test,
148 	NULL,
149 	NULL,
150 	CFG_POST_ETHER
151     },
152 #endif
153 #if CONFIG_POST & CFG_POST_SPI
154     {
155 	"SPI test",
156 	"spi",
157 	"This test verifies the SPI operation.",
158 	POST_RAM | POST_ALWAYS | POST_MANUAL,
159 	&spi_post_test,
160 	NULL,
161 	NULL,
162 	CFG_POST_SPI
163     },
164 #endif
165 #if CONFIG_POST & CFG_POST_USB
166     {
167 	"USB test",
168 	"usb",
169 	"This test verifies the USB operation.",
170 	POST_RAM | POST_ALWAYS | POST_MANUAL,
171 	&usb_post_test,
172 	NULL,
173 	NULL,
174 	CFG_POST_USB
175     },
176 #endif
177 #if CONFIG_POST & CFG_POST_SPR
178     {
179 	"SPR test",
180 	"spr",
181 	"This test checks SPR contents.",
182 	POST_ROM | POST_ALWAYS | POST_PREREL,
183 	&spr_post_test,
184 	NULL,
185 	NULL,
186 	CFG_POST_SPR
187     },
188 #endif
189 #if CONFIG_POST & CFG_POST_SYSMON
190     {
191 	"SYSMON test",
192 	"sysmon",
193 	"This test monitors system hardware.",
194 	POST_RAM | POST_ALWAYS,
195 	&sysmon_post_test,
196 	&sysmon_init_f,
197 	&sysmon_reloc,
198 	CFG_POST_SYSMON
199     },
200 #endif
201 #if CONFIG_POST & CFG_POST_DSP
202     {
203 	"DSP test",
204 	"dsp",
205 	"This test checks any connected DSP(s).",
206 	POST_RAM | POST_MANUAL,
207 	&dsp_post_test,
208 	NULL,
209 	NULL,
210 	CFG_POST_DSP
211     },
212 #endif
213 #if CONFIG_POST & CFG_POST_DSP
214     {
215 	"CODEC test",
216 	"codec",
217 	"This test checks any connected codec(s).",
218 	POST_RAM | POST_MANUAL,
219 	&codec_post_test,
220 	NULL,
221 	NULL,
222 	CFG_POST_CODEC
223     },
224 #endif
225 };
226 
227 unsigned int post_list_size = sizeof (post_list) / sizeof (struct post_test);
228 
229 #endif /* CONFIG_POST */
230