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 | 9dfa8d1 | 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 | 95bcd38 | 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 | c08f158 | 2003-04-27 22:52:51 +0000 | [diff] [blame] | 46 | extern int sysmon_post_test (int flags); |
wdenk | 6164217 | 2004-04-15 21:16:42 +0000 | [diff] [blame] | 47 | extern int dsp_post_test (int flags); |
wdenk | c4e854f | 2004-06-07 23:46:25 +0000 | [diff] [blame] | 48 | extern int codec_post_test (int flags); |
Pavel Kolesnikov | 5d89611 | 2007-07-20 15:03:03 +0200 | [diff] [blame] | 49 | extern int ecc_post_test (int flags); |
wdenk | c08f158 | 2003-04-27 22:52:51 +0000 | [diff] [blame] | 50 | |
| 51 | extern int sysmon_init_f (void); |
| 52 | |
| 53 | extern void sysmon_reloc (void); |
| 54 | |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 55 | |
| 56 | struct post_test post_list[] = |
| 57 | { |
| 58 | #if CONFIG_POST & CFG_POST_CACHE |
| 59 | { |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 60 | "Cache test", |
| 61 | "cache", |
| 62 | "This test verifies the CPU cache operation.", |
| 63 | POST_RAM | POST_ALWAYS, |
| 64 | &cache_post_test, |
| 65 | NULL, |
| 66 | NULL, |
wdenk | 9dfa8d1 | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 67 | CFG_POST_CACHE |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 68 | }, |
| 69 | #endif |
| 70 | #if CONFIG_POST & CFG_POST_WATCHDOG |
| 71 | { |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 72 | "Watchdog timer test", |
| 73 | "watchdog", |
| 74 | "This test checks the watchdog timer.", |
wdenk | dccbda0 | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 75 | POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT, |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 76 | &watchdog_post_test, |
| 77 | NULL, |
| 78 | NULL, |
wdenk | 9dfa8d1 | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 79 | CFG_POST_WATCHDOG |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 80 | }, |
| 81 | #endif |
| 82 | #if CONFIG_POST & CFG_POST_I2C |
| 83 | { |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 84 | "I2C test", |
| 85 | "i2c", |
| 86 | "This test verifies the I2C operation.", |
| 87 | POST_RAM | POST_ALWAYS, |
| 88 | &i2c_post_test, |
| 89 | NULL, |
| 90 | NULL, |
wdenk | 9dfa8d1 | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 91 | CFG_POST_I2C |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 92 | }, |
| 93 | #endif |
| 94 | #if CONFIG_POST & CFG_POST_RTC |
| 95 | { |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 96 | "RTC test", |
| 97 | "rtc", |
| 98 | "This test verifies the RTC operation.", |
wdenk | dccbda0 | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 99 | POST_RAM | POST_SLOWTEST | POST_MANUAL, |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 100 | &rtc_post_test, |
| 101 | NULL, |
| 102 | NULL, |
wdenk | 9dfa8d1 | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 103 | CFG_POST_RTC |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 104 | }, |
| 105 | #endif |
| 106 | #if CONFIG_POST & CFG_POST_MEMORY |
| 107 | { |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 108 | "Memory test", |
| 109 | "memory", |
| 110 | "This test checks RAM.", |
wdenk | dccbda0 | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 111 | POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL, |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 112 | &memory_post_test, |
| 113 | NULL, |
| 114 | NULL, |
wdenk | 9dfa8d1 | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 115 | CFG_POST_MEMORY |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 116 | }, |
| 117 | #endif |
| 118 | #if CONFIG_POST & CFG_POST_CPU |
| 119 | { |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 120 | "CPU test", |
| 121 | "cpu", |
| 122 | "This test verifies the arithmetic logic unit of" |
| 123 | " CPU.", |
| 124 | POST_RAM | POST_ALWAYS, |
| 125 | &cpu_post_test, |
| 126 | NULL, |
| 127 | NULL, |
wdenk | 9dfa8d1 | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 128 | CFG_POST_CPU |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 129 | }, |
| 130 | #endif |
Igor Lisitsin | 95bcd38 | 2007-03-28 19:06:19 +0400 | [diff] [blame] | 131 | #if CONFIG_POST & CFG_POST_FPU |
| 132 | { |
| 133 | "FPU test", |
| 134 | "fpu", |
| 135 | "This test verifies the arithmetic logic unit of" |
| 136 | " FPU.", |
| 137 | POST_RAM | POST_ALWAYS, |
| 138 | &fpu_post_test, |
| 139 | NULL, |
| 140 | NULL, |
| 141 | CFG_POST_FPU |
| 142 | }, |
| 143 | #endif |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 144 | #if CONFIG_POST & CFG_POST_UART |
| 145 | { |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 146 | "UART test", |
| 147 | "uart", |
| 148 | "This test verifies the UART operation.", |
wdenk | dccbda0 | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 149 | POST_RAM | POST_SLOWTEST | POST_MANUAL, |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 150 | &uart_post_test, |
| 151 | NULL, |
| 152 | NULL, |
wdenk | 9dfa8d1 | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 153 | CFG_POST_UART |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 154 | }, |
| 155 | #endif |
| 156 | #if CONFIG_POST & CFG_POST_ETHER |
| 157 | { |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 158 | "ETHERNET test", |
| 159 | "ethernet", |
| 160 | "This test verifies the ETHERNET operation.", |
| 161 | POST_RAM | POST_ALWAYS | POST_MANUAL, |
| 162 | ðer_post_test, |
| 163 | NULL, |
| 164 | NULL, |
wdenk | 9dfa8d1 | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 165 | CFG_POST_ETHER |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 166 | }, |
| 167 | #endif |
| 168 | #if CONFIG_POST & CFG_POST_SPI |
| 169 | { |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 170 | "SPI test", |
| 171 | "spi", |
| 172 | "This test verifies the SPI operation.", |
| 173 | POST_RAM | POST_ALWAYS | POST_MANUAL, |
| 174 | &spi_post_test, |
| 175 | NULL, |
| 176 | NULL, |
wdenk | 9dfa8d1 | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 177 | CFG_POST_SPI |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 178 | }, |
| 179 | #endif |
| 180 | #if CONFIG_POST & CFG_POST_USB |
| 181 | { |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 182 | "USB test", |
| 183 | "usb", |
| 184 | "This test verifies the USB operation.", |
| 185 | POST_RAM | POST_ALWAYS | POST_MANUAL, |
| 186 | &usb_post_test, |
| 187 | NULL, |
| 188 | NULL, |
wdenk | 9dfa8d1 | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 189 | CFG_POST_USB |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 190 | }, |
| 191 | #endif |
| 192 | #if CONFIG_POST & CFG_POST_SPR |
| 193 | { |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 194 | "SPR test", |
| 195 | "spr", |
| 196 | "This test checks SPR contents.", |
| 197 | POST_ROM | POST_ALWAYS | POST_PREREL, |
| 198 | &spr_post_test, |
| 199 | NULL, |
| 200 | NULL, |
wdenk | 9dfa8d1 | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 201 | CFG_POST_SPR |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 202 | }, |
| 203 | #endif |
wdenk | c08f158 | 2003-04-27 22:52:51 +0000 | [diff] [blame] | 204 | #if CONFIG_POST & CFG_POST_SYSMON |
| 205 | { |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 206 | "SYSMON test", |
| 207 | "sysmon", |
| 208 | "This test monitors system hardware.", |
| 209 | POST_RAM | POST_ALWAYS, |
| 210 | &sysmon_post_test, |
| 211 | &sysmon_init_f, |
| 212 | &sysmon_reloc, |
wdenk | c08f158 | 2003-04-27 22:52:51 +0000 | [diff] [blame] | 213 | CFG_POST_SYSMON |
| 214 | }, |
| 215 | #endif |
wdenk | 6164217 | 2004-04-15 21:16:42 +0000 | [diff] [blame] | 216 | #if CONFIG_POST & CFG_POST_DSP |
| 217 | { |
| 218 | "DSP test", |
| 219 | "dsp", |
| 220 | "This test checks any connected DSP(s).", |
| 221 | POST_RAM | POST_MANUAL, |
| 222 | &dsp_post_test, |
| 223 | NULL, |
| 224 | NULL, |
| 225 | CFG_POST_DSP |
| 226 | }, |
| 227 | #endif |
wdenk | c4e854f | 2004-06-07 23:46:25 +0000 | [diff] [blame] | 228 | #if CONFIG_POST & CFG_POST_DSP |
| 229 | { |
| 230 | "CODEC test", |
| 231 | "codec", |
| 232 | "This test checks any connected codec(s).", |
| 233 | POST_RAM | POST_MANUAL, |
| 234 | &codec_post_test, |
| 235 | NULL, |
| 236 | NULL, |
| 237 | CFG_POST_CODEC |
| 238 | }, |
| 239 | #endif |
Pavel Kolesnikov | 5d89611 | 2007-07-20 15:03:03 +0200 | [diff] [blame] | 240 | #if CONFIG_POST & CFG_POST_ECC |
| 241 | { |
| 242 | "ECC test", |
| 243 | "ecc", |
| 244 | "This test checks ECC facility of memory.", |
| 245 | POST_ROM | POST_ALWAYS, |
| 246 | &ecc_post_test, |
| 247 | NULL, |
| 248 | NULL, |
| 249 | CFG_POST_ECC |
| 250 | }, |
| 251 | #endif |
wdenk | 324f6cf | 2002-10-07 21:13:39 +0000 | [diff] [blame] | 252 | }; |
| 253 | |
| 254 | unsigned int post_list_size = sizeof (post_list) / sizeof (struct post_test); |
| 255 | |
| 256 | #endif /* CONFIG_POST */ |