xref: /openbmc/u-boot/post/tests.c (revision 6aac646f)
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  * CONFIG_SYS_POST_PREREL flag so that logging is done correctly if the
25  * logbuffer support is enabled.
26  */
27 
28 #include <common.h>
29 
30 #include <post.h>
31 
32 extern int ocm_post_test (int flags);
33 extern int cache_post_test (int flags);
34 extern int watchdog_post_test (int flags);
35 extern int i2c_post_test (int flags);
36 extern int rtc_post_test (int flags);
37 extern int memory_post_test (int flags);
38 extern int cpu_post_test (int flags);
39 extern int fpu_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 extern int ecc_post_test (int flags);
49 extern int flash_post_test(int flags);
50 
51 extern int dspic_init_post_test (int flags);
52 extern int dspic_post_test (int flags);
53 extern int gdc_post_test (int flags);
54 extern int fpga_post_test (int flags);
55 extern int lwmon5_watchdog_post_test(int flags);
56 extern int sysmon1_post_test(int flags);
57 extern int coprocessor_post_test(int flags);
58 
59 extern int sysmon_init_f (void);
60 
61 extern void sysmon_reloc (void);
62 
63 
64 struct post_test post_list[] =
65 {
66 #if CONFIG_POST & CONFIG_SYS_POST_OCM
67     {
68 	"OCM test",
69 	"ocm",
70 	"This test checks on chip memory (OCM).",
71 	POST_ROM | POST_ALWAYS | POST_PREREL | POST_CRITICAL | POST_STOP,
72 	&ocm_post_test,
73 	NULL,
74 	NULL,
75 	CONFIG_SYS_POST_OCM
76     },
77 #endif
78 #if CONFIG_POST & CONFIG_SYS_POST_CACHE
79     {
80 	"Cache test",
81 	"cache",
82 	"This test verifies the CPU cache operation.",
83 	POST_RAM | POST_ALWAYS,
84 	&cache_post_test,
85 	NULL,
86 	NULL,
87 	CONFIG_SYS_POST_CACHE
88     },
89 #endif
90 #if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG
91 #if defined(CONFIG_POST_WATCHDOG)
92 	CONFIG_POST_WATCHDOG,
93 #else
94     {
95 	"Watchdog timer test",
96 	"watchdog",
97 	"This test checks the watchdog timer.",
98 	POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT,
99 	&watchdog_post_test,
100 	NULL,
101 	NULL,
102 	CONFIG_SYS_POST_WATCHDOG
103     },
104 #endif
105 #endif
106 #if CONFIG_POST & CONFIG_SYS_POST_I2C
107     {
108 	"I2C test",
109 	"i2c",
110 	"This test verifies the I2C operation.",
111 	POST_RAM | POST_ALWAYS,
112 	&i2c_post_test,
113 	NULL,
114 	NULL,
115 	CONFIG_SYS_POST_I2C
116     },
117 #endif
118 #if CONFIG_POST & CONFIG_SYS_POST_RTC
119     {
120 	"RTC test",
121 	"rtc",
122 	"This test verifies the RTC operation.",
123 	POST_RAM | POST_SLOWTEST | POST_MANUAL,
124 	&rtc_post_test,
125 	NULL,
126 	NULL,
127 	CONFIG_SYS_POST_RTC
128     },
129 #endif
130 #if CONFIG_POST & CONFIG_SYS_POST_MEMORY
131     {
132 	"Memory test",
133 	"memory",
134 	"This test checks RAM.",
135 	POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL,
136 	&memory_post_test,
137 	NULL,
138 	NULL,
139 	CONFIG_SYS_POST_MEMORY
140     },
141 #endif
142 #if CONFIG_POST & CONFIG_SYS_POST_CPU
143     {
144 	"CPU test",
145 	"cpu",
146 	"This test verifies the arithmetic logic unit of"
147 	" CPU.",
148 	POST_RAM | POST_ALWAYS,
149 	&cpu_post_test,
150 	NULL,
151 	NULL,
152 	CONFIG_SYS_POST_CPU
153     },
154 #endif
155 #if CONFIG_POST & CONFIG_SYS_POST_FPU
156     {
157 	"FPU test",
158 	"fpu",
159 	"This test verifies the arithmetic logic unit of"
160 	" FPU.",
161 	POST_RAM | POST_ALWAYS,
162 	&fpu_post_test,
163 	NULL,
164 	NULL,
165 	CONFIG_SYS_POST_FPU
166     },
167 #endif
168 #if CONFIG_POST & CONFIG_SYS_POST_UART
169 #if defined(CONFIG_POST_UART)
170 	CONFIG_POST_UART,
171 #else
172     {
173 	"UART test",
174 	"uart",
175 	"This test verifies the UART operation.",
176 	POST_RAM | POST_SLOWTEST | POST_MANUAL,
177 	&uart_post_test,
178 	NULL,
179 	NULL,
180 	CONFIG_SYS_POST_UART
181     },
182 #endif /* CONFIG_POST_UART */
183 #endif
184 #if CONFIG_POST & CONFIG_SYS_POST_ETHER
185     {
186 	"ETHERNET test",
187 	"ethernet",
188 	"This test verifies the ETHERNET operation.",
189 	POST_RAM | POST_ALWAYS | POST_MANUAL,
190 	&ether_post_test,
191 	NULL,
192 	NULL,
193 	CONFIG_SYS_POST_ETHER
194     },
195 #endif
196 #if CONFIG_POST & CONFIG_SYS_POST_SPI
197     {
198 	"SPI test",
199 	"spi",
200 	"This test verifies the SPI operation.",
201 	POST_RAM | POST_ALWAYS | POST_MANUAL,
202 	&spi_post_test,
203 	NULL,
204 	NULL,
205 	CONFIG_SYS_POST_SPI
206     },
207 #endif
208 #if CONFIG_POST & CONFIG_SYS_POST_USB
209     {
210 	"USB test",
211 	"usb",
212 	"This test verifies the USB operation.",
213 	POST_RAM | POST_ALWAYS | POST_MANUAL,
214 	&usb_post_test,
215 	NULL,
216 	NULL,
217 	CONFIG_SYS_POST_USB
218     },
219 #endif
220 #if CONFIG_POST & CONFIG_SYS_POST_SPR
221     {
222 	"SPR test",
223 	"spr",
224 	"This test checks SPR contents.",
225 	POST_RAM | POST_ALWAYS,
226 	&spr_post_test,
227 	NULL,
228 	NULL,
229 	CONFIG_SYS_POST_SPR
230     },
231 #endif
232 #if CONFIG_POST & CONFIG_SYS_POST_SYSMON
233     {
234 	"SYSMON test",
235 	"sysmon",
236 	"This test monitors system hardware.",
237 	POST_RAM | POST_ALWAYS,
238 	&sysmon_post_test,
239 	&sysmon_init_f,
240 	&sysmon_reloc,
241 	CONFIG_SYS_POST_SYSMON
242     },
243 #endif
244 #if CONFIG_POST & CONFIG_SYS_POST_DSP
245     {
246 	"DSP test",
247 	"dsp",
248 	"This test checks any connected DSP(s).",
249 	POST_RAM | POST_ALWAYS | POST_MANUAL,
250 	&dsp_post_test,
251 	NULL,
252 	NULL,
253 	CONFIG_SYS_POST_DSP
254     },
255 #endif
256 #if CONFIG_POST & CONFIG_SYS_POST_CODEC
257     {
258 	"CODEC test",
259 	"codec",
260 	"This test checks any connected codec(s).",
261 	POST_RAM | POST_MANUAL,
262 	&codec_post_test,
263 	NULL,
264 	NULL,
265 	CONFIG_SYS_POST_CODEC
266     },
267 #endif
268 #if CONFIG_POST & CONFIG_SYS_POST_ECC
269     {
270 	"ECC test",
271 	"ecc",
272 	"This test checks the ECC facility of memory.",
273 	POST_ROM | POST_ALWAYS | POST_PREREL,
274 	&ecc_post_test,
275 	NULL,
276 	NULL,
277 	CONFIG_SYS_POST_ECC
278     },
279 #endif
280 #if CONFIG_POST & CONFIG_SYS_POST_BSPEC1
281 	CONFIG_POST_BSPEC1,
282 #endif
283 #if CONFIG_POST & CONFIG_SYS_POST_BSPEC2
284 	CONFIG_POST_BSPEC2,
285 #endif
286 #if CONFIG_POST & CONFIG_SYS_POST_BSPEC3
287 	CONFIG_POST_BSPEC3,
288 #endif
289 #if CONFIG_POST & CONFIG_SYS_POST_BSPEC4
290 	CONFIG_POST_BSPEC4,
291 #endif
292 #if CONFIG_POST & CONFIG_SYS_POST_BSPEC5
293 	CONFIG_POST_BSPEC5,
294 #endif
295 #if CONFIG_POST & CONFIG_SYS_POST_COPROC
296     {
297 	"Coprocessors communication test",
298 	"coproc_com",
299 	"This test checks communication with coprocessors.",
300 	POST_RAM | POST_ALWAYS | POST_CRITICAL,
301 	&coprocessor_post_test,
302 	NULL,
303 	NULL,
304 	CONFIG_SYS_POST_COPROC
305     },
306 #endif
307 #if CONFIG_POST & CONFIG_SYS_POST_FLASH
308     {
309 	"Parallel NOR flash test",
310 	"flash",
311 	"This test verifies parallel flash operations.",
312 	POST_RAM | POST_SLOWTEST | POST_MANUAL,
313 	&flash_post_test,
314 	NULL,
315 	NULL,
316 	CONFIG_SYS_POST_FLASH
317     },
318 #endif
319 };
320 
321 unsigned int post_list_size = ARRAY_SIZE(post_list);
322