post.h 4.7 KB

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