Blame view

post/tests.c 6.08 KB
83d290c56   Tom Rini   SPDX: Convert all...
1
  // SPDX-License-Identifier: GPL-2.0+
324f6cfd1   wdenk   Initial revision
2
3
4
  /*
   * (C) Copyright 2002
   * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
324f6cfd1   wdenk   Initial revision
5
6
7
   */
  
  #include <common.h>
324f6cfd1   wdenk   Initial revision
8
  #include <post.h>
6e8ec6822   Yuri Tikhonov   POST: OCM test ad...
9
  extern int ocm_post_test (int flags);
324f6cfd1   wdenk   Initial revision
10
11
12
13
14
15
  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...
16
  extern int fpu_post_test (int flags);
324f6cfd1   wdenk   Initial revision
17
18
19
20
21
  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:
22
  extern int sysmon_post_test (int flags);
5a8c51cd5   wdenk   * Patches by Pant...
23
  extern int dsp_post_test (int flags);
79fa88f3e   wdenk   Patch by Pantelis...
24
  extern int codec_post_test (int flags);
531e3e8b8   Pavel Kolesnikov   POST: Add ECC POS...
25
  extern int ecc_post_test (int flags);
f6f7395eb   Mike Frysinger   post: new nor fla...
26
  extern int flash_post_test(int flags);
4532cb696   wdenk   * LWMON extensions:
27

65b20dcef   Yuri Tikhonov   The patch adds ne...
28
29
30
31
32
33
  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...
34
  extern int coprocessor_post_test(int flags);
2151374fa   Mike Frysinger   Blackfin: post: g...
35
36
  extern int led_post_test(int flags);
  extern int button_post_test(int flags);
8d3fcb5e6   Valentin Longchamp   POST: add new mem...
37
  extern int memory_regions_post_test(int flags);
65b20dcef   Yuri Tikhonov   The patch adds ne...
38

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