xref: /openbmc/u-boot/post/tests.c (revision 531e3e8b831f357056448fa573137d5fb37000fd)
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 #ifdef CONFIG_POST
31324f6cfdSwdenk 
32324f6cfdSwdenk #include <post.h>
33324f6cfdSwdenk 
34324f6cfdSwdenk extern int cache_post_test (int flags);
35324f6cfdSwdenk extern int watchdog_post_test (int flags);
36324f6cfdSwdenk extern int i2c_post_test (int flags);
37324f6cfdSwdenk extern int rtc_post_test (int flags);
38324f6cfdSwdenk extern int memory_post_test (int flags);
39324f6cfdSwdenk extern int cpu_post_test (int flags);
40a11e0696SIgor Lisitsin extern int fpu_post_test (int flags);
41324f6cfdSwdenk extern int uart_post_test (int flags);
42324f6cfdSwdenk extern int ether_post_test (int flags);
43324f6cfdSwdenk extern int spi_post_test (int flags);
44324f6cfdSwdenk extern int usb_post_test (int flags);
45324f6cfdSwdenk extern int spr_post_test (int flags);
464532cb69Swdenk extern int sysmon_post_test (int flags);
475a8c51cdSwdenk extern int dsp_post_test (int flags);
4879fa88f3Swdenk extern int codec_post_test (int flags);
49*531e3e8bSPavel Kolesnikov extern int ecc_post_test (int flags);
504532cb69Swdenk 
514532cb69Swdenk extern int sysmon_init_f (void);
524532cb69Swdenk 
534532cb69Swdenk extern void sysmon_reloc (void);
544532cb69Swdenk 
55324f6cfdSwdenk 
56324f6cfdSwdenk struct post_test post_list[] =
57324f6cfdSwdenk {
58324f6cfdSwdenk #if CONFIG_POST & CFG_POST_CACHE
59324f6cfdSwdenk     {
60324f6cfdSwdenk 	"Cache test",
61324f6cfdSwdenk 	"cache",
62324f6cfdSwdenk 	"This test verifies the CPU cache operation.",
63324f6cfdSwdenk 	POST_RAM | POST_ALWAYS,
64228f29acSwdenk 	&cache_post_test,
654532cb69Swdenk 	NULL,
664532cb69Swdenk 	NULL,
67228f29acSwdenk 	CFG_POST_CACHE
68324f6cfdSwdenk     },
69324f6cfdSwdenk #endif
70324f6cfdSwdenk #if CONFIG_POST & CFG_POST_WATCHDOG
71324f6cfdSwdenk     {
72324f6cfdSwdenk 	"Watchdog timer test",
73324f6cfdSwdenk 	"watchdog",
74324f6cfdSwdenk 	"This test checks the watchdog timer.",
758564acf9Swdenk 	POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT,
76228f29acSwdenk 	&watchdog_post_test,
774532cb69Swdenk 	NULL,
784532cb69Swdenk 	NULL,
79228f29acSwdenk 	CFG_POST_WATCHDOG
80324f6cfdSwdenk     },
81324f6cfdSwdenk #endif
82324f6cfdSwdenk #if CONFIG_POST & CFG_POST_I2C
83324f6cfdSwdenk     {
84324f6cfdSwdenk 	"I2C test",
85324f6cfdSwdenk 	"i2c",
86324f6cfdSwdenk 	"This test verifies the I2C operation.",
87324f6cfdSwdenk 	POST_RAM | POST_ALWAYS,
88228f29acSwdenk 	&i2c_post_test,
894532cb69Swdenk 	NULL,
904532cb69Swdenk 	NULL,
91228f29acSwdenk 	CFG_POST_I2C
92324f6cfdSwdenk     },
93324f6cfdSwdenk #endif
94324f6cfdSwdenk #if CONFIG_POST & CFG_POST_RTC
95324f6cfdSwdenk     {
96324f6cfdSwdenk 	"RTC test",
97324f6cfdSwdenk 	"rtc",
98324f6cfdSwdenk 	"This test verifies the RTC operation.",
998564acf9Swdenk 	POST_RAM | POST_SLOWTEST | POST_MANUAL,
100228f29acSwdenk 	&rtc_post_test,
1014532cb69Swdenk 	NULL,
1024532cb69Swdenk 	NULL,
103228f29acSwdenk 	CFG_POST_RTC
104324f6cfdSwdenk     },
105324f6cfdSwdenk #endif
106324f6cfdSwdenk #if CONFIG_POST & CFG_POST_MEMORY
107324f6cfdSwdenk     {
108324f6cfdSwdenk 	"Memory test",
109324f6cfdSwdenk 	"memory",
110324f6cfdSwdenk 	"This test checks RAM.",
1118564acf9Swdenk 	POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL,
112228f29acSwdenk 	&memory_post_test,
1134532cb69Swdenk 	NULL,
1144532cb69Swdenk 	NULL,
115228f29acSwdenk 	CFG_POST_MEMORY
116324f6cfdSwdenk     },
117324f6cfdSwdenk #endif
118324f6cfdSwdenk #if CONFIG_POST & CFG_POST_CPU
119324f6cfdSwdenk     {
120324f6cfdSwdenk 	"CPU test",
121324f6cfdSwdenk 	"cpu",
122324f6cfdSwdenk 	"This test verifies the arithmetic logic unit of"
123324f6cfdSwdenk 	" CPU.",
124324f6cfdSwdenk 	POST_RAM | POST_ALWAYS,
125228f29acSwdenk 	&cpu_post_test,
1264532cb69Swdenk 	NULL,
1274532cb69Swdenk 	NULL,
128228f29acSwdenk 	CFG_POST_CPU
129324f6cfdSwdenk     },
130324f6cfdSwdenk #endif
131a11e0696SIgor Lisitsin #if CONFIG_POST & CFG_POST_FPU
132a11e0696SIgor Lisitsin     {
133a11e0696SIgor Lisitsin 	"FPU test",
134a11e0696SIgor Lisitsin 	"fpu",
135a11e0696SIgor Lisitsin 	"This test verifies the arithmetic logic unit of"
136a11e0696SIgor Lisitsin 	" FPU.",
137a11e0696SIgor Lisitsin 	POST_RAM | POST_ALWAYS,
138a11e0696SIgor Lisitsin 	&fpu_post_test,
139a11e0696SIgor Lisitsin 	NULL,
140a11e0696SIgor Lisitsin 	NULL,
141a11e0696SIgor Lisitsin 	CFG_POST_FPU
142a11e0696SIgor Lisitsin     },
143a11e0696SIgor Lisitsin #endif
144324f6cfdSwdenk #if CONFIG_POST & CFG_POST_UART
145324f6cfdSwdenk     {
146324f6cfdSwdenk 	"UART test",
147324f6cfdSwdenk 	"uart",
148324f6cfdSwdenk 	"This test verifies the UART operation.",
1498564acf9Swdenk 	POST_RAM | POST_SLOWTEST | POST_MANUAL,
150228f29acSwdenk 	&uart_post_test,
1514532cb69Swdenk 	NULL,
1524532cb69Swdenk 	NULL,
153228f29acSwdenk 	CFG_POST_UART
154324f6cfdSwdenk     },
155324f6cfdSwdenk #endif
156324f6cfdSwdenk #if CONFIG_POST & CFG_POST_ETHER
157324f6cfdSwdenk     {
158324f6cfdSwdenk 	"ETHERNET test",
159324f6cfdSwdenk 	"ethernet",
160324f6cfdSwdenk 	"This test verifies the ETHERNET operation.",
161324f6cfdSwdenk 	POST_RAM | POST_ALWAYS | POST_MANUAL,
162228f29acSwdenk 	&ether_post_test,
1634532cb69Swdenk 	NULL,
1644532cb69Swdenk 	NULL,
165228f29acSwdenk 	CFG_POST_ETHER
166324f6cfdSwdenk     },
167324f6cfdSwdenk #endif
168324f6cfdSwdenk #if CONFIG_POST & CFG_POST_SPI
169324f6cfdSwdenk     {
170324f6cfdSwdenk 	"SPI test",
171324f6cfdSwdenk 	"spi",
172324f6cfdSwdenk 	"This test verifies the SPI operation.",
173324f6cfdSwdenk 	POST_RAM | POST_ALWAYS | POST_MANUAL,
174228f29acSwdenk 	&spi_post_test,
1754532cb69Swdenk 	NULL,
1764532cb69Swdenk 	NULL,
177228f29acSwdenk 	CFG_POST_SPI
178324f6cfdSwdenk     },
179324f6cfdSwdenk #endif
180324f6cfdSwdenk #if CONFIG_POST & CFG_POST_USB
181324f6cfdSwdenk     {
182324f6cfdSwdenk 	"USB test",
183324f6cfdSwdenk 	"usb",
184324f6cfdSwdenk 	"This test verifies the USB operation.",
185324f6cfdSwdenk 	POST_RAM | POST_ALWAYS | POST_MANUAL,
186228f29acSwdenk 	&usb_post_test,
1874532cb69Swdenk 	NULL,
1884532cb69Swdenk 	NULL,
189228f29acSwdenk 	CFG_POST_USB
190324f6cfdSwdenk     },
191324f6cfdSwdenk #endif
192324f6cfdSwdenk #if CONFIG_POST & CFG_POST_SPR
193324f6cfdSwdenk     {
194324f6cfdSwdenk 	"SPR test",
195324f6cfdSwdenk 	"spr",
196324f6cfdSwdenk 	"This test checks SPR contents.",
197228f29acSwdenk 	POST_ROM | POST_ALWAYS | POST_PREREL,
198228f29acSwdenk 	&spr_post_test,
1994532cb69Swdenk 	NULL,
2004532cb69Swdenk 	NULL,
201228f29acSwdenk 	CFG_POST_SPR
202324f6cfdSwdenk     },
203324f6cfdSwdenk #endif
2044532cb69Swdenk #if CONFIG_POST & CFG_POST_SYSMON
2054532cb69Swdenk     {
2064532cb69Swdenk 	"SYSMON test",
2074532cb69Swdenk 	"sysmon",
2084532cb69Swdenk 	"This test monitors system hardware.",
2094532cb69Swdenk 	POST_RAM | POST_ALWAYS,
2104532cb69Swdenk 	&sysmon_post_test,
2114532cb69Swdenk 	&sysmon_init_f,
2124532cb69Swdenk 	&sysmon_reloc,
2134532cb69Swdenk 	CFG_POST_SYSMON
2144532cb69Swdenk     },
2154532cb69Swdenk #endif
2165a8c51cdSwdenk #if CONFIG_POST & CFG_POST_DSP
2175a8c51cdSwdenk     {
2185a8c51cdSwdenk 	"DSP test",
2195a8c51cdSwdenk 	"dsp",
2205a8c51cdSwdenk 	"This test checks any connected DSP(s).",
2215a8c51cdSwdenk 	POST_RAM | POST_MANUAL,
2225a8c51cdSwdenk 	&dsp_post_test,
2235a8c51cdSwdenk 	NULL,
2245a8c51cdSwdenk 	NULL,
2255a8c51cdSwdenk 	CFG_POST_DSP
2265a8c51cdSwdenk     },
2275a8c51cdSwdenk #endif
22879fa88f3Swdenk #if CONFIG_POST & CFG_POST_DSP
22979fa88f3Swdenk     {
23079fa88f3Swdenk 	"CODEC test",
23179fa88f3Swdenk 	"codec",
23279fa88f3Swdenk 	"This test checks any connected codec(s).",
23379fa88f3Swdenk 	POST_RAM | POST_MANUAL,
23479fa88f3Swdenk 	&codec_post_test,
23579fa88f3Swdenk 	NULL,
23679fa88f3Swdenk 	NULL,
23779fa88f3Swdenk 	CFG_POST_CODEC
23879fa88f3Swdenk     },
23979fa88f3Swdenk #endif
240*531e3e8bSPavel Kolesnikov #if CONFIG_POST & CFG_POST_ECC
241*531e3e8bSPavel Kolesnikov     {
242*531e3e8bSPavel Kolesnikov 	"ECC test",
243*531e3e8bSPavel Kolesnikov 	"ecc",
244*531e3e8bSPavel Kolesnikov 	"This test checks ECC facility of memory.",
245*531e3e8bSPavel Kolesnikov 	POST_ROM | POST_ALWAYS,
246*531e3e8bSPavel Kolesnikov 	&ecc_post_test,
247*531e3e8bSPavel Kolesnikov 	NULL,
248*531e3e8bSPavel Kolesnikov 	NULL,
249*531e3e8bSPavel Kolesnikov 	CFG_POST_ECC
250*531e3e8bSPavel Kolesnikov     },
251*531e3e8bSPavel Kolesnikov #endif
252324f6cfdSwdenk };
253324f6cfdSwdenk 
254324f6cfdSwdenk unsigned int post_list_size = sizeof (post_list) / sizeof (struct post_test);
255324f6cfdSwdenk 
256324f6cfdSwdenk #endif /* CONFIG_POST */
257