wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2002 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA |
wdenk | 228f29a | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 22 | * |
| 23 | * Be sure to mark tests to be run before relocation as such with the |
| 24 | * CFG_POST_PREREL flag so that logging is done correctly if the |
| 25 | * logbuffer support is enabled. |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 26 | */ |
| 27 | |
| 28 | #include <common.h> |
| 29 | |
| 30 | #ifdef CONFIG_POST |
| 31 | |
| 32 | #include <post.h> |
| 33 | |
| 34 | extern int cache_post_test (int flags); |
| 35 | extern int watchdog_post_test (int flags); |
| 36 | extern int i2c_post_test (int flags); |
| 37 | extern int rtc_post_test (int flags); |
| 38 | extern int memory_post_test (int flags); |
| 39 | extern int cpu_post_test (int flags); |
Igor Lisitsin | a11e069 | 2007-03-28 19:06:19 +0400 | [diff] [blame] | 40 | extern int fpu_post_test (int flags); |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 41 | extern int uart_post_test (int flags); |
| 42 | extern int ether_post_test (int flags); |
| 43 | extern int spi_post_test (int flags); |
| 44 | extern int usb_post_test (int flags); |
| 45 | extern int spr_post_test (int flags); |
wdenk | 4532cb6 | 2003-04-27 22:52:51 +0000 | [diff] [blame] | 46 | extern int sysmon_post_test (int flags); |
wdenk | 5a8c51c | 2004-04-15 21:16:42 +0000 | [diff] [blame] | 47 | extern int dsp_post_test (int flags); |
wdenk | 79fa88f | 2004-06-07 23:46:25 +0000 | [diff] [blame] | 48 | extern int codec_post_test (int flags); |
Pavel Kolesnikov | 531e3e8 | 2007-07-20 15:03:03 +0200 | [diff] [blame] | 49 | extern int ecc_post_test (int flags); |
wdenk | 4532cb6 | 2003-04-27 22:52:51 +0000 | [diff] [blame] | 50 | |
Yuri Tikhonov | 8f15d4a | 2008-02-04 14:10:42 +0100 | [diff] [blame] | 51 | extern int dspic_init_post_test (int flags); |
| 52 | extern int dspic_post_test (int flags); |
| 53 | extern int gdc_post_test (int flags); |
| 54 | extern int fpga_post_test (int flags); |
| 55 | extern int lwmon5_watchdog_post_test(int flags); |
| 56 | extern int sysmon1_post_test(int flags); |
| 57 | |
wdenk | 4532cb6 | 2003-04-27 22:52:51 +0000 | [diff] [blame] | 58 | extern int sysmon_init_f (void); |
| 59 | |
| 60 | extern void sysmon_reloc (void); |
| 61 | |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 62 | |
| 63 | struct post_test post_list[] = |
| 64 | { |
| 65 | #if CONFIG_POST & CFG_POST_CACHE |
| 66 | { |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 67 | "Cache test", |
| 68 | "cache", |
| 69 | "This test verifies the CPU cache operation.", |
| 70 | POST_RAM | POST_ALWAYS, |
| 71 | &cache_post_test, |
| 72 | NULL, |
| 73 | NULL, |
wdenk | 228f29a | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 74 | CFG_POST_CACHE |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 75 | }, |
| 76 | #endif |
| 77 | #if CONFIG_POST & CFG_POST_WATCHDOG |
Yuri Tikhonov | 8f15d4a | 2008-02-04 14:10:42 +0100 | [diff] [blame] | 78 | #if defined(CONFIG_POST_WATCHDOG) |
| 79 | CONFIG_POST_WATCHDOG, |
| 80 | #else |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 81 | { |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 82 | "Watchdog timer test", |
| 83 | "watchdog", |
| 84 | "This test checks the watchdog timer.", |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 85 | POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 86 | &watchdog_post_test, |
| 87 | NULL, |
| 88 | NULL, |
wdenk | 228f29a | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 89 | CFG_POST_WATCHDOG |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 90 | }, |
| 91 | #endif |
Yuri Tikhonov | 8f15d4a | 2008-02-04 14:10:42 +0100 | [diff] [blame] | 92 | #endif |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 93 | #if CONFIG_POST & CFG_POST_I2C |
| 94 | { |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 95 | "I2C test", |
| 96 | "i2c", |
| 97 | "This test verifies the I2C operation.", |
| 98 | POST_RAM | POST_ALWAYS, |
| 99 | &i2c_post_test, |
| 100 | NULL, |
| 101 | NULL, |
wdenk | 228f29a | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 102 | CFG_POST_I2C |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 103 | }, |
| 104 | #endif |
| 105 | #if CONFIG_POST & CFG_POST_RTC |
| 106 | { |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 107 | "RTC test", |
| 108 | "rtc", |
| 109 | "This test verifies the RTC operation.", |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 110 | POST_RAM | POST_SLOWTEST | POST_MANUAL, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 111 | &rtc_post_test, |
| 112 | NULL, |
| 113 | NULL, |
wdenk | 228f29a | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 114 | CFG_POST_RTC |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 115 | }, |
| 116 | #endif |
| 117 | #if CONFIG_POST & CFG_POST_MEMORY |
| 118 | { |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 119 | "Memory test", |
| 120 | "memory", |
| 121 | "This test checks RAM.", |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 122 | POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 123 | &memory_post_test, |
| 124 | NULL, |
| 125 | NULL, |
wdenk | 228f29a | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 126 | CFG_POST_MEMORY |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 127 | }, |
| 128 | #endif |
| 129 | #if CONFIG_POST & CFG_POST_CPU |
| 130 | { |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 131 | "CPU test", |
| 132 | "cpu", |
| 133 | "This test verifies the arithmetic logic unit of" |
| 134 | " CPU.", |
| 135 | POST_RAM | POST_ALWAYS, |
| 136 | &cpu_post_test, |
| 137 | NULL, |
| 138 | NULL, |
wdenk | 228f29a | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 139 | CFG_POST_CPU |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 140 | }, |
| 141 | #endif |
Igor Lisitsin | a11e069 | 2007-03-28 19:06:19 +0400 | [diff] [blame] | 142 | #if CONFIG_POST & CFG_POST_FPU |
| 143 | { |
| 144 | "FPU test", |
| 145 | "fpu", |
| 146 | "This test verifies the arithmetic logic unit of" |
| 147 | " FPU.", |
| 148 | POST_RAM | POST_ALWAYS, |
| 149 | &fpu_post_test, |
| 150 | NULL, |
| 151 | NULL, |
| 152 | CFG_POST_FPU |
| 153 | }, |
| 154 | #endif |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 155 | #if CONFIG_POST & CFG_POST_UART |
| 156 | { |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 157 | "UART test", |
| 158 | "uart", |
| 159 | "This test verifies the UART operation.", |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 160 | POST_RAM | POST_SLOWTEST | POST_MANUAL, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 161 | &uart_post_test, |
| 162 | NULL, |
| 163 | NULL, |
wdenk | 228f29a | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 164 | CFG_POST_UART |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 165 | }, |
| 166 | #endif |
| 167 | #if CONFIG_POST & CFG_POST_ETHER |
| 168 | { |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 169 | "ETHERNET test", |
| 170 | "ethernet", |
| 171 | "This test verifies the ETHERNET operation.", |
| 172 | POST_RAM | POST_ALWAYS | POST_MANUAL, |
| 173 | ðer_post_test, |
| 174 | NULL, |
| 175 | NULL, |
wdenk | 228f29a | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 176 | CFG_POST_ETHER |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 177 | }, |
| 178 | #endif |
| 179 | #if CONFIG_POST & CFG_POST_SPI |
| 180 | { |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 181 | "SPI test", |
| 182 | "spi", |
| 183 | "This test verifies the SPI operation.", |
| 184 | POST_RAM | POST_ALWAYS | POST_MANUAL, |
| 185 | &spi_post_test, |
| 186 | NULL, |
| 187 | NULL, |
wdenk | 228f29a | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 188 | CFG_POST_SPI |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 189 | }, |
| 190 | #endif |
| 191 | #if CONFIG_POST & CFG_POST_USB |
| 192 | { |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 193 | "USB test", |
| 194 | "usb", |
| 195 | "This test verifies the USB operation.", |
| 196 | POST_RAM | POST_ALWAYS | POST_MANUAL, |
| 197 | &usb_post_test, |
| 198 | NULL, |
| 199 | NULL, |
wdenk | 228f29a | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 200 | CFG_POST_USB |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 201 | }, |
| 202 | #endif |
| 203 | #if CONFIG_POST & CFG_POST_SPR |
| 204 | { |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 205 | "SPR test", |
| 206 | "spr", |
| 207 | "This test checks SPR contents.", |
Stefan Roese | b2e2142 | 2008-01-09 10:38:58 +0100 | [diff] [blame] | 208 | POST_RAM | POST_ALWAYS, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 209 | &spr_post_test, |
| 210 | NULL, |
| 211 | NULL, |
wdenk | 228f29a | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 212 | CFG_POST_SPR |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 213 | }, |
| 214 | #endif |
wdenk | 4532cb6 | 2003-04-27 22:52:51 +0000 | [diff] [blame] | 215 | #if CONFIG_POST & CFG_POST_SYSMON |
| 216 | { |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 217 | "SYSMON test", |
| 218 | "sysmon", |
| 219 | "This test monitors system hardware.", |
| 220 | POST_RAM | POST_ALWAYS, |
| 221 | &sysmon_post_test, |
| 222 | &sysmon_init_f, |
| 223 | &sysmon_reloc, |
wdenk | 4532cb6 | 2003-04-27 22:52:51 +0000 | [diff] [blame] | 224 | CFG_POST_SYSMON |
| 225 | }, |
| 226 | #endif |
wdenk | 5a8c51c | 2004-04-15 21:16:42 +0000 | [diff] [blame] | 227 | #if CONFIG_POST & CFG_POST_DSP |
| 228 | { |
| 229 | "DSP test", |
| 230 | "dsp", |
| 231 | "This test checks any connected DSP(s).", |
| 232 | POST_RAM | POST_MANUAL, |
| 233 | &dsp_post_test, |
| 234 | NULL, |
| 235 | NULL, |
| 236 | CFG_POST_DSP |
| 237 | }, |
| 238 | #endif |
Yuri Tikhonov | c2ed33e | 2008-02-04 14:10:01 +0100 | [diff] [blame] | 239 | #if CONFIG_POST & CFG_POST_CODEC |
wdenk | 79fa88f | 2004-06-07 23:46:25 +0000 | [diff] [blame] | 240 | { |
| 241 | "CODEC test", |
| 242 | "codec", |
| 243 | "This test checks any connected codec(s).", |
| 244 | POST_RAM | POST_MANUAL, |
| 245 | &codec_post_test, |
| 246 | NULL, |
| 247 | NULL, |
| 248 | CFG_POST_CODEC |
| 249 | }, |
| 250 | #endif |
Pavel Kolesnikov | 531e3e8 | 2007-07-20 15:03:03 +0200 | [diff] [blame] | 251 | #if CONFIG_POST & CFG_POST_ECC |
| 252 | { |
| 253 | "ECC test", |
| 254 | "ecc", |
Larry Johnson | 8dafa87 | 2008-01-12 23:35:33 -0500 | [diff] [blame] | 255 | "This test checks the ECC facility of memory.", |
| 256 | POST_ROM | POST_ALWAYS | POST_PREREL, |
Pavel Kolesnikov | 531e3e8 | 2007-07-20 15:03:03 +0200 | [diff] [blame] | 257 | &ecc_post_test, |
| 258 | NULL, |
| 259 | NULL, |
| 260 | CFG_POST_ECC |
| 261 | }, |
| 262 | #endif |
Yuri Tikhonov | 8f15d4a | 2008-02-04 14:10:42 +0100 | [diff] [blame] | 263 | #if CONFIG_POST & CFG_POST_BSPEC1 |
| 264 | CONFIG_POST_BSPEC1, |
| 265 | #endif |
| 266 | #if CONFIG_POST & CFG_POST_BSPEC2 |
| 267 | CONFIG_POST_BSPEC2, |
| 268 | #endif |
| 269 | #if CONFIG_POST & CFG_POST_BSPEC3 |
| 270 | CONFIG_POST_BSPEC3, |
| 271 | #endif |
| 272 | #if CONFIG_POST & CFG_POST_BSPEC4 |
| 273 | CONFIG_POST_BSPEC4, |
| 274 | #endif |
| 275 | #if CONFIG_POST & CFG_POST_BSPEC4 |
| 276 | CONFIG_POST_BSPEC5, |
| 277 | #endif |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 278 | }; |
| 279 | |
| 280 | unsigned int post_list_size = sizeof (post_list) / sizeof (struct post_test); |
| 281 | |
| 282 | #endif /* CONFIG_POST */ |