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