Blame view

post/tests.c 6.26 KB
324f6cfd1   wdenk   Initial revision
1
2
3
4
  /*
   * (C) Copyright 2002
   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
   *
1a4596601   Wolfgang Denk   Add GPL-2.0+ SPDX...
5
   * SPDX-License-Identifier:	GPL-2.0+
228f29ac6   wdenk   * Improve log buf...
6
7
   *
   * Be sure to mark tests to be run before relocation as such with the
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
8
   * CONFIG_SYS_POST_PREREL flag so that logging is done correctly if the
228f29ac6   wdenk   * Improve log buf...
9
   * logbuffer support is enabled.
324f6cfd1   wdenk   Initial revision
10
11
12
   */
  
  #include <common.h>
324f6cfd1   wdenk   Initial revision
13
  #include <post.h>
6e8ec6822   Yuri Tikhonov   POST: OCM test ad...
14
  extern int ocm_post_test (int flags);
324f6cfd1   wdenk   Initial revision
15
16
17
18
19
20
  extern int cache_post_test (int flags);
  extern int watchdog_post_test (int flags);
  extern int i2c_post_test (int flags);
  extern int rtc_post_test (int flags);
  extern int memory_post_test (int flags);
  extern int cpu_post_test (int flags);
a11e06965   Igor Lisitsin   Extend POST suppo...
21
  extern int fpu_post_test (int flags);
324f6cfd1   wdenk   Initial revision
22
23
24
25
26
  extern int uart_post_test (int flags);
  extern int ether_post_test (int flags);
  extern int spi_post_test (int flags);
  extern int usb_post_test (int flags);
  extern int spr_post_test (int flags);
4532cb696   wdenk   * LWMON extensions:
27
  extern int sysmon_post_test (int flags);
5a8c51cd5   wdenk   * Patches by Pant...
28
  extern int dsp_post_test (int flags);
79fa88f3e   wdenk   Patch by Pantelis...
29
  extern int codec_post_test (int flags);
531e3e8b8   Pavel Kolesnikov   POST: Add ECC POS...
30
  extern int ecc_post_test (int flags);
f6f7395eb   Mike Frysinger   post: new nor fla...
31
  extern int flash_post_test(int flags);
4532cb696   wdenk   * LWMON extensions:
32

65b20dcef   Yuri Tikhonov   The patch adds ne...
33
34
35
36
37
38
  extern int dspic_init_post_test (int flags);
  extern int dspic_post_test (int flags);
  extern int gdc_post_test (int flags);
  extern int fpga_post_test (int flags);
  extern int lwmon5_watchdog_post_test(int flags);
  extern int sysmon1_post_test(int flags);
29fd7ceb3   Anatolij Gustschin   mpc5121: pdm360ng...
39
  extern int coprocessor_post_test(int flags);
2151374fa   Mike Frysinger   Blackfin: post: g...
40
41
  extern int led_post_test(int flags);
  extern int button_post_test(int flags);
8d3fcb5e6   Valentin Longchamp   POST: add new mem...
42
  extern int memory_regions_post_test(int flags);
65b20dcef   Yuri Tikhonov   The patch adds ne...
43

4532cb696   wdenk   * LWMON extensions:
44
45
46
  extern int sysmon_init_f (void);
  
  extern void sysmon_reloc (void);
