xref: /openbmc/u-boot/post/tests.c (revision 29fd7ceb3c1cb7ffaffce1047e806d1e85e3ab4b)
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);
56*29fd7cebSAnatolij 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
168324f6cfdSwdenk     {
169324f6cfdSwdenk 	"UART test",
170324f6cfdSwdenk 	"uart",
171324f6cfdSwdenk 	"This test verifies the UART operation.",
1728564acf9Swdenk 	POST_RAM | POST_SLOWTEST | POST_MANUAL,
173228f29acSwdenk 	&uart_post_test,
1744532cb69Swdenk 	NULL,
1754532cb69Swdenk 	NULL,
1766d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_UART
177324f6cfdSwdenk     },
178324f6cfdSwdenk #endif
1796d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_ETHER
180324f6cfdSwdenk     {
181324f6cfdSwdenk 	"ETHERNET test",
182324f6cfdSwdenk 	"ethernet",
183324f6cfdSwdenk 	"This test verifies the ETHERNET operation.",
184324f6cfdSwdenk 	POST_RAM | POST_ALWAYS | POST_MANUAL,
185228f29acSwdenk 	&ether_post_test,
1864532cb69Swdenk 	NULL,
1874532cb69Swdenk 	NULL,
1886d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_ETHER
189324f6cfdSwdenk     },
190324f6cfdSwdenk #endif
1916d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_SPI
192324f6cfdSwdenk     {
193324f6cfdSwdenk 	"SPI test",
194324f6cfdSwdenk 	"spi",
195324f6cfdSwdenk 	"This test verifies the SPI operation.",
196324f6cfdSwdenk 	POST_RAM | POST_ALWAYS | POST_MANUAL,
197228f29acSwdenk 	&spi_post_test,
1984532cb69Swdenk 	NULL,
1994532cb69Swdenk 	NULL,
2006d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_SPI
201324f6cfdSwdenk     },
202324f6cfdSwdenk #endif
2036d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_USB
204324f6cfdSwdenk     {
205324f6cfdSwdenk 	"USB test",
206324f6cfdSwdenk 	"usb",
207324f6cfdSwdenk 	"This test verifies the USB operation.",
208324f6cfdSwdenk 	POST_RAM | POST_ALWAYS | POST_MANUAL,
209228f29acSwdenk 	&usb_post_test,
2104532cb69Swdenk 	NULL,
2114532cb69Swdenk 	NULL,
2126d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_USB
213324f6cfdSwdenk     },
214324f6cfdSwdenk #endif
2156d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_SPR
216324f6cfdSwdenk     {
217324f6cfdSwdenk 	"SPR test",
218324f6cfdSwdenk 	"spr",
219324f6cfdSwdenk 	"This test checks SPR contents.",
220b2e2142cSStefan Roese 	POST_RAM | POST_ALWAYS,
221228f29acSwdenk 	&spr_post_test,
2224532cb69Swdenk 	NULL,
2234532cb69Swdenk 	NULL,
2246d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_SPR
225324f6cfdSwdenk     },
226324f6cfdSwdenk #endif
2276d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_SYSMON
2284532cb69Swdenk     {
2294532cb69Swdenk 	"SYSMON test",
2304532cb69Swdenk 	"sysmon",
2314532cb69Swdenk 	"This test monitors system hardware.",
2324532cb69Swdenk 	POST_RAM | POST_ALWAYS,
2334532cb69Swdenk 	&sysmon_post_test,
2344532cb69Swdenk 	&sysmon_init_f,
2354532cb69Swdenk 	&sysmon_reloc,
2366d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_SYSMON
2374532cb69Swdenk     },
2384532cb69Swdenk #endif
2396d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_DSP
2405a8c51cdSwdenk     {
2415a8c51cdSwdenk 	"DSP test",
2425a8c51cdSwdenk 	"dsp",
2435a8c51cdSwdenk 	"This test checks any connected DSP(s).",
2445744ddc6SSascha Laue 	POST_RAM | POST_ALWAYS | POST_MANUAL,
2455a8c51cdSwdenk 	&dsp_post_test,
2465a8c51cdSwdenk 	NULL,
2475a8c51cdSwdenk 	NULL,
2486d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_DSP
2495a8c51cdSwdenk     },
2505a8c51cdSwdenk #endif
2516d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_CODEC
25279fa88f3Swdenk     {
25379fa88f3Swdenk 	"CODEC test",
25479fa88f3Swdenk 	"codec",
25579fa88f3Swdenk 	"This test checks any connected codec(s).",
25679fa88f3Swdenk 	POST_RAM | POST_MANUAL,
25779fa88f3Swdenk 	&codec_post_test,
25879fa88f3Swdenk 	NULL,
25979fa88f3Swdenk 	NULL,
2606d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_CODEC
26179fa88f3Swdenk     },
26279fa88f3Swdenk #endif
2636d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_ECC
264531e3e8bSPavel Kolesnikov     {
265531e3e8bSPavel Kolesnikov 	"ECC test",
266531e3e8bSPavel Kolesnikov 	"ecc",
2678dafa874SLarry Johnson 	"This test checks the ECC facility of memory.",
2688dafa874SLarry Johnson 	POST_ROM | POST_ALWAYS | POST_PREREL,
269531e3e8bSPavel Kolesnikov 	&ecc_post_test,
270531e3e8bSPavel Kolesnikov 	NULL,
271531e3e8bSPavel Kolesnikov 	NULL,
2726d0f6bcfSJean-Christophe PLAGNIOL-VILLARD 	CONFIG_SYS_POST_ECC
273531e3e8bSPavel Kolesnikov     },
274531e3e8bSPavel Kolesnikov #endif
2756d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_BSPEC1
27665b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC1,
27765b20dceSYuri Tikhonov #endif
2786d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_BSPEC2
27965b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC2,
28065b20dceSYuri Tikhonov #endif
2816d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_BSPEC3
28265b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC3,
28365b20dceSYuri Tikhonov #endif
2846d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_BSPEC4
28565b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC4,
28665b20dceSYuri Tikhonov #endif
2876d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #if CONFIG_POST & CONFIG_SYS_POST_BSPEC5
28865b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC5,
28965b20dceSYuri Tikhonov #endif
290*29fd7cebSAnatolij Gustschin #if CONFIG_POST & CONFIG_SYS_POST_COPROC
291*29fd7cebSAnatolij Gustschin     {
292*29fd7cebSAnatolij Gustschin 	"Coprocessors communication test",
293*29fd7cebSAnatolij Gustschin 	"coproc_com",
294*29fd7cebSAnatolij Gustschin 	"This test checks communication with coprocessors.",
295*29fd7cebSAnatolij Gustschin 	POST_RAM | POST_ALWAYS | POST_CRITICAL,
296*29fd7cebSAnatolij Gustschin 	&coprocessor_post_test,
297*29fd7cebSAnatolij Gustschin 	NULL,
298*29fd7cebSAnatolij Gustschin 	NULL,
299*29fd7cebSAnatolij Gustschin 	CONFIG_SYS_POST_COPROC
300*29fd7cebSAnatolij Gustschin     }
301*29fd7cebSAnatolij Gustschin #endif
302324f6cfdSwdenk };
303324f6cfdSwdenk 
304324f6cfdSwdenk unsigned int post_list_size = sizeof (post_list) / sizeof (struct post_test);
305