xref: /openbmc/u-boot/post/tests.c (revision 79fa88f3ede051ca860667d5397e6cdc7e74a6d0)
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);
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);
47*79fa88f3Swdenk extern int codec_post_test (int flags);
484532cb69Swdenk 
494532cb69Swdenk extern int sysmon_init_f (void);
504532cb69Swdenk 
514532cb69Swdenk extern void sysmon_reloc (void);
524532cb69Swdenk 
53324f6cfdSwdenk 
54324f6cfdSwdenk struct post_test post_list[] =
55324f6cfdSwdenk {
56324f6cfdSwdenk #if CONFIG_POST & CFG_POST_CACHE
57324f6cfdSwdenk     {
58324f6cfdSwdenk 	"Cache test",
59324f6cfdSwdenk 	"cache",
60324f6cfdSwdenk 	"This test verifies the CPU cache operation.",
61324f6cfdSwdenk 	POST_RAM | POST_ALWAYS,
62228f29acSwdenk 	&cache_post_test,
634532cb69Swdenk 	NULL,
644532cb69Swdenk 	NULL,
65228f29acSwdenk 	CFG_POST_CACHE
66324f6cfdSwdenk     },
67324f6cfdSwdenk #endif
68324f6cfdSwdenk #if CONFIG_POST & CFG_POST_WATCHDOG
69324f6cfdSwdenk     {
70324f6cfdSwdenk 	"Watchdog timer test",
71324f6cfdSwdenk 	"watchdog",
72324f6cfdSwdenk 	"This test checks the watchdog timer.",
738564acf9Swdenk 	POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT,
74228f29acSwdenk 	&watchdog_post_test,
754532cb69Swdenk 	NULL,
764532cb69Swdenk 	NULL,
77228f29acSwdenk 	CFG_POST_WATCHDOG
78324f6cfdSwdenk     },
79324f6cfdSwdenk #endif
80324f6cfdSwdenk #if CONFIG_POST & CFG_POST_I2C
81324f6cfdSwdenk     {
82324f6cfdSwdenk 	"I2C test",
83324f6cfdSwdenk 	"i2c",
84324f6cfdSwdenk 	"This test verifies the I2C operation.",
85324f6cfdSwdenk 	POST_RAM | POST_ALWAYS,
86228f29acSwdenk 	&i2c_post_test,
874532cb69Swdenk 	NULL,
884532cb69Swdenk 	NULL,
89228f29acSwdenk 	CFG_POST_I2C
90324f6cfdSwdenk     },
91324f6cfdSwdenk #endif
92324f6cfdSwdenk #if CONFIG_POST & CFG_POST_RTC
93324f6cfdSwdenk     {
94324f6cfdSwdenk 	"RTC test",
95324f6cfdSwdenk 	"rtc",
96324f6cfdSwdenk 	"This test verifies the RTC operation.",
978564acf9Swdenk 	POST_RAM | POST_SLOWTEST | POST_MANUAL,
98228f29acSwdenk 	&rtc_post_test,
994532cb69Swdenk 	NULL,
1004532cb69Swdenk 	NULL,
101228f29acSwdenk 	CFG_POST_RTC
102324f6cfdSwdenk     },
103324f6cfdSwdenk #endif
104324f6cfdSwdenk #if CONFIG_POST & CFG_POST_MEMORY
105324f6cfdSwdenk     {
106324f6cfdSwdenk 	"Memory test",
107324f6cfdSwdenk 	"memory",
108324f6cfdSwdenk 	"This test checks RAM.",
1098564acf9Swdenk 	POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL,
110228f29acSwdenk 	&memory_post_test,
1114532cb69Swdenk 	NULL,
1124532cb69Swdenk 	NULL,
113228f29acSwdenk 	CFG_POST_MEMORY
114324f6cfdSwdenk     },
115324f6cfdSwdenk #endif
116324f6cfdSwdenk #if CONFIG_POST & CFG_POST_CPU
117324f6cfdSwdenk     {
118324f6cfdSwdenk 	"CPU test",
119324f6cfdSwdenk 	"cpu",
120324f6cfdSwdenk 	"This test verifies the arithmetic logic unit of"
121324f6cfdSwdenk 	" CPU.",
122324f6cfdSwdenk 	POST_RAM | POST_ALWAYS,
123228f29acSwdenk 	&cpu_post_test,
1244532cb69Swdenk 	NULL,
1254532cb69Swdenk 	NULL,
126228f29acSwdenk 	CFG_POST_CPU
127324f6cfdSwdenk     },
128324f6cfdSwdenk #endif
129324f6cfdSwdenk #if CONFIG_POST & CFG_POST_UART
130324f6cfdSwdenk     {
131324f6cfdSwdenk 	"UART test",
132324f6cfdSwdenk 	"uart",
133324f6cfdSwdenk 	"This test verifies the UART operation.",
1348564acf9Swdenk 	POST_RAM | POST_SLOWTEST | POST_MANUAL,
135228f29acSwdenk 	&uart_post_test,
1364532cb69Swdenk 	NULL,
1374532cb69Swdenk 	NULL,
138228f29acSwdenk 	CFG_POST_UART
139324f6cfdSwdenk     },
140324f6cfdSwdenk #endif
141324f6cfdSwdenk #if CONFIG_POST & CFG_POST_ETHER
142324f6cfdSwdenk     {
143324f6cfdSwdenk 	"ETHERNET test",
144324f6cfdSwdenk 	"ethernet",
145324f6cfdSwdenk 	"This test verifies the ETHERNET operation.",
146324f6cfdSwdenk 	POST_RAM | POST_ALWAYS | POST_MANUAL,
147228f29acSwdenk 	&ether_post_test,
1484532cb69Swdenk 	NULL,
1494532cb69Swdenk 	NULL,
150228f29acSwdenk 	CFG_POST_ETHER
151324f6cfdSwdenk     },
152324f6cfdSwdenk #endif
153324f6cfdSwdenk #if CONFIG_POST & CFG_POST_SPI
154324f6cfdSwdenk     {
155324f6cfdSwdenk 	"SPI test",
156324f6cfdSwdenk 	"spi",
157324f6cfdSwdenk 	"This test verifies the SPI operation.",
158324f6cfdSwdenk 	POST_RAM | POST_ALWAYS | POST_MANUAL,
159228f29acSwdenk 	&spi_post_test,
1604532cb69Swdenk 	NULL,
1614532cb69Swdenk 	NULL,
162228f29acSwdenk 	CFG_POST_SPI
163324f6cfdSwdenk     },
164324f6cfdSwdenk #endif
165324f6cfdSwdenk #if CONFIG_POST & CFG_POST_USB
166324f6cfdSwdenk     {
167324f6cfdSwdenk 	"USB test",
168324f6cfdSwdenk 	"usb",
169324f6cfdSwdenk 	"This test verifies the USB operation.",
170324f6cfdSwdenk 	POST_RAM | POST_ALWAYS | POST_MANUAL,
171228f29acSwdenk 	&usb_post_test,
1724532cb69Swdenk 	NULL,
1734532cb69Swdenk 	NULL,
174228f29acSwdenk 	CFG_POST_USB
175324f6cfdSwdenk     },
176324f6cfdSwdenk #endif
177324f6cfdSwdenk #if CONFIG_POST & CFG_POST_SPR
178324f6cfdSwdenk     {
179324f6cfdSwdenk 	"SPR test",
180324f6cfdSwdenk 	"spr",
181324f6cfdSwdenk 	"This test checks SPR contents.",
182228f29acSwdenk 	POST_ROM | POST_ALWAYS | POST_PREREL,
183228f29acSwdenk 	&spr_post_test,
1844532cb69Swdenk 	NULL,
1854532cb69Swdenk 	NULL,
186228f29acSwdenk 	CFG_POST_SPR
187324f6cfdSwdenk     },
188324f6cfdSwdenk #endif
1894532cb69Swdenk #if CONFIG_POST & CFG_POST_SYSMON
1904532cb69Swdenk     {
1914532cb69Swdenk 	"SYSMON test",
1924532cb69Swdenk 	"sysmon",
1934532cb69Swdenk 	"This test monitors system hardware.",
1944532cb69Swdenk 	POST_RAM | POST_ALWAYS,
1954532cb69Swdenk 	&sysmon_post_test,
1964532cb69Swdenk 	&sysmon_init_f,
1974532cb69Swdenk 	&sysmon_reloc,
1984532cb69Swdenk 	CFG_POST_SYSMON
1994532cb69Swdenk     },
2004532cb69Swdenk #endif
2015a8c51cdSwdenk #if CONFIG_POST & CFG_POST_DSP
2025a8c51cdSwdenk     {
2035a8c51cdSwdenk 	"DSP test",
2045a8c51cdSwdenk 	"dsp",
2055a8c51cdSwdenk 	"This test checks any connected DSP(s).",
2065a8c51cdSwdenk 	POST_RAM | POST_MANUAL,
2075a8c51cdSwdenk 	&dsp_post_test,
2085a8c51cdSwdenk 	NULL,
2095a8c51cdSwdenk 	NULL,
2105a8c51cdSwdenk 	CFG_POST_DSP
2115a8c51cdSwdenk     },
2125a8c51cdSwdenk #endif
213*79fa88f3Swdenk #if CONFIG_POST & CFG_POST_DSP
214*79fa88f3Swdenk     {
215*79fa88f3Swdenk 	"CODEC test",
216*79fa88f3Swdenk 	"codec",
217*79fa88f3Swdenk 	"This test checks any connected codec(s).",
218*79fa88f3Swdenk 	POST_RAM | POST_MANUAL,
219*79fa88f3Swdenk 	&codec_post_test,
220*79fa88f3Swdenk 	NULL,
221*79fa88f3Swdenk 	NULL,
222*79fa88f3Swdenk 	CFG_POST_CODEC
223*79fa88f3Swdenk     },
224*79fa88f3Swdenk #endif
225324f6cfdSwdenk };
226324f6cfdSwdenk 
227324f6cfdSwdenk unsigned int post_list_size = sizeof (post_list) / sizeof (struct post_test);
228324f6cfdSwdenk 
229324f6cfdSwdenk #endif /* CONFIG_POST */
230