post.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /*
  2. * (C) Copyright 2002
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * (C) Copyright 2010
  6. * Michael Zaidman, Kodak, michael.zaidman@kodak.com
  7. * post_word_{load|store} cleanup.
  8. *
  9. * SPDX-License-Identifier: GPL-2.0+
  10. */
  11. #ifndef _POST_H
  12. #define _POST_H
  13. #ifndef __ASSEMBLY__
  14. #include <common.h>
  15. #include <asm/io.h>
  16. #if defined(CONFIG_POST)
  17. #ifndef CONFIG_POST_EXTERNAL_WORD_FUNCS
  18. #ifdef CONFIG_SYS_POST_WORD_ADDR
  19. #define _POST_WORD_ADDR CONFIG_SYS_POST_WORD_ADDR
  20. #else
  21. #if defined(CONFIG_MPC8360)
  22. #include <linux/immap_qe.h>
  23. #define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CPM_POST_WORD_ADDR)
  24. #elif defined (CONFIG_MPC85xx)
  25. #include <asm/immap_85xx.h>
  26. #define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_PIC_OFFSET + \
  27. offsetof(ccsr_pic_t, tfrr))
  28. #elif defined (CONFIG_MPC86xx)
  29. #include <asm/immap_86xx.h>
  30. #define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CONFIG_SYS_MPC86xx_PIC_OFFSET + \
  31. offsetof(ccsr_pic_t, tfrr))
  32. #endif
  33. #ifndef _POST_WORD_ADDR
  34. #error "_POST_WORD_ADDR currently not implemented for this platform!"
  35. #endif
  36. #endif /* CONFIG_SYS_POST_WORD_ADDR */
  37. static inline ulong post_word_load (void)
  38. {
  39. return in_le32((volatile void *)(_POST_WORD_ADDR));
  40. }
  41. static inline void post_word_store (ulong value)
  42. {
  43. out_le32((volatile void *)(_POST_WORD_ADDR), value);
  44. }
  45. #else
  46. extern ulong post_word_load(void);
  47. extern void post_word_store(ulong value);
  48. #endif /* CONFIG_POST_EXTERNAL_WORD_FUNCS */
  49. #endif /* defined (CONFIG_POST) */
  50. #endif /* __ASSEMBLY__ */
  51. #ifdef CONFIG_POST
  52. #define POST_POWERON 0x01 /* test runs on power-on booting */
  53. #define POST_NORMAL 0x02 /* test runs on normal booting */
  54. #define POST_SLOWTEST 0x04 /* test is slow, enabled by key press */
  55. #define POST_POWERTEST 0x08 /* test runs after watchdog reset */
  56. #define POST_COLDBOOT 0x80 /* first boot after power-on */
  57. #define POST_ROM 0x0100 /* test runs in ROM */
  58. #define POST_RAM 0x0200 /* test runs in RAM */
  59. #define POST_MANUAL 0x0400 /* test runs on diag command */
  60. #define POST_REBOOT 0x0800 /* test may cause rebooting */
  61. #define POST_PREREL 0x1000 /* test runs before relocation */
  62. #define POST_CRITICAL 0x2000 /* Use failbootcmd if test failed */
  63. #define POST_STOP 0x4000 /* Interrupt POST sequence on fail */
  64. #define POST_MEM (POST_RAM | POST_ROM)
  65. #define POST_ALWAYS (POST_NORMAL | \
  66. POST_SLOWTEST | \
  67. POST_MANUAL | \
  68. POST_POWERON )
  69. #define POST_FAIL_SAVE 0x80
  70. #define POST_BEFORE 1
  71. #define POST_AFTER 0
  72. #define POST_PASSED 1
  73. #define POST_FAILED 0
  74. #ifndef __ASSEMBLY__
  75. struct post_test {
  76. char *name;
  77. char *cmd;
  78. char *desc;
  79. int flags;
  80. int (*test) (int flags);
  81. int (*init_f) (void);
  82. void (*reloc) (void);
  83. unsigned long testid;
  84. };
  85. int post_init_f (void);
  86. void post_bootmode_init (void);
  87. int post_bootmode_get (unsigned int * last_test);
  88. void post_bootmode_clear (void);
  89. void post_output_backlog ( void );
  90. int post_run (char *name, int flags);
  91. int post_info (char *name);
  92. int post_log (char *format, ...);
  93. #ifdef CONFIG_NEEDS_MANUAL_RELOC
  94. void post_reloc (void);
  95. #endif
  96. unsigned long post_time_ms (unsigned long base);
  97. extern struct post_test post_list[];
  98. extern unsigned int post_list_size;
  99. extern int post_hotkeys_pressed(void);
  100. extern int memory_post_test(int flags);
  101. /*
  102. * If GCC is configured to use a version of GAS that supports
  103. * the .gnu_attribute directive, it will use that directive to
  104. * record certain properties of the output code.
  105. * This feature is new to GCC 4.3.0.
  106. * .gnu_attribute is new to GAS 2.18.
  107. */
  108. #if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
  109. /* Tag_GNU_Power_ABI_FP/soft-float */
  110. #define GNU_FPOST_ATTR asm(".gnu_attribute 4, 2");
  111. #else
  112. #define GNU_FPOST_ATTR
  113. #endif /* __GNUC__ */
  114. #endif /* __ASSEMBLY__ */
  115. #define CONFIG_SYS_POST_RTC 0x00000001
  116. #define CONFIG_SYS_POST_WATCHDOG 0x00000002
  117. #define CONFIG_SYS_POST_MEMORY 0x00000004
  118. #define CONFIG_SYS_POST_CPU 0x00000008
  119. #define CONFIG_SYS_POST_I2C 0x00000010
  120. #define CONFIG_SYS_POST_CACHE 0x00000020
  121. #define CONFIG_SYS_POST_UART 0x00000040
  122. #define CONFIG_SYS_POST_ETHER 0x00000080
  123. #define CONFIG_SYS_POST_USB 0x00000200
  124. #define CONFIG_SYS_POST_SPR 0x00000400
  125. #define CONFIG_SYS_POST_SYSMON 0x00000800
  126. #define CONFIG_SYS_POST_DSP 0x00001000
  127. #define CONFIG_SYS_POST_OCM 0x00002000
  128. #define CONFIG_SYS_POST_FPU 0x00004000
  129. #define CONFIG_SYS_POST_ECC 0x00008000
  130. #define CONFIG_SYS_POST_BSPEC1 0x00010000
  131. #define CONFIG_SYS_POST_BSPEC2 0x00020000
  132. #define CONFIG_SYS_POST_BSPEC3 0x00040000
  133. #define CONFIG_SYS_POST_BSPEC4 0x00080000
  134. #define CONFIG_SYS_POST_BSPEC5 0x00100000
  135. #define CONFIG_SYS_POST_CODEC 0x00200000
  136. #define CONFIG_SYS_POST_COPROC 0x00400000
  137. #define CONFIG_SYS_POST_FLASH 0x00800000
  138. #define CONFIG_SYS_POST_MEM_REGIONS 0x01000000
  139. #endif /* CONFIG_POST */
  140. #endif /* _POST_H */