xref: /openbmc/u-boot/post/tests.c (revision f6f7395eb36a5d4ac7e3b088f65cda42629d1d79)
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);
49*f6f7395eSMike Frysinger extern int flash_post_test(int flags);
504532cb69Swdenk 
5165b20dceSYuri Tikhonov extern int dspic_init_post_test (int flags);
5265b20dceSYuri Tikhonov extern int dspic_post_test (int flags);
5365b20dceSYuri Tikhonov extern int gdc_post_test (int flags);
5465b20dceSYuri Tikhonov extern int fpga_post_test (int flags);
5565b20dceSYuri Tikhonov extern int lwmon5_watchdog_post_test(int flags);
5665b20dceSYuri Tikhonov extern int sysmon1_post_test(int flags);
5729fd7cebSAnatolij Gustschin extern int coprocessor_post_test(int flags);
5865b20dceSYuri Tikhonov 
594532cb69Swdenk extern int sysmon_init_f (void);
604532cb69Swdenk 
614532cb69Swdenk extern void sysmon_reloc (void);
624532cb69Swdenk 
63324f6cfdSwdenk 
64324f6cfdSwdenk struct post_test post_list[] =
65324f6cfdSwdenk {
666d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_OCM
676e8ec682SYuri Tikhonov     {
686e8ec682SYuri Tikhonov 	"OCM test",
696e8ec682SYuri Tikhonov 	"ocm",
706e8ec682SYuri Tikhonov 	"This test checks on chip memory (OCM).",
717845d490SYuri Tikhonov 	POST_ROM | POST_ALWAYS | POST_PREREL | POST_CRITICAL | POST_STOP,
726e8ec682SYuri Tikhonov 	&ocm_post_test,
736e8ec682SYuri Tikhonov 	NULL,
746e8ec682SYuri Tikhonov 	NULL,
756d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_OCM
766e8ec682SYuri Tikhonov     },
776e8ec682SYuri Tikhonov #endif
786d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_CACHE
79324f6cfdSwdenk     {
80324f6cfdSwdenk 	"Cache test",
81324f6cfdSwdenk 	"cache",
82324f6cfdSwdenk 	"This test verifies the CPU cache operation.",
83324f6cfdSwdenk 	POST_RAM | POST_ALWAYS,
84228f29acSwdenk 	&cache_post_test,
854532cb69Swdenk 	NULL,
864532cb69Swdenk 	NULL,
876d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_CACHE
88324f6cfdSwdenk     },
89324f6cfdSwdenk #endif
906d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG
9165b20dceSYuri Tikhonov #if defined(CONFIG_POST_WATCHDOG)
9265b20dceSYuri Tikhonov 	CONFIG_POST_WATCHDOG,
9365b20dceSYuri Tikhonov #else
94324f6cfdSwdenk     {
95324f6cfdSwdenk 	"Watchdog timer test",
96324f6cfdSwdenk 	"watchdog",
97324f6cfdSwdenk 	"This test checks the watchdog timer.",
988564acf9Swdenk 	POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT,
99228f29acSwdenk 	&watchdog_post_test,
1004532cb69Swdenk 	NULL,
1014532cb69Swdenk 	NULL,
1026d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_WATCHDOG
103324f6cfdSwdenk     },
104324f6cfdSwdenk #endif
10565b20dceSYuri Tikhonov #endif
1066d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_I2C
107324f6cfdSwdenk     {
108324f6cfdSwdenk 	"I2C test",
109324f6cfdSwdenk 	"i2c",
110324f6cfdSwdenk 	"This test verifies the I2C operation.",
111324f6cfdSwdenk 	POST_RAM | POST_ALWAYS,
112228f29acSwdenk 	&i2c_post_test,
1134532cb69Swdenk 	NULL,
1144532cb69Swdenk 	NULL,
1156d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_I2C
116324f6cfdSwdenk     },
117324f6cfdSwdenk #endif
1186d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_RTC
119324f6cfdSwdenk     {
120324f6cfdSwdenk 	"RTC test",
121324f6cfdSwdenk 	"rtc",
122324f6cfdSwdenk 	"This test verifies the RTC operation.",
1238564acf9Swdenk 	POST_RAM | POST_SLOWTEST | POST_MANUAL,
124228f29acSwdenk 	&rtc_post_test,
1254532cb69Swdenk 	NULL,
1264532cb69Swdenk 	NULL,
1276d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_RTC
128324f6cfdSwdenk     },
129324f6cfdSwdenk #endif
1306d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_MEMORY
131324f6cfdSwdenk     {
132324f6cfdSwdenk 	"Memory test",
133324f6cfdSwdenk 	"memory",
134324f6cfdSwdenk 	"This test checks RAM.",
1358564acf9Swdenk 	POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL,
136228f29acSwdenk 	&memory_post_test,
1374532cb69Swdenk 	NULL,
1384532cb69Swdenk 	NULL,
1396d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_MEMORY
140324f6cfdSwdenk     },
141324f6cfdSwdenk #endif
1426d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_CPU
143324f6cfdSwdenk     {
144324f6cfdSwdenk 	"CPU test",
145324f6cfdSwdenk 	"cpu",
146324f6cfdSwdenk 	"This test verifies the arithmetic logic unit of"
147324f6cfdSwdenk 	" CPU.",
148324f6cfdSwdenk 	POST_RAM | POST_ALWAYS,
149228f29acSwdenk 	&cpu_post_test,
1504532cb69Swdenk 	NULL,
1514532cb69Swdenk 	NULL,
1526d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_CPU
153324f6cfdSwdenk     },
154324f6cfdSwdenk #endif
1556d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_FPU
156a11e0696SIgor Lisitsin     {
157a11e0696SIgor Lisitsin 	"FPU test",
158a11e0696SIgor Lisitsin 	"fpu",
159a11e0696SIgor Lisitsin 	"This test verifies the arithmetic logic unit of"
160a11e0696SIgor Lisitsin 	" FPU.",
161a11e0696SIgor Lisitsin 	POST_RAM | POST_ALWAYS,
162a11e0696SIgor Lisitsin 	&fpu_post_test,
163a11e0696SIgor Lisitsin 	NULL,
164a11e0696SIgor Lisitsin 	NULL,
1656d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_FPU
166a11e0696SIgor Lisitsin     },
167a11e0696SIgor Lisitsin #endif
1686d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_UART
169834a45d7SStefan Roese #if defined(CONFIG_POST_UART)
170834a45d7SStefan Roese 	CONFIG_POST_UART,
171834a45d7SStefan Roese #else
172324f6cfdSwdenk     {
173324f6cfdSwdenk 	"UART test",
174324f6cfdSwdenk 	"uart",
175324f6cfdSwdenk 	"This test verifies the UART operation.",
1768564acf9Swdenk 	POST_RAM | POST_SLOWTEST | POST_MANUAL,
177228f29acSwdenk 	&uart_post_test,
1784532cb69Swdenk 	NULL,
1794532cb69Swdenk 	NULL,
1806d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_UART
181324f6cfdSwdenk     },
182834a45d7SStefan Roese #endif /* CONFIG_POST_UART */
183324f6cfdSwdenk #endif
1846d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_ETHER
185324f6cfdSwdenk     {
186324f6cfdSwdenk 	"ETHERNET test",
187324f6cfdSwdenk 	"ethernet",
188324f6cfdSwdenk 	"This test verifies the ETHERNET operation.",
189324f6cfdSwdenk 	POST_RAM | POST_ALWAYS | POST_MANUAL,
190228f29acSwdenk 	&ether_post_test,
1914532cb69Swdenk 	NULL,
1924532cb69Swdenk 	NULL,
1936d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_ETHER
194324f6cfdSwdenk     },
195324f6cfdSwdenk #endif
1966d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_SPI
197324f6cfdSwdenk     {
198324f6cfdSwdenk 	"SPI test",
199324f6cfdSwdenk 	"spi",
200324f6cfdSwdenk 	"This test verifies the SPI operation.",
201324f6cfdSwdenk 	POST_RAM | POST_ALWAYS | POST_MANUAL,
202228f29acSwdenk 	&spi_post_test,
2034532cb69Swdenk 	NULL,
2044532cb69Swdenk 	NULL,
2056d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_SPI
206324f6cfdSwdenk     },
207324f6cfdSwdenk #endif
2086d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_USB
209324f6cfdSwdenk     {
210324f6cfdSwdenk 	"USB test",
211324f6cfdSwdenk 	"usb",
212324f6cfdSwdenk 	"This test verifies the USB operation.",
213324f6cfdSwdenk 	POST_RAM | POST_ALWAYS | POST_MANUAL,
214228f29acSwdenk 	&usb_post_test,
2154532cb69Swdenk 	NULL,
2164532cb69Swdenk 	NULL,
2176d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_USB
218324f6cfdSwdenk     },
219324f6cfdSwdenk #endif
2206d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_SPR
221324f6cfdSwdenk     {
222324f6cfdSwdenk 	"SPR test",
223324f6cfdSwdenk 	"spr",
224324f6cfdSwdenk 	"This test checks SPR contents.",
225b2e2142cSStefan Roese 	POST_RAM | POST_ALWAYS,
226228f29acSwdenk 	&spr_post_test,
2274532cb69Swdenk 	NULL,
2284532cb69Swdenk 	NULL,
2296d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_SPR
230324f6cfdSwdenk     },
231324f6cfdSwdenk #endif
2326d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_SYSMON
2334532cb69Swdenk     {
2344532cb69Swdenk 	"SYSMON test",
2354532cb69Swdenk 	"sysmon",
2364532cb69Swdenk 	"This test monitors system hardware.",
2374532cb69Swdenk 	POST_RAM | POST_ALWAYS,
2384532cb69Swdenk 	&sysmon_post_test,
2394532cb69Swdenk 	&sysmon_init_f,
2404532cb69Swdenk 	&sysmon_reloc,
2416d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_SYSMON
2424532cb69Swdenk     },
2434532cb69Swdenk #endif
2446d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_DSP
2455a8c51cdSwdenk     {
2465a8c51cdSwdenk 	"DSP test",
2475a8c51cdSwdenk 	"dsp",
2485a8c51cdSwdenk 	"This test checks any connected DSP(s).",
2495744ddc6SSascha Laue 	POST_RAM | POST_ALWAYS | POST_MANUAL,
2505a8c51cdSwdenk 	&dsp_post_test,
2515a8c51cdSwdenk 	NULL,
2525a8c51cdSwdenk 	NULL,
2536d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_DSP
2545a8c51cdSwdenk     },
2555a8c51cdSwdenk #endif
2566d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_CODEC
25779fa88f3Swdenk     {
25879fa88f3Swdenk 	"CODEC test",
25979fa88f3Swdenk 	"codec",
26079fa88f3Swdenk 	"This test checks any connected codec(s).",
26179fa88f3Swdenk 	POST_RAM | POST_MANUAL,
26279fa88f3Swdenk 	&codec_post_test,
26379fa88f3Swdenk 	NULL,
26479fa88f3Swdenk 	NULL,
2656d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_CODEC
26679fa88f3Swdenk     },
26779fa88f3Swdenk #endif
2686d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_ECC
269531e3e8bSPavel Kolesnikov     {
270531e3e8bSPavel Kolesnikov 	"ECC test",
271531e3e8bSPavel Kolesnikov 	"ecc",
2728dafa874SLarry Johnson 	"This test checks the ECC facility of memory.",
2738dafa874SLarry Johnson 	POST_ROM | POST_ALWAYS | POST_PREREL,
274531e3e8bSPavel Kolesnikov 	&ecc_post_test,
275531e3e8bSPavel Kolesnikov 	NULL,
276531e3e8bSPavel Kolesnikov 	NULL,
2776d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_ECC
278531e3e8bSPavel Kolesnikov     },
279531e3e8bSPavel Kolesnikov #endif
2806d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_BSPEC1
28165b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC1,
28265b20dceSYuri Tikhonov #endif
2836d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_BSPEC2
28465b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC2,
28565b20dceSYuri Tikhonov #endif
2866d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_BSPEC3
28765b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC3,
28865b20dceSYuri Tikhonov #endif
2896d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_BSPEC4
29065b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC4,
29165b20dceSYuri Tikhonov #endif
2926d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_BSPEC5
29365b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC5,
29465b20dceSYuri Tikhonov #endif
29529fd7cebSAnatolij Gustschin #if CONFIG_POST & CONFIG_SYS_POST_COPROC
29629fd7cebSAnatolij Gustschin     {
29729fd7cebSAnatolij Gustschin 	"Coprocessors communication test",
29829fd7cebSAnatolij Gustschin 	"coproc_com",
29929fd7cebSAnatolij Gustschin 	"This test checks communication with coprocessors.",
30029fd7cebSAnatolij Gustschin 	POST_RAM | POST_ALWAYS | POST_CRITICAL,
30129fd7cebSAnatolij Gustschin 	&coprocessor_post_test,
30229fd7cebSAnatolij Gustschin 	NULL,
30329fd7cebSAnatolij Gustschin 	NULL,
30429fd7cebSAnatolij Gustschin 	CONFIG_SYS_POST_COPROC
305*f6f7395eSMike Frysinger     },
306*f6f7395eSMike Frysinger #endif
307*f6f7395eSMike Frysinger #if CONFIG_POST & CONFIG_SYS_POST_FLASH
308*f6f7395eSMike Frysinger     {
309*f6f7395eSMike Frysinger 	"Parallel NOR flash test",
310*f6f7395eSMike Frysinger 	"flash",
311*f6f7395eSMike Frysinger 	"This test verifies parallel flash operations.",
312*f6f7395eSMike Frysinger 	POST_RAM | POST_SLOWTEST | POST_MANUAL,
313*f6f7395eSMike Frysinger 	&flash_post_test,
314*f6f7395eSMike Frysinger 	NULL,
315*f6f7395eSMike Frysinger 	NULL,
316*f6f7395eSMike Frysinger 	CONFIG_SYS_POST_FLASH
317*f6f7395eSMike Frysinger     },
31829fd7cebSAnatolij Gustschin #endif
319324f6cfdSwdenk };
320324f6cfdSwdenk 
321d2397817SMike Frysinger unsigned int post_list_size = ARRAY_SIZE(post_list);
322