324f6cfd1   wdenk   Initial revision
47
48
49
  
  struct post_test post_list[] =
  {
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
50
  #if CONFIG_POST & CONFIG_SYS_POST_OCM
6e8ec6822   Yuri Tikhonov   POST: OCM test ad...
51
52
53
54
      {
  	"OCM test",
  	"ocm",
  	"This test checks on chip memory (OCM).",
7845d4909   Yuri Tikhonov   POST: mark OCM te...
55
  	POST_ROM | POST_ALWAYS | POST_PREREL | POST_CRITICAL | POST_STOP,
6e8ec6822   Yuri Tikhonov   POST: OCM test ad...
56
57
58
  	&ocm_post_test,
  	NULL,
  	NULL,
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
59
  	CONFIG_SYS_POST_OCM
6e8ec6822   Yuri Tikhonov   POST: OCM test ad...
60
61
      },
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
62
  #if CONFIG_POST & CONFIG_SYS_POST_CACHE
324f6cfd1   wdenk   Initial revision
63
      {
8bde7f776   wdenk   * Code cleanup:
64
65
66
67
68
69
70
  	"Cache test",
  	"cache",
  	"This test verifies the CPU cache operation.",
  	POST_RAM | POST_ALWAYS,
  	&cache_post_test,
  	NULL,
  	NULL,
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
71
  	CONFIG_SYS_POST_CACHE
324f6cfd1   wdenk   Initial revision
72
73
      },
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
74
  #if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG
65b20dcef   Yuri Tikhonov   The patch adds ne...
75
76
77
  #if defined(CONFIG_POST_WATCHDOG)
  	CONFIG_POST_WATCHDOG,
  #else
324f6cfd1   wdenk   Initial revision
78
      {
8bde7f776   wdenk   * Code cleanup:
79
80
81
  	"Watchdog timer test",
  	"watchdog",
  	"This test checks the watchdog timer.",
8564acf93   wdenk   * Patches by Yuli...
82
  	POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT,
8bde7f776   wdenk   * Code cleanup:
83
84
85
  	&watchdog_post_test,
  	NULL,
  	NULL,
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
86
  	CONFIG_SYS_POST_WATCHDOG
324f6cfd1   wdenk   Initial revision
87
88
      },
  #endif
65b20dcef   Yuri Tikhonov   The patch adds ne...
89
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
90
  #if CONFIG_POST & CONFIG_SYS_POST_I2C
324f6cfd1   wdenk   Initial revision
91
      {
8bde7f776   wdenk   * Code cleanup:
92
93
94
95
96
97
98
  	"I2C test",
  	"i2c",
  	"This test verifies the I2C operation.",
  	POST_RAM | POST_ALWAYS,
  	&i2c_post_test,
  	NULL,
  	NULL,
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
99
  	CONFIG_SYS_POST_I2C
324f6cfd1   wdenk   Initial revision
100
101
      },
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
102
  #if CONFIG_POST & CONFIG_SYS_POST_RTC
324f6cfd1   wdenk   Initial revision
103
      {
8bde7f776   wdenk   * Code cleanup:
104
105
106
  	"RTC test",
  	"rtc",
  	"This test verifies the RTC operation.",
8564acf93   wdenk   * Patches by Yuli...
107
  	POST_RAM | POST_SLOWTEST | POST_MANUAL,
8bde7f776   wdenk   * Code cleanup:
108
109
110
  	&rtc_post_test,
  	NULL,
  	NULL,
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
111
  	CONFIG_SYS_POST_RTC
324f6cfd1   wdenk   Initial revision
112
113
      },
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
114
  #if CONFIG_POST & CONFIG_SYS_POST_MEMORY
324f6cfd1   wdenk   Initial revision
115
      {
8bde7f776   wdenk   * Code cleanup:
116
117
118
  	"Memory test",
  	"memory",
  	"This test checks RAM.",
8564acf93   wdenk   * Patches by Yuli...
119
  	POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL,
8bde7f776   wdenk   * Code cleanup:
120
121
122
  	&memory_post_test,
  	NULL,
  	NULL,
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
123
  	CONFIG_SYS_POST_MEMORY
324f6cfd1   wdenk   Initial revision
124
125
      },
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
126
  #if CONFIG_POST & CONFIG_SYS_POST_CPU
324f6cfd1   wdenk   Initial revision
127
      {
8bde7f776   wdenk   * Code cleanup:
128
129
130
131
132
133
134
135
  	"CPU test",
  	"cpu",
  	"This test verifies the arithmetic logic unit of"
  	" CPU.",
  	POST_RAM | POST_ALWAYS,
  	&cpu_post_test,
  	NULL,
  	NULL,
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
136
  	CONFIG_SYS_POST_CPU
324f6cfd1   wdenk   Initial revision
137
138
      },
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
139
  #if CONFIG_POST & CONFIG_SYS_POST_FPU
a11e06965   Igor Lisitsin   Extend POST suppo...
140
141
142
143
144
145
146
147
148
      {
  	"FPU test",
  	"fpu",
  	"This test verifies the arithmetic logic unit of"
  	" FPU.",
  	POST_RAM | POST_ALWAYS,
  	&fpu_post_test,
  	NULL,
  	NULL,
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
149
  	CONFIG_SYS_POST_FPU
a11e06965   Igor Lisitsin   Extend POST suppo...
150
151
      },
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
152
  #if CONFIG_POST & CONFIG_SYS_POST_UART
834a45d7e   Stefan Roese   ppc4xx/POST: Add ...
153
154
155
  #if defined(CONFIG_POST_UART)
  	CONFIG_POST_UART,
  #else
324f6cfd1   wdenk   Initial revision
156
      {
8bde7f776   wdenk   * Code cleanup:
157
158
159
  	"UART test",
  	"uart",
  	"This test verifies the UART operation.",
8564acf93   wdenk   * Patches by Yuli...
160
  	POST_RAM | POST_SLOWTEST | POST_MANUAL,
8bde7f776   wdenk   * Code cleanup:
161
162
163
  	&uart_post_test,
  	NULL,
  	NULL,
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
164
  	CONFIG_SYS_POST_UART
324f6cfd1   wdenk   Initial revision
165
      },
834a45d7e   Stefan Roese   ppc4xx/POST: Add ...
166
  #endif /* CONFIG_POST_UART */
324f6cfd1   wdenk   Initial revision
167
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
168
  #if CONFIG_POST & CONFIG_SYS_POST_ETHER
324f6cfd1   wdenk   Initial revision
169
      {
8bde7f776   wdenk   * Code cleanup:
170
171
172
  	"ETHERNET test",
  	"ethernet",
  	"This test verifies the ETHERNET operation.",
5735bca5f   Robert P. J. Day   post: Delete unne...
173
  	POST_RAM | POST_ALWAYS,
8bde7f776   wdenk   * Code cleanup:
174
175
176
  	&ether_post_test,
  	NULL,
  	NULL,
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
177
  	CONFIG_SYS_POST_ETHER
324f6cfd1   wdenk   Initial revision
178
179
      },
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
180
  #if CONFIG_POST & CONFIG_SYS_POST_USB
324f6cfd1   wdenk   Initial revision
181
      {
8bde7f776   wdenk   * Code cleanup:
182
183
184
  	"USB test",
  	"usb",
  	"This test verifies the USB operation.",
5735bca5f   Robert P. J. Day   post: Delete unne...
185
  	POST_RAM | POST_ALWAYS,
8bde7f776   wdenk   * Code cleanup:
186
187
188
  	&usb_post_test,
  	NULL,
  	NULL,
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
189
  	CONFIG_SYS_POST_USB
324f6cfd1   wdenk   Initial revision
190
191
      },
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
192
  #if CONFIG_POST & CONFIG_SYS_POST_SPR
324f6cfd1   wdenk   Initial revision
193
      {
8bde7f776   wdenk   * Code cleanup:
194
195
196
  	"SPR test",
  	"spr",
  	"This test checks SPR contents.",
b2e2142c5   Stefan Roese   POST: Execute SPR...
197
  	POST_RAM | POST_ALWAYS,
8bde7f776   wdenk   * Code cleanup:
198
199
200
  	&spr_post_test,
  	NULL,
  	NULL,
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
201
  	CONFIG_SYS_POST_SPR
324f6cfd1   wdenk   Initial revision
202
203
      },
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
204
  #if CONFIG_POST & CONFIG_SYS_POST_SYSMON
4532cb696   wdenk   * LWMON extensions:
205
      {
8bde7f776   wdenk   * Code cleanup:
206
207
208
209
210
211
212
  	"SYSMON test",
  	"sysmon",
  	"This test monitors system hardware.",
  	POST_RAM | POST_ALWAYS,
  	&sysmon_post_test,
  	&sysmon_init_f,
  	&sysmon_reloc,
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
213
  	CONFIG_SYS_POST_SYSMON
4532cb696   wdenk   * LWMON extensions:
214
215
      },
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
216
  #if CONFIG_POST & CONFIG_SYS_POST_DSP
5a8c51cd5   wdenk   * Patches by Pant...
217
218
219
220
      {
  	"DSP test",
  	"dsp",
  	"This test checks any connected DSP(s).",
5735bca5f   Robert P. J. Day   post: Delete unne...
221
  	POST_RAM | POST_ALWAYS,
5a8c51cd5   wdenk   * Patches by Pant...
222
223
224
  	&dsp_post_test,
  	NULL,
  	NULL,
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
225
  	CONFIG_SYS_POST_DSP
5a8c51cd5   wdenk   * Patches by Pant...
226
227
      },
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
228
  #if CONFIG_POST & CONFIG_SYS_POST_CODEC
79fa88f3e   wdenk   Patch by Pantelis...
229
230
231
232
233
234
235
236
      {
  	"CODEC test",
  	"codec",
  	"This test checks any connected codec(s).",
  	POST_RAM | POST_MANUAL,
  	&codec_post_test,
  	NULL,
  	NULL,
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
237
  	CONFIG_SYS_POST_CODEC
79fa88f3e   wdenk   Patch by Pantelis...
238
239
      },
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
240
  #if CONFIG_POST & CONFIG_SYS_POST_ECC
531e3e8b8   Pavel Kolesnikov   POST: Add ECC POS...
241
242
243
      {
  	"ECC test",
  	"ecc",
8dafa8747   Larry Johnson   Add attribute POS...
244
245
  	"This test checks the ECC facility of memory.",
  	POST_ROM | POST_ALWAYS | POST_PREREL,
531e3e8b8   Pavel Kolesnikov   POST: Add ECC POS...
246
247
248
  	&ecc_post_test,
  	NULL,
  	NULL,
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
249
  	CONFIG_SYS_POST_ECC
531e3e8b8   Pavel Kolesnikov   POST: Add ECC POS...
250
251
      },
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
252
  #if CONFIG_POST & CONFIG_SYS_POST_BSPEC1
65b20dcef   Yuri Tikhonov   The patch adds ne...
253
254
  	CONFIG_POST_BSPEC1,
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
255
  #if CONFIG_POST & CONFIG_SYS_POST_BSPEC2
65b20dcef   Yuri Tikhonov   The patch adds ne...
256
257
  	CONFIG_POST_BSPEC2,
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
258
  #if CONFIG_POST & CONFIG_SYS_POST_BSPEC3
65b20dcef   Yuri Tikhonov   The patch adds ne...
259
260
  	CONFIG_POST_BSPEC3,
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
261
  #if CONFIG_POST & CONFIG_SYS_POST_BSPEC4
65b20dcef   Yuri Tikhonov   The patch adds ne...
262
263
  	CONFIG_POST_BSPEC4,
  #endif
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
264
  #if CONFIG_POST & CONFIG_SYS_POST_BSPEC5
65b20dcef   Yuri Tikhonov   The patch adds ne...
265
266
  	CONFIG_POST_BSPEC5,
  #endif
29fd7ceb3   Anatolij Gustschin   mpc5121: pdm360ng...
267
268
269
270
271
272
273
274
275
276
  #if CONFIG_POST & CONFIG_SYS_POST_COPROC
      {
  	"Coprocessors communication test",
  	"coproc_com",
  	"This test checks communication with coprocessors.",
  	POST_RAM | POST_ALWAYS | POST_CRITICAL,
  	&coprocessor_post_test,
  	NULL,
  	NULL,
  	CONFIG_SYS_POST_COPROC
f6f7395eb   Mike Frysinger   post: new nor fla...
277
278
279
280
281
282
283
284
285
286
287
288
289
      },
  #endif
  #if CONFIG_POST & CONFIG_SYS_POST_FLASH
      {
  	"Parallel NOR flash test",
  	"flash",
  	"This test verifies parallel flash operations.",
  	POST_RAM | POST_SLOWTEST | POST_MANUAL,
  	&flash_post_test,
  	NULL,
  	NULL,
  	CONFIG_SYS_POST_FLASH
      },
29fd7ceb3   Anatolij Gustschin   mpc5121: pdm360ng...
290
  #endif
8d3fcb5e6   Valentin Longchamp   POST: add new mem...
291
292
293
294
295
296
297
298
299
300
301
302
  #if CONFIG_POST & CONFIG_SYS_POST_MEM_REGIONS
      {
  	"Memory regions test",
  	"mem_regions",
  	"This test checks regularly placed regions of the RAM.",
  	POST_ROM | POST_SLOWTEST | POST_PREREL,
  	&memory_regions_post_test,
  	NULL,
  	NULL,
  	CONFIG_SYS_POST_MEM_REGIONS
      },
  #endif
324f6cfd1   wdenk   Initial revision
303
  };
d2397817f   Mike Frysinger   post: use ARRAY_SIZE
304
  unsigned int post_list_size = ARRAY_SIZE(post_list);