xref: /openbmc/u-boot/post/tests.c (revision 7845d49094c81321021b50a4dbb8864d2f3777e4)
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
24228f29acSwdenk  * CFG_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);
5665b20dceSYuri Tikhonov 
574532cb69Swdenk extern int sysmon_init_f (void);
584532cb69Swdenk 
594532cb69Swdenk extern void sysmon_reloc (void);
604532cb69Swdenk 
61324f6cfdSwdenk 
62324f6cfdSwdenk struct post_test post_list[] =
63324f6cfdSwdenk {
646e8ec682SYuri Tikhonov #if CONFIG_POST & CFG_POST_OCM
656e8ec682SYuri Tikhonov     {
666e8ec682SYuri Tikhonov 	"OCM test",
676e8ec682SYuri Tikhonov 	"ocm",
686e8ec682SYuri Tikhonov 	"This test checks on chip memory (OCM).",
69*7845d490SYuri Tikhonov 	POST_ROM | POST_ALWAYS | POST_PREREL | POST_CRITICAL | POST_STOP,
706e8ec682SYuri Tikhonov 	&ocm_post_test,
716e8ec682SYuri Tikhonov 	NULL,
726e8ec682SYuri Tikhonov 	NULL,
736e8ec682SYuri Tikhonov 	CFG_POST_OCM
746e8ec682SYuri Tikhonov     },
756e8ec682SYuri Tikhonov #endif
76324f6cfdSwdenk #if CONFIG_POST & CFG_POST_CACHE
77324f6cfdSwdenk     {
78324f6cfdSwdenk 	"Cache test",
79324f6cfdSwdenk 	"cache",
80324f6cfdSwdenk 	"This test verifies the CPU cache operation.",
81324f6cfdSwdenk 	POST_RAM | POST_ALWAYS,
82228f29acSwdenk 	&cache_post_test,
834532cb69Swdenk 	NULL,
844532cb69Swdenk 	NULL,
85228f29acSwdenk 	CFG_POST_CACHE
86324f6cfdSwdenk     },
87324f6cfdSwdenk #endif
88324f6cfdSwdenk #if CONFIG_POST & CFG_POST_WATCHDOG
8965b20dceSYuri Tikhonov #if defined(CONFIG_POST_WATCHDOG)
9065b20dceSYuri Tikhonov 	CONFIG_POST_WATCHDOG,
9165b20dceSYuri Tikhonov #else
92324f6cfdSwdenk     {
93324f6cfdSwdenk 	"Watchdog timer test",
94324f6cfdSwdenk 	"watchdog",
95324f6cfdSwdenk 	"This test checks the watchdog timer.",
968564acf9Swdenk 	POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT,
97228f29acSwdenk 	&watchdog_post_test,
984532cb69Swdenk 	NULL,
994532cb69Swdenk 	NULL,
100228f29acSwdenk 	CFG_POST_WATCHDOG
101324f6cfdSwdenk     },
102324f6cfdSwdenk #endif
10365b20dceSYuri Tikhonov #endif
104324f6cfdSwdenk #if CONFIG_POST & CFG_POST_I2C
105324f6cfdSwdenk     {
106324f6cfdSwdenk 	"I2C test",
107324f6cfdSwdenk 	"i2c",
108324f6cfdSwdenk 	"This test verifies the I2C operation.",
109324f6cfdSwdenk 	POST_RAM | POST_ALWAYS,
110228f29acSwdenk 	&i2c_post_test,
1114532cb69Swdenk 	NULL,
1124532cb69Swdenk 	NULL,
113228f29acSwdenk 	CFG_POST_I2C
114324f6cfdSwdenk     },
115324f6cfdSwdenk #endif
116324f6cfdSwdenk #if CONFIG_POST & CFG_POST_RTC
117324f6cfdSwdenk     {
118324f6cfdSwdenk 	"RTC test",
119324f6cfdSwdenk 	"rtc",
120324f6cfdSwdenk 	"This test verifies the RTC operation.",
1218564acf9Swdenk 	POST_RAM | POST_SLOWTEST | POST_MANUAL,
122228f29acSwdenk 	&rtc_post_test,
1234532cb69Swdenk 	NULL,
1244532cb69Swdenk 	NULL,
125228f29acSwdenk 	CFG_POST_RTC
126324f6cfdSwdenk     },
127324f6cfdSwdenk #endif
128324f6cfdSwdenk #if CONFIG_POST & CFG_POST_MEMORY
129324f6cfdSwdenk     {
130324f6cfdSwdenk 	"Memory test",
131324f6cfdSwdenk 	"memory",
132324f6cfdSwdenk 	"This test checks RAM.",
1338564acf9Swdenk 	POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL,
134228f29acSwdenk 	&memory_post_test,
1354532cb69Swdenk 	NULL,
1364532cb69Swdenk 	NULL,
137228f29acSwdenk 	CFG_POST_MEMORY
138324f6cfdSwdenk     },
139324f6cfdSwdenk #endif
140324f6cfdSwdenk #if CONFIG_POST & CFG_POST_CPU
141324f6cfdSwdenk     {
142324f6cfdSwdenk 	"CPU test",
143324f6cfdSwdenk 	"cpu",
144324f6cfdSwdenk 	"This test verifies the arithmetic logic unit of"
145324f6cfdSwdenk 	" CPU.",
146324f6cfdSwdenk 	POST_RAM | POST_ALWAYS,
147228f29acSwdenk 	&cpu_post_test,
1484532cb69Swdenk 	NULL,
1494532cb69Swdenk 	NULL,
150228f29acSwdenk 	CFG_POST_CPU
151324f6cfdSwdenk     },
152324f6cfdSwdenk #endif
153a11e0696SIgor Lisitsin #if CONFIG_POST & CFG_POST_FPU
154a11e0696SIgor Lisitsin     {
155a11e0696SIgor Lisitsin 	"FPU test",
156a11e0696SIgor Lisitsin 	"fpu",
157a11e0696SIgor Lisitsin 	"This test verifies the arithmetic logic unit of"
158a11e0696SIgor Lisitsin 	" FPU.",
159a11e0696SIgor Lisitsin 	POST_RAM | POST_ALWAYS,
160a11e0696SIgor Lisitsin 	&fpu_post_test,
161a11e0696SIgor Lisitsin 	NULL,
162a11e0696SIgor Lisitsin 	NULL,
163a11e0696SIgor Lisitsin 	CFG_POST_FPU
164a11e0696SIgor Lisitsin     },
165a11e0696SIgor Lisitsin #endif
166324f6cfdSwdenk #if CONFIG_POST & CFG_POST_UART
167324f6cfdSwdenk     {
168324f6cfdSwdenk 	"UART test",
169324f6cfdSwdenk 	"uart",
170324f6cfdSwdenk 	"This test verifies the UART operation.",
1718564acf9Swdenk 	POST_RAM | POST_SLOWTEST | POST_MANUAL,
172228f29acSwdenk 	&uart_post_test,
1734532cb69Swdenk 	NULL,
1744532cb69Swdenk 	NULL,
175228f29acSwdenk 	CFG_POST_UART
176324f6cfdSwdenk     },
177324f6cfdSwdenk #endif
178324f6cfdSwdenk #if CONFIG_POST & CFG_POST_ETHER
179324f6cfdSwdenk     {
180324f6cfdSwdenk 	"ETHERNET test",
181324f6cfdSwdenk 	"ethernet",
182324f6cfdSwdenk 	"This test verifies the ETHERNET operation.",
183324f6cfdSwdenk 	POST_RAM | POST_ALWAYS | POST_MANUAL,
184228f29acSwdenk 	&ether_post_test,
1854532cb69Swdenk 	NULL,
1864532cb69Swdenk 	NULL,
187228f29acSwdenk 	CFG_POST_ETHER
188324f6cfdSwdenk     },
189324f6cfdSwdenk #endif
190324f6cfdSwdenk #if CONFIG_POST & CFG_POST_SPI
191324f6cfdSwdenk     {
192324f6cfdSwdenk 	"SPI test",
193324f6cfdSwdenk 	"spi",
194324f6cfdSwdenk 	"This test verifies the SPI operation.",
195324f6cfdSwdenk 	POST_RAM | POST_ALWAYS | POST_MANUAL,
196228f29acSwdenk 	&spi_post_test,
1974532cb69Swdenk 	NULL,
1984532cb69Swdenk 	NULL,
199228f29acSwdenk 	CFG_POST_SPI
200324f6cfdSwdenk     },
201324f6cfdSwdenk #endif
202324f6cfdSwdenk #if CONFIG_POST & CFG_POST_USB
203324f6cfdSwdenk     {
204324f6cfdSwdenk 	"USB test",
205324f6cfdSwdenk 	"usb",
206324f6cfdSwdenk 	"This test verifies the USB operation.",
207324f6cfdSwdenk 	POST_RAM | POST_ALWAYS | POST_MANUAL,
208228f29acSwdenk 	&usb_post_test,
2094532cb69Swdenk 	NULL,
2104532cb69Swdenk 	NULL,
211228f29acSwdenk 	CFG_POST_USB
212324f6cfdSwdenk     },
213324f6cfdSwdenk #endif
214324f6cfdSwdenk #if CONFIG_POST & CFG_POST_SPR
215324f6cfdSwdenk     {
216324f6cfdSwdenk 	"SPR test",
217324f6cfdSwdenk 	"spr",
218324f6cfdSwdenk 	"This test checks SPR contents.",
219b2e2142cSStefan Roese 	POST_RAM | POST_ALWAYS,
220228f29acSwdenk 	&spr_post_test,
2214532cb69Swdenk 	NULL,
2224532cb69Swdenk 	NULL,
223228f29acSwdenk 	CFG_POST_SPR
224324f6cfdSwdenk     },
225324f6cfdSwdenk #endif
2264532cb69Swdenk #if CONFIG_POST & CFG_POST_SYSMON
2274532cb69Swdenk     {
2284532cb69Swdenk 	"SYSMON test",
2294532cb69Swdenk 	"sysmon",
2304532cb69Swdenk 	"This test monitors system hardware.",
2314532cb69Swdenk 	POST_RAM | POST_ALWAYS,
2324532cb69Swdenk 	&sysmon_post_test,
2334532cb69Swdenk 	&sysmon_init_f,
2344532cb69Swdenk 	&sysmon_reloc,
2354532cb69Swdenk 	CFG_POST_SYSMON
2364532cb69Swdenk     },
2374532cb69Swdenk #endif
2385a8c51cdSwdenk #if CONFIG_POST & CFG_POST_DSP
2395a8c51cdSwdenk     {
2405a8c51cdSwdenk 	"DSP test",
2415a8c51cdSwdenk 	"dsp",
2425a8c51cdSwdenk 	"This test checks any connected DSP(s).",
2435a8c51cdSwdenk 	POST_RAM | POST_MANUAL,
2445a8c51cdSwdenk 	&dsp_post_test,
2455a8c51cdSwdenk 	NULL,
2465a8c51cdSwdenk 	NULL,
2475a8c51cdSwdenk 	CFG_POST_DSP
2485a8c51cdSwdenk     },
2495a8c51cdSwdenk #endif
2508dc3b230SYuri Tikhonov #if CONFIG_POST & CFG_POST_CODEC
25179fa88f3Swdenk     {
25279fa88f3Swdenk 	"CODEC test",
25379fa88f3Swdenk 	"codec",
25479fa88f3Swdenk 	"This test checks any connected codec(s).",
25579fa88f3Swdenk 	POST_RAM | POST_MANUAL,
25679fa88f3Swdenk 	&codec_post_test,
25779fa88f3Swdenk 	NULL,
25879fa88f3Swdenk 	NULL,
25979fa88f3Swdenk 	CFG_POST_CODEC
26079fa88f3Swdenk     },
26179fa88f3Swdenk #endif
262531e3e8bSPavel Kolesnikov #if CONFIG_POST & CFG_POST_ECC
263531e3e8bSPavel Kolesnikov     {
264531e3e8bSPavel Kolesnikov 	"ECC test",
265531e3e8bSPavel Kolesnikov 	"ecc",
2668dafa874SLarry Johnson 	"This test checks the ECC facility of memory.",
2678dafa874SLarry Johnson 	POST_ROM | POST_ALWAYS | POST_PREREL,
268531e3e8bSPavel Kolesnikov 	&ecc_post_test,
269531e3e8bSPavel Kolesnikov 	NULL,
270531e3e8bSPavel Kolesnikov 	NULL,
271531e3e8bSPavel Kolesnikov 	CFG_POST_ECC
272531e3e8bSPavel Kolesnikov     },
273531e3e8bSPavel Kolesnikov #endif
27465b20dceSYuri Tikhonov #if CONFIG_POST & CFG_POST_BSPEC1
27565b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC1,
27665b20dceSYuri Tikhonov #endif
27765b20dceSYuri Tikhonov #if CONFIG_POST & CFG_POST_BSPEC2
27865b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC2,
27965b20dceSYuri Tikhonov #endif
28065b20dceSYuri Tikhonov #if CONFIG_POST & CFG_POST_BSPEC3
28165b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC3,
28265b20dceSYuri Tikhonov #endif
28365b20dceSYuri Tikhonov #if CONFIG_POST & CFG_POST_BSPEC4
28465b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC4,
28565b20dceSYuri Tikhonov #endif
2866891260bSYuri Tikhonov #if CONFIG_POST & CFG_POST_BSPEC5
28765b20dceSYuri Tikhonov 	CONFIG_POST_BSPEC5,
28865b20dceSYuri Tikhonov #endif
289324f6cfdSwdenk };
290324f6cfdSwdenk 
291324f6cfdSwdenk unsigned int post_list_size = sizeof (post_list) / sizeof (struct post_test);
292