tests.c 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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
  22. *
  23. * Be sure to mark tests to be run before relocation as such with the
  24. * CONFIG_SYS_POST_PREREL flag so that logging is done correctly if the
  25. * logbuffer support is enabled.
  26. */
  27. #include <common.h>
  28. #include <post.h>
  29. extern int ocm_post_test (int flags);
  30. extern int cache_post_test (int flags);
  31. extern int watchdog_post_test (int flags);
  32. extern int i2c_post_test (int flags);
  33. extern int rtc_post_test (int flags);
  34. extern int memory_post_test (int flags);
  35. extern int cpu_post_test (int flags);
  36. extern int fpu_post_test (int flags);
  37. extern int uart_post_test (int flags);
  38. extern int ether_post_test (int flags);
  39. extern int spi_post_test (int flags);
  40. extern int usb_post_test (int flags);
  41. extern int spr_post_test (int flags);
  42. extern int sysmon_post_test (int flags);
  43. extern int dsp_post_test (int flags);
  44. extern int codec_post_test (int flags);
  45. extern int ecc_post_test (int flags);
  46. extern int flash_post_test(int flags);
  47. extern int dspic_init_post_test (int flags);
  48. extern int dspic_post_test (int flags);
  49. extern int gdc_post_test (int flags);
  50. extern int fpga_post_test (int flags);
  51. extern int lwmon5_watchdog_post_test(int flags);
  52. extern int sysmon1_post_test(int flags);
  53. extern int coprocessor_post_test(int flags);
  54. extern int led_post_test(int flags);
  55. extern int button_post_test(int flags);
  56. extern int memory_regions_post_test(int flags);
  57. extern int sysmon_init_f (void);
  58. extern void sysmon_reloc (void);
  59. struct post_test post_list[] =
  60. {
  61. #if CONFIG_POST & CONFIG_SYS_POST_OCM
  62. {
  63. "OCM test",
  64. "ocm",
  65. "This test checks on chip memory (OCM).",
  66. POST_ROM | POST_ALWAYS | POST_PREREL | POST_CRITICAL | POST_STOP,
  67. &ocm_post_test,
  68. NULL,
  69. NULL,
  70. CONFIG_SYS_POST_OCM
  71. },
  72. #endif
  73. #if CONFIG_POST & CONFIG_SYS_POST_CACHE
  74. {
  75. "Cache test",
  76. "cache",
  77. "This test verifies the CPU cache operation.",
  78. POST_RAM | POST_ALWAYS,
  79. &cache_post_test,
  80. NULL,
  81. NULL,
  82. CONFIG_SYS_POST_CACHE
  83. },
  84. #endif
  85. #if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG
  86. #if defined(CONFIG_POST_WATCHDOG)
  87. CONFIG_POST_WATCHDOG,
  88. #else
  89. {
  90. "Watchdog timer test",
  91. "watchdog",
  92. "This test checks the watchdog timer.",
  93. POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT,
  94. &watchdog_post_test,
  95. NULL,
  96. NULL,
  97. CONFIG_SYS_POST_WATCHDOG
  98. },
  99. #endif
  100. #endif
  101. #if CONFIG_POST & CONFIG_SYS_POST_I2C
  102. {
  103. "I2C test",
  104. "i2c",
  105. "This test verifies the I2C operation.",
  106. POST_RAM | POST_ALWAYS,
  107. &i2c_post_test,
  108. NULL,
  109. NULL,
  110. CONFIG_SYS_POST_I2C
  111. },
  112. #endif
  113. #if CONFIG_POST & CONFIG_SYS_POST_RTC
  114. {
  115. "RTC test",
  116. "rtc",
  117. "This test verifies the RTC operation.",
  118. POST_RAM | POST_SLOWTEST | POST_MANUAL,
  119. &rtc_post_test,
  120. NULL,
  121. NULL,
  122. CONFIG_SYS_POST_RTC
  123. },
  124. #endif
  125. #if CONFIG_POST & CONFIG_SYS_POST_MEMORY
  126. {
  127. "Memory test",
  128. "memory",
  129. "This test checks RAM.",
  130. POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL,
  131. &memory_post_test,
  132. NULL,
  133. NULL,
  134. CONFIG_SYS_POST_MEMORY
  135. },
  136. #endif
  137. #if CONFIG_POST & CONFIG_SYS_POST_CPU
  138. {
  139. "CPU test",
  140. "cpu",
  141. "This test verifies the arithmetic logic unit of"
  142. " CPU.",
  143. POST_RAM | POST_ALWAYS,
  144. &cpu_post_test,
  145. NULL,
  146. NULL,
  147. CONFIG_SYS_POST_CPU
  148. },
  149. #endif
  150. #if CONFIG_POST & CONFIG_SYS_POST_FPU
  151. {
  152. "FPU test",
  153. "fpu",
  154. "This test verifies the arithmetic logic unit of"
  155. " FPU.",
  156. POST_RAM | POST_ALWAYS,
  157. &fpu_post_test,
  158. NULL,
  159. NULL,
  160. CONFIG_SYS_POST_FPU
  161. },
  162. #endif
  163. #if CONFIG_POST & CONFIG_SYS_POST_UART
  164. #if defined(CONFIG_POST_UART)
  165. CONFIG_POST_UART,
  166. #else
  167. {
  168. "UART test",
  169. "uart",
  170. "This test verifies the UART operation.",
  171. POST_RAM | POST_SLOWTEST | POST_MANUAL,
  172. &uart_post_test,
  173. NULL,
  174. NULL,
  175. CONFIG_SYS_POST_UART
  176. },
  177. #endif /* CONFIG_POST_UART */
  178. #endif
  179. #if CONFIG_POST & CONFIG_SYS_POST_ETHER
  180. {
  181. "ETHERNET test",
  182. "ethernet",
  183. "This test verifies the ETHERNET operation.",
  184. POST_RAM | POST_ALWAYS | POST_MANUAL,
  185. &ether_post_test,
  186. NULL,
  187. NULL,
  188. CONFIG_SYS_POST_ETHER
  189. },
  190. #endif
  191. #if CONFIG_POST & CONFIG_SYS_POST_SPI
  192. {
  193. "SPI test",
  194. "spi",
  195. "This test verifies the SPI operation.",
  196. POST_RAM | POST_ALWAYS | POST_MANUAL,
  197. &spi_post_test,
  198. NULL,
  199. NULL,
  200. CONFIG_SYS_POST_SPI
  201. },
  202. #endif
  203. #if CONFIG_POST & CONFIG_SYS_POST_USB
  204. {
  205. "USB test",
  206. "usb",
  207. "This test verifies the USB operation.",
  208. POST_RAM | POST_ALWAYS | POST_MANUAL,
  209. &usb_post_test,
  210. NULL,
  211. NULL,
  212. CONFIG_SYS_POST_USB
  213. },
  214. #endif
  215. #if CONFIG_POST & CONFIG_SYS_POST_SPR
  216. {
  217. "SPR test",
  218. "spr",
  219. "This test checks SPR contents.",
  220. POST_RAM | POST_ALWAYS,
  221. &spr_post_test,
  222. NULL,
  223. NULL,
  224. CONFIG_SYS_POST_SPR
  225. },
  226. #endif
  227. #if CONFIG_POST & CONFIG_SYS_POST_SYSMON
  228. {
  229. "SYSMON test",
  230. "sysmon",
  231. "This test monitors system hardware.",
  232. POST_RAM | POST_ALWAYS,
  233. &sysmon_post_test,
  234. &sysmon_init_f,
  235. &sysmon_reloc,
  236. CONFIG_SYS_POST_SYSMON
  237. },
  238. #endif
  239. #if CONFIG_POST & CONFIG_SYS_POST_DSP
  240. {
  241. "DSP test",
  242. "dsp",
  243. "This test checks any connected DSP(s).",
  244. POST_RAM | POST_ALWAYS | POST_MANUAL,
  245. &dsp_post_test,
  246. NULL,
  247. NULL,
  248. CONFIG_SYS_POST_DSP
  249. },
  250. #endif
  251. #if CONFIG_POST & CONFIG_SYS_POST_CODEC
  252. {
  253. "CODEC test",
  254. "codec",
  255. "This test checks any connected codec(s).",
  256. POST_RAM | POST_MANUAL,
  257. &codec_post_test,
  258. NULL,
  259. NULL,
  260. CONFIG_SYS_POST_CODEC
  261. },
  262. #endif
  263. #if CONFIG_POST & CONFIG_SYS_POST_ECC
  264. {
  265. "ECC test",
  266. "ecc",
  267. "This test checks the ECC facility of memory.",
  268. POST_ROM | POST_ALWAYS | POST_PREREL,
  269. &ecc_post_test,
  270. NULL,
  271. NULL,
  272. CONFIG_SYS_POST_ECC
  273. },
  274. #endif
  275. #if CONFIG_POST & CONFIG_SYS_POST_BSPEC1
  276. CONFIG_POST_BSPEC1,
  277. #endif
  278. #if CONFIG_POST & CONFIG_SYS_POST_BSPEC2
  279. CONFIG_POST_BSPEC2,
  280. #endif
  281. #if CONFIG_POST & CONFIG_SYS_POST_BSPEC3
  282. CONFIG_POST_BSPEC3,
  283. #endif
  284. #if CONFIG_POST & CONFIG_SYS_POST_BSPEC4
  285. CONFIG_POST_BSPEC4,
  286. #endif
  287. #if CONFIG_POST & CONFIG_SYS_POST_BSPEC5
  288. CONFIG_POST_BSPEC5,
  289. #endif
  290. #if CONFIG_POST & CONFIG_SYS_POST_COPROC
  291. {
  292. "Coprocessors communication test",
  293. "coproc_com",
  294. "This test checks communication with coprocessors.",
  295. POST_RAM | POST_ALWAYS | POST_CRITICAL,
  296. &coprocessor_post_test,
  297. NULL,
  298. NULL,
  299. CONFIG_SYS_POST_COPROC
  300. },
  301. #endif
  302. #if CONFIG_POST & CONFIG_SYS_POST_FLASH
  303. {
  304. "Parallel NOR flash test",
  305. "flash",
  306. "This test verifies parallel flash operations.",
  307. POST_RAM | POST_SLOWTEST | POST_MANUAL,
  308. &flash_post_test,
  309. NULL,
  310. NULL,
  311. CONFIG_SYS_POST_FLASH
  312. },
  313. #endif
  314. #if CONFIG_POST & CONFIG_SYS_POST_MEM_REGIONS
  315. {
  316. "Memory regions test",
  317. "mem_regions",
  318. "This test checks regularly placed regions of the RAM.",
  319. POST_ROM | POST_SLOWTEST | POST_PREREL,
  320. &memory_regions_post_test,
  321. NULL,
  322. NULL,
  323. CONFIG_SYS_POST_MEM_REGIONS
  324. },
  325. #endif
  326. };
  327. unsigned int post_list_size = ARRAY_SIZE(post_list);