xref: /openbmc/u-boot/post/tests.c (revision 834a45d7ee81ef185cc834b44b2dae7b637631e2)
1324f6cfdSwdenk /*
2324f6cfdSwdenk  * (C) Copyright 2002
3324f6cfdSwdenk  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4324f6cfdSwdenk  *
5324f6cfdSwdenk  * See file CREDITS for list of people who contributed to this
6324f6cfdSwdenk  * project.
7324f6cfdSwdenk  *
8324f6cfdSwdenk  * This program is free software; you can redistribute it and/or
9324f6cfdSwdenk  * modify it under the terms of the GNU General Public License as
10324f6cfdSwdenk  * published by the Free Software Foundation; either version 2 of
11324f6cfdSwdenk  * the License, or (at your option) any later version.
12324f6cfdSwdenk  *
13324f6cfdSwdenk  * This program is distributed in the hope that it will be useful,
14324f6cfdSwdenk  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15324f6cfdSwdenk  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16324f6cfdSwdenk  * GNU General Public License for more details.
17324f6cfdSwdenk  *
18324f6cfdSwdenk  * You should have received a copy of the GNU General Public License
19324f6cfdSwdenk  * along with this program; if not, write to the Free Software
20324f6cfdSwdenk  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21324f6cfdSwdenk  * MA 02111-1307 USA
22228f29acSwdenk  *
23228f29acSwdenk  * Be sure to mark tests to be run before relocation as such with the
246d0f6bcfSJean-Christophe PLAGNIOL-VILLARD  * CONFIG_SYS_POST_PREREL flag so that logging is done correctly if the
25228f29acSwdenk  * logbuffer support is enabled.
26324f6cfdSwdenk  */
27324f6cfdSwdenk 
28324f6cfdSwdenk #include <common.h>
29324f6cfdSwdenk 
30324f6cfdSwdenk #include <post.h>
31324f6cfdSwdenk 
326e8ec682SYuri Tikhonov extern int ocm_post_test (int flags);
33324f6cfdSwdenk extern int cache_post_test (int flags);
34324f6cfdSwdenk extern int watchdog_post_test (int flags);
35324f6cfdSwdenk extern int i2c_post_test (int flags);
36324f6cfdSwdenk extern int rtc_post_test (int flags);
37324f6cfdSwdenk extern int memory_post_test (int flags);
38324f6cfdSwdenk extern int cpu_post_test (int flags);
39a11e0696SIgor Lisitsin extern int fpu_post_test (int flags);
40324f6cfdSwdenk extern int uart_post_test (int flags);
41324f6cfdSwdenk extern int ether_post_test (int flags);
42324f6cfdSwdenk extern int spi_post_test (int flags);
43324f6cfdSwdenk extern int usb_post_test (int flags);
44324f6cfdSwdenk extern int spr_post_test (int flags);
454532cb69Swdenk extern int sysmon_post_test (int flags);
465a8c51cdSwdenk extern int dsp_post_test (int flags);
4779fa88f3Swdenk extern int codec_post_test (int flags);
48531e3e8bSPavel Kolesnikov extern int ecc_post_test (int flags);
494532cb69Swdenk 
5065b20dceSYuri Tikhonov extern int dspic_init_post_test (int flags);
5165b20dceSYuri Tikhonov extern int dspic_post_test (int flags);
5265b20dceSYuri Tikhonov extern int gdc_post_test (int flags);
5365b20dceSYuri Tikhonov extern int fpga_post_test (int flags);
5465b20dceSYuri Tikhonov extern int lwmon5_watchdog_post_test(int flags);
5565b20dceSYuri Tikhonov extern int sysmon1_post_test(int flags);
5629fd7cebSAnatolij Gustschin extern int coprocessor_post_test(int flags);
5765b20dceSYuri Tikhonov 
584532cb69Swdenk extern int sysmon_init_f (void);
594532cb69Swdenk 
604532cb69Swdenk extern void sysmon_reloc (void);
614532cb69Swdenk 
62324f6cfdSwdenk 
63324f6cfdSwdenk struct post_test post_list[] =
64324f6cfdSwdenk {
656d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_OCM
666e8ec682SYuri Tikhonov     {
676e8ec682SYuri Tikhonov 	"OCM test",
686e8ec682SYuri Tikhonov 	"ocm",
696e8ec682SYuri Tikhonov 	"This test checks on chip memory (OCM).",
707845d490SYuri Tikhonov 	POST_ROM | POST_ALWAYS | POST_PREREL | POST_CRITICAL | POST_STOP,
716e8ec682SYuri Tikhonov 	&ocm_post_test,
726e8ec682SYuri Tikhonov 	NULL,
736e8ec682SYuri Tikhonov 	NULL,
746d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_OCM
756e8ec682SYuri Tikhonov     },
766e8ec682SYuri Tikhonov #endif
776d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_CACHE
78324f6cfdSwdenk     {
79324f6cfdSwdenk 	"Cache test",
80324f6cfdSwdenk 	"cache",
81324f6cfdSwdenk 	"This test verifies the CPU cache operation.",
82324f6cfdSwdenk 	POST_RAM | POST_ALWAYS,
83228f29acSwdenk 	&cache_post_test,
844532cb69Swdenk 	NULL,
854532cb69Swdenk 	NULL,
866d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_CACHE
87324f6cfdSwdenk     },
88324f6cfdSwdenk #endif
896d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG
9065b20dceSYuri Tikhonov #if defined(CONFIG_POST_WATCHDOG)
9165b20dceSYuri Tikhonov 	CONFIG_POST_WATCHDOG,
9265b20dceSYuri Tikhonov #else
93324f6cfdSwdenk     {
94324f6cfdSwdenk 	"Watchdog timer test",
95324f6cfdSwdenk 	"watchdog",
96324f6cfdSwdenk 	"This test checks the watchdog timer.",
978564acf9Swdenk 	POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT,
98228f29acSwdenk 	&watchdog_post_test,
994532cb69Swdenk 	NULL,
1004532cb69Swdenk 	NULL,
1016d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_WATCHDOG
102324f6cfdSwdenk     },
103324f6cfdSwdenk #endif
10465b20dceSYuri Tikhonov #endif
1056d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_I2C
106324f6cfdSwdenk     {
107324f6cfdSwdenk 	"I2C test",
108324f6cfdSwdenk 	"i2c",
109324f6cfdSwdenk 	"This test verifies the I2C operation.",
110324f6cfdSwdenk 	POST_RAM | POST_ALWAYS,
111228f29acSwdenk 	&i2c_post_test,
1124532cb69Swdenk 	NULL,
1134532cb69Swdenk 	NULL,
1146d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_I2C
115324f6cfdSwdenk     },
116324f6cfdSwdenk #endif
1176d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_RTC
118324f6cfdSwdenk     {
119324f6cfdSwdenk 	"RTC test",
120324f6cfdSwdenk 	"rtc",
121324f6cfdSwdenk 	"This test verifies the RTC operation.",
1228564acf9Swdenk 	POST_RAM | POST_SLOWTEST | POST_MANUAL,
123228f29acSwdenk 	&rtc_post_test,
1244532cb69Swdenk 	NULL,
1254532cb69Swdenk 	NULL,
1266d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_RTC
127324f6cfdSwdenk     },
128324f6cfdSwdenk #endif
1296d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_MEMORY
130324f6cfdSwdenk     {
131324f6cfdSwdenk 	"Memory test",
132324f6cfdSwdenk 	"memory",
133324f6cfdSwdenk 	"This test checks RAM.",
1348564acf9Swdenk 	POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL,
135228f29acSwdenk 	&memory_post_test,
1364532cb69Swdenk 	NULL,
1374532cb69Swdenk 	NULL,
1386d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_MEMORY
139324f6cfdSwdenk     },
140324f6cfdSwdenk #endif
1416d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_CPU
142324f6cfdSwdenk     {
143324f6cfdSwdenk 	"CPU test",
144324f6cfdSwdenk 	"cpu",
145324f6cfdSwdenk 	"This test verifies the arithmetic logic unit of"
146324f6cfdSwdenk 	" CPU.",
147324f6cfdSwdenk 	POST_RAM | POST_ALWAYS,
148228f29acSwdenk 	&cpu_post_test,
1494532cb69Swdenk 	NULL,
1504532cb69Swdenk 	NULL,
1516d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_CPU
152324f6cfdSwdenk     },
153324f6cfdSwdenk #endif
1546d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_FPU
155a11e0696SIgor Lisitsin     {
156a11e0696SIgor Lisitsin 	"FPU test",
157a11e0696SIgor Lisitsin 	"fpu",
158a11e0696SIgor Lisitsin 	"This test verifies the arithmetic logic unit of"
159a11e0696SIgor Lisitsin 	" FPU.",
160a11e0696SIgor Lisitsin 	POST_RAM | POST_ALWAYS,
161a11e0696SIgor Lisitsin 	&fpu_post_test,
162a11e0696SIgor Lisitsin 	NULL,
163a11e0696SIgor Lisitsin 	NULL,
1646d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_FPU
165a11e0696SIgor Lisitsin     },
166a11e0696SIgor Lisitsin #endif
1676d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_UART
168*834a45d7SStefan Roese #if defined(CONFIG_POST_UART)
169*834a45d7SStefan Roese 	CONFIG_POST_UART,
170*834a45d7SStefan Roese #else
171324f6cfdSwdenk     {
172324f6cfdSwdenk 	"UART test",
173324f6cfdSwdenk 	"uart",
174324f6cfdSwdenk 	"This test verifies the UART operation.",
1758564acf9Swdenk 	POST_RAM | POST_SLOWTEST | POST_MANUAL,
176228f29acSwdenk 	&uart_post_test,
1774532cb69Swdenk 	NULL,
1784532cb69Swdenk 	NULL,
1796d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_UART
180324f6cfdSwdenk     },
181*834a45d7SStefan Roese #endif /* CONFIG_POST_UART */
182324f6cfdSwdenk #endif
1836d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_ETHER
184324f6cfdSwdenk     {
185324f6cfdSwdenk 	"ETHERNET test",
186324f6cfdSwdenk 	"ethernet",
187324f6cfdSwdenk 	"This test verifies the ETHERNET operation.",
188324f6cfdSwdenk 	POST_RAM | POST_ALWAYS | POST_MANUAL,
189228f29acSwdenk 	&ether_post_test,
1904532cb69Swdenk 	NULL,
1914532cb69Swdenk 	NULL,
1926d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_ETHER
193324f6cfdSwdenk     },
194324f6cfdSwdenk #endif
1956d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_SPI
196324f6cfdSwdenk     {
197324f6cfdSwdenk 	"SPI test",
198324f6cfdSwdenk 	"spi",
199324f6cfdSwdenk 	"This test verifies the SPI operation.",
200324f6cfdSwdenk 	POST_RAM | POST_ALWAYS | POST_MANUAL,
201228f29acSwdenk 	&spi_post_test,
2024532cb69Swdenk 	NULL,
2034532cb69Swdenk 	NULL,
2046d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_SPI
205324f6cfdSwdenk     },
206324f6cfdSwdenk #endif
2076d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_USB
208324f6cfdSwdenk     {
209324f6cfdSwdenk 	"USB test",
210324f6cfdSwdenk 	"usb",
211324f6cfdSwdenk 	"This test verifies the USB operation.",
212324f6cfdSwdenk 	POST_RAM | POST_ALWAYS | POST_MANUAL,
213228f29acSwdenk 	&usb_post_test,
2144532cb69Swdenk 	NULL,
2154532cb69Swdenk 	NULL,
2166d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_USB
217324f6cfdSwdenk     },
218324f6cfdSwdenk #endif
2196d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_SPR
220324f6cfdSwdenk     {
221324f6cfdSwdenk 	"SPR test",
222324f6cfdSwdenk 	"spr",
223324f6cfdSwdenk 	"This test checks SPR contents.",
224b2e2142cSStefan Roese 	POST_RAM | POST_ALWAYS,
225228f29acSwdenk 	&spr_post_test,
2264532cb69Swdenk 	NULL,
2274532cb69Swdenk 	NULL,
2286d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_SPR
229324f6cfdSwdenk     },
230324f6cfdSwdenk #endif
2316d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_SYSMON
2324532cb69Swdenk     {
2334532cb69Swdenk 	"SYSMON test",
2344532cb69Swdenk 	"sysmon",
2354532cb69Swdenk 	"This test monitors system hardware.",
2364532cb69Swdenk 	POST_RAM | POST_ALWAYS,
2374532cb69Swdenk 	&sysmon_post_test,
2384532cb69Swdenk 	&sysmon_init_f,
2394532cb69Swdenk 	&sysmon_reloc,
2406d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_SYSMON
2414532cb69Swdenk     },
2424532cb69Swdenk #endif
2436d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_DSP
2445a8c51cdSwdenk     {
2455a8c51cdSwdenk 	"DSP test",
2465a8c51cdSwdenk 	"dsp",
2475a8c51cdSwdenk 	"This test checks any connected DSP(s).",
2485744ddc6SSascha Laue 	POST_RAM | POST_ALWAYS | POST_MANUAL,
2495a8c51cdSwdenk 	&dsp_post_test,
2505a8c51cdSwdenk 	NULL,
2515a8c51cdSwdenk 	NULL,
2526d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_DSP
2535a8c51cdSwdenk     },
2545a8c51cdSwdenk #endif
2556d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_CODEC
25679fa88f3Swdenk     {
25779fa88f3Swdenk 	"CODEC test",
25879fa88f3Swdenk 	"codec",
25979fa88f3Swdenk 	"This test checks any connected codec(s).",
26079fa88f3Swdenk 	POST_RAM | POST_MANUAL,
26179fa88f3Swdenk 	&codec_post_test,
26279fa88f3Swdenk 	NULL,
26379fa88f3Swdenk 	NULL,
2646d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_CODEC
26579fa88f3Swdenk     },
26679fa88f3Swdenk #endif
2676d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_ECC
268531e3e8bSPavel Kolesnikov     {
269531e3e8bSPavel Kolesnikov 	"ECC test",
270531e3e8bSPavel Kolesnikov 	"ecc",
2718dafa874SLarry Johnson 	"This test checks the ECC facility of memory.",
2728dafa874SLarry Johnson 	POST_ROM | POST_ALWAYS | POST_PREREL,
273531e3e8bSPavel Kolesnikov 	&ecc_post_test,
274531e3e8bSPavel Kolesnikov 	NULL,
275531e3e8bSPavel Kolesnikov 	NULL,
2766d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_ECC
277531e3e8bSPavel Kolesnikov     },
278531e3e8bSPavel Kolesnikov #endif
2796d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_BSPEC1
28065b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC1,
28165b20dceSYuri Tikhonov #endif
2826d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_BSPEC2
28365b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC2,
28465b20dceSYuri Tikhonov #endif
2856d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_BSPEC3
28665b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC3,
28765b20dceSYuri Tikhonov #endif
2886d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_BSPEC4
28965b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC4,
29065b20dceSYuri Tikhonov #endif
2916d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_BSPEC5
29265b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC5,
29365b20dceSYuri Tikhonov #endif
29429fd7cebSAnatolij Gustschin #if CONFIG_POST & CONFIG_SYS_POST_COPROC
29529fd7cebSAnatolij Gustschin     {
29629fd7cebSAnatolij Gustschin 	"Coprocessors communication test",
29729fd7cebSAnatolij Gustschin 	"coproc_com",
29829fd7cebSAnatolij Gustschin 	"This test checks communication with coprocessors.",
29929fd7cebSAnatolij Gustschin 	POST_RAM | POST_ALWAYS | POST_CRITICAL,
30029fd7cebSAnatolij Gustschin 	&coprocessor_post_test,
30129fd7cebSAnatolij Gustschin 	NULL,
30229fd7cebSAnatolij Gustschin 	NULL,
30329fd7cebSAnatolij Gustschin 	CONFIG_SYS_POST_COPROC
30429fd7cebSAnatolij Gustschin     }
30529fd7cebSAnatolij Gustschin #endif
306324f6cfdSwdenk };
307324f6cfdSwdenk 
308324f6cfdSwdenk unsigned int post_list_size = sizeof (post_list) / sizeof (struct post_test);
309