tests.c 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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. * CFG_POST_PREREL flag so that logging is done correctly if the
  25. * logbuffer support is enabled.
  26. */
  27. #include <common.h>
  28. #ifdef CONFIG_POST
  29. #include <post.h>
  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 dspic_init_post_test (int flags);
  47. extern int dspic_post_test (int flags);
  48. extern int gdc_post_test (int flags);
  49. extern int fpga_post_test (int flags);
  50. extern int lwmon5_watchdog_post_test(int flags);
  51. extern int sysmon1_post_test(int flags);
  52. extern int sysmon_init_f (void);
  53. extern void sysmon_reloc (void);
  54. struct post_test post_list[] =
  55. {
  56. #if CONFIG_POST & CFG_POST_CACHE
  57. {
  58. "Cache test",
  59. "cache",
  60. "This test verifies the CPU cache operation.",
  61. POST_RAM | POST_ALWAYS,
  62. &cache_post_test,
  63. NULL,
  64. NULL,
  65. CFG_POST_CACHE
  66. },
  67. #endif
  68. #if CONFIG_POST & CFG_POST_WATCHDOG
  69. #if defined(CONFIG_POST_WATCHDOG)
  70. CONFIG_POST_WATCHDOG,
  71. #else
  72. {
  73. "Watchdog timer test",
  74. "watchdog",
  75. "This test checks the watchdog timer.",
  76. POST_RAM | POST_POWERON | POST_SLOWTEST | POST_MANUAL | POST_REBOOT,
  77. &watchdog_post_test,
  78. NULL,
  79. NULL,
  80. CFG_POST_WATCHDOG
  81. },
  82. #endif
  83. #endif
  84. #if CONFIG_POST & CFG_POST_I2C
  85. {
  86. "I2C test",
  87. "i2c",
  88. "This test verifies the I2C operation.",
  89. POST_RAM | POST_ALWAYS,
  90. &i2c_post_test,
  91. NULL,
  92. NULL,
  93. CFG_POST_I2C
  94. },
  95. #endif
  96. #if CONFIG_POST & CFG_POST_RTC
  97. {
  98. "RTC test",
  99. "rtc",
  100. "This test verifies the RTC operation.",
  101. POST_RAM | POST_SLOWTEST | POST_MANUAL,
  102. &rtc_post_test,
  103. NULL,
  104. NULL,
  105. CFG_POST_RTC
  106. },
  107. #endif
  108. #if CONFIG_POST & CFG_POST_MEMORY
  109. {
  110. "Memory test",
  111. "memory",
  112. "This test checks RAM.",
  113. POST_ROM | POST_POWERON | POST_SLOWTEST | POST_PREREL,
  114. &memory_post_test,
  115. NULL,
  116. NULL,
  117. CFG_POST_MEMORY
  118. },
  119. #endif
  120. #if CONFIG_POST & CFG_POST_CPU
  121. {
  122. "CPU test",
  123. "cpu",
  124. "This test verifies the arithmetic logic unit of"
  125. " CPU.",
  126. POST_RAM | POST_ALWAYS,
  127. &cpu_post_test,
  128. NULL,
  129. NULL,
  130. CFG_POST_CPU
  131. },
  132. #endif
  133. #if CONFIG_POST & CFG_POST_FPU
  134. {
  135. "FPU test",
  136. "fpu",
  137. "This test verifies the arithmetic logic unit of"
  138. " FPU.",
  139. POST_RAM | POST_ALWAYS,
  140. &fpu_post_test,
  141. NULL,
  142. NULL,
  143. CFG_POST_FPU
  144. },
  145. #endif
  146. #if CONFIG_POST & CFG_POST_UART
  147. {
  148. "UART test",
  149. "uart",
  150. "This test verifies the UART operation.",
  151. POST_RAM | POST_SLOWTEST | POST_MANUAL,
  152. &uart_post_test,
  153. NULL,
  154. NULL,
  155. CFG_POST_UART
  156. },
  157. #endif
  158. #if CONFIG_POST & CFG_POST_ETHER
  159. {
  160. "ETHERNET test",
  161. "ethernet",
  162. "This test verifies the ETHERNET operation.",
  163. POST_RAM | POST_ALWAYS | POST_MANUAL,
  164. &ether_post_test,
  165. NULL,
  166. NULL,
  167. CFG_POST_ETHER
  168. },
  169. #endif
  170. #if CONFIG_POST & CFG_POST_SPI
  171. {
  172. "SPI test",
  173. "spi",
  174. "This test verifies the SPI operation.",
  175. POST_RAM | POST_ALWAYS | POST_MANUAL,
  176. &spi_post_test,
  177. NULL,
  178. NULL,
  179. CFG_POST_SPI
  180. },
  181. #endif
  182. #if CONFIG_POST & CFG_POST_USB
  183. {
  184. "USB test",
  185. "usb",
  186. "This test verifies the USB operation.",
  187. POST_RAM | POST_ALWAYS | POST_MANUAL,
  188. &usb_post_test,
  189. NULL,
  190. NULL,
  191. CFG_POST_USB
  192. },
  193. #endif
  194. #if CONFIG_POST & CFG_POST_SPR
  195. {
  196. "SPR test",
  197. "spr",
  198. "This test checks SPR contents.",
  199. POST_RAM | POST_ALWAYS,
  200. &spr_post_test,
  201. NULL,
  202. NULL,
  203. CFG_POST_SPR
  204. },
  205. #endif
  206. #if CONFIG_POST & CFG_POST_SYSMON
  207. {
  208. "SYSMON test",
  209. "sysmon",
  210. "This test monitors system hardware.",
  211. POST_RAM | POST_ALWAYS,
  212. &sysmon_post_test,
  213. &sysmon_init_f,
  214. &sysmon_reloc,
  215. CFG_POST_SYSMON
  216. },
  217. #endif
  218. #if CONFIG_POST & CFG_POST_DSP
  219. {
  220. "DSP test",
  221. "dsp",
  222. "This test checks any connected DSP(s).",
  223. POST_RAM | POST_MANUAL,
  224. &dsp_post_test,
  225. NULL,
  226. NULL,
  227. CFG_POST_DSP
  228. },
  229. #endif
  230. #if CONFIG_POST & CFG_POST_CODEC
  231. {
  232. "CODEC test",
  233. "codec",
  234. "This test checks any connected codec(s).",
  235. POST_RAM | POST_MANUAL,
  236. &codec_post_test,
  237. NULL,
  238. NULL,
  239. CFG_POST_CODEC
  240. },
  241. #endif
  242. #if CONFIG_POST & CFG_POST_ECC
  243. {
  244. "ECC test",
  245. "ecc",
  246. "This test checks the ECC facility of memory.",
  247. POST_ROM | POST_ALWAYS | POST_PREREL,
  248. &ecc_post_test,
  249. NULL,
  250. NULL,
  251. CFG_POST_ECC
  252. },
  253. #endif
  254. #if CONFIG_POST & CFG_POST_BSPEC1
  255. CONFIG_POST_BSPEC1,
  256. #endif
  257. #if CONFIG_POST & CFG_POST_BSPEC2
  258. CONFIG_POST_BSPEC2,
  259. #endif
  260. #if CONFIG_POST & CFG_POST_BSPEC3
  261. CONFIG_POST_BSPEC3,
  262. #endif
  263. #if CONFIG_POST & CFG_POST_BSPEC4
  264. CONFIG_POST_BSPEC4,
  265. #endif
  266. #if CONFIG_POST & CFG_POST_BSPEC4
  267. CONFIG_POST_BSPEC5,
  268. #endif
  269. };
  270. unsigned int post_list_size = sizeof (post_list) / sizeof (struct post_test);
  271. #endif /* CONFIG_POST */