tests.c 5.1 KB

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