tests.c 6.5 KB

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