post.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. * See file CREDITS for list of people who contributed to this
  10. * project.
  11. *
  12. * This program is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU General Public License as
  14. * published by the Free Software Foundation; either version 2 of
  15. * the License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  25. * MA 02111-1307 USA
  26. */
  27. #ifndef _POST_H
  28. #define _POST_H
  29. #ifndef __ASSEMBLY__
  30. #include <common.h>
  31. #include <asm/io.h>
  32. #if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
  33. #ifndef CONFIG_POST_EXTERNAL_WORD_FUNCS
  34. #ifdef CONFIG_SYS_POST_WORD_ADDR
  35. #define _POST_WORD_ADDR CONFIG_SYS_POST_WORD_ADDR
  36. #else
  37. #ifdef CONFIG_MPC5xxx
  38. #define _POST_WORD_ADDR (MPC5XXX_SRAM + MPC5XXX_SRAM_POST_SIZE)
  39. #elif defined(CONFIG_MPC512X)
  40. #define _POST_WORD_ADDR \
  41. (CONFIG_SYS_SRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET - 0x4)
  42. #elif defined(CONFIG_8xx)
  43. #define _POST_WORD_ADDR \
  44. (((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_dpmem + CPM_POST_WORD_ADDR)
  45. #elif defined(CONFIG_MPC8260)
  46. #include <asm/cpm_8260.h>
  47. #define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CPM_POST_WORD_ADDR)
  48. #elif defined(CONFIG_MPC8360)
  49. #include <asm/immap_qe.h>
  50. #define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CPM_POST_WORD_ADDR)
  51. #elif defined (CONFIG_MPC85xx)
  52. #include <asm/immap_85xx.h>
  53. #define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_PIC_OFFSET + \
  54. offsetof(ccsr_pic_t, tfrr))
  55. #elif defined (CONFIG_MPC86xx)
  56. #include <asm/immap_86xx.h>
  57. #define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CONFIG_SYS_MPC86xx_PIC_OFFSET + \
  58. offsetof(ccsr_pic_t, tfrr))
  59. #elif defined (CONFIG_4xx)
  60. #define _POST_WORD_ADDR \
  61. (CONFIG_SYS_OCM_DATA_ADDR + CONFIG_SYS_GBL_DATA_OFFSET - 0x4)
  62. #endif
  63. #ifndef _POST_WORD_ADDR
  64. #error "_POST_WORD_ADDR currently not implemented for this platform!"
  65. #endif
  66. #endif /* CONFIG_SYS_POST_WORD_ADDR */
  67. static inline ulong post_word_load (void)
  68. {
  69. return in_le32((volatile void *)(_POST_WORD_ADDR));
  70. }
  71. static inline void post_word_store (ulong value)
  72. {
  73. out_le32((volatile void *)(_POST_WORD_ADDR), value);
  74. }
  75. #else
  76. extern ulong post_word_load(void);
  77. extern void post_word_store(ulong value);
  78. #endif /* CONFIG_POST_EXTERNAL_WORD_FUNCS */
  79. #endif /* defined (CONFIG_POST) || defined(CONFIG_LOGBUFFER) */
  80. #endif /* __ASSEMBLY__ */
  81. #ifdef CONFIG_POST
  82. #define POST_POWERON 0x01 /* test runs on power-on booting */
  83. #define POST_NORMAL 0x02 /* test runs on normal booting */
  84. #define POST_SLOWTEST 0x04 /* test is slow, enabled by key press */
  85. #define POST_POWERTEST 0x08 /* test runs after watchdog reset */
  86. #define POST_COLDBOOT 0x80 /* first boot after power-on */
  87. #define POST_ROM 0x0100 /* test runs in ROM */
  88. #define POST_RAM 0x0200 /* test runs in RAM */
  89. #define POST_MANUAL 0x0400 /* test runs on diag command */
  90. #define POST_REBOOT 0x0800 /* test may cause rebooting */
  91. #define POST_PREREL 0x1000 /* test runs before relocation */
  92. #define POST_CRITICAL 0x2000 /* Use failbootcmd if test failed */
  93. #define POST_STOP 0x4000 /* Interrupt POST sequence on fail */
  94. #define POST_MEM (POST_RAM | POST_ROM)
  95. #define POST_ALWAYS (POST_NORMAL | \
  96. POST_SLOWTEST | \
  97. POST_MANUAL | \
  98. POST_POWERON )
  99. #define POST_FAIL_SAVE 0x80
  100. #define POST_BEFORE 1
  101. #define POST_AFTER 0
  102. #define POST_PASSED 1
  103. #define POST_FAILED 0
  104. #ifndef __ASSEMBLY__
  105. struct post_test {
  106. char *name;
  107. char *cmd;
  108. char *desc;
  109. int flags;
  110. int (*test) (int flags);
  111. int (*init_f) (void);
  112. void (*reloc) (void);
  113. unsigned long testid;
  114. };
  115. int post_init_f (void);
  116. void post_bootmode_init (void);
  117. int post_bootmode_get (unsigned int * last_test);
  118. void post_bootmode_clear (void);
  119. void post_output_backlog ( void );
  120. int post_run (char *name, int flags);
  121. int post_info (char *name);
  122. int post_log (char *format, ...);
  123. #ifdef CONFIG_NEEDS_MANUAL_RELOC
  124. void post_reloc (void);
  125. #endif
  126. unsigned long post_time_ms (unsigned long base);
  127. extern struct post_test post_list[];
  128. extern unsigned int post_list_size;
  129. extern int post_hotkeys_pressed(void);
  130. extern int memory_post_test(int flags);
  131. /*
  132. * If GCC is configured to use a version of GAS that supports
  133. * the .gnu_attribute directive, it will use that directive to
  134. * record certain properties of the output code.
  135. * This feature is new to GCC 4.3.0.
  136. * .gnu_attribute is new to GAS 2.18.
  137. */
  138. #if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
  139. /* Tag_GNU_Power_ABI_FP/soft-float */
  140. #define GNU_FPOST_ATTR asm(".gnu_attribute 4, 2");
  141. #else
  142. #define GNU_FPOST_ATTR
  143. #endif /* __GNUC__ */
  144. #endif /* __ASSEMBLY__ */
  145. #define CONFIG_SYS_POST_RTC 0x00000001
  146. #define CONFIG_SYS_POST_WATCHDOG 0x00000002
  147. #define CONFIG_SYS_POST_MEMORY 0x00000004
  148. #define CONFIG_SYS_POST_CPU 0x00000008
  149. #define CONFIG_SYS_POST_I2C 0x00000010
  150. #define CONFIG_SYS_POST_CACHE 0x00000020
  151. #define CONFIG_SYS_POST_UART 0x00000040
  152. #define CONFIG_SYS_POST_ETHER 0x00000080
  153. #define CONFIG_SYS_POST_SPI 0x00000100
  154. #define CONFIG_SYS_POST_USB 0x00000200
  155. #define CONFIG_SYS_POST_SPR 0x00000400
  156. #define CONFIG_SYS_POST_SYSMON 0x00000800
  157. #define CONFIG_SYS_POST_DSP 0x00001000
  158. #define CONFIG_SYS_POST_OCM 0x00002000
  159. #define CONFIG_SYS_POST_FPU 0x00004000
  160. #define CONFIG_SYS_POST_ECC 0x00008000
  161. #define CONFIG_SYS_POST_BSPEC1 0x00010000
  162. #define CONFIG_SYS_POST_BSPEC2 0x00020000
  163. #define CONFIG_SYS_POST_BSPEC3 0x00040000
  164. #define CONFIG_SYS_POST_BSPEC4 0x00080000
  165. #define CONFIG_SYS_POST_BSPEC5 0x00100000
  166. #define CONFIG_SYS_POST_CODEC 0x00200000
  167. #define CONFIG_SYS_POST_COPROC 0x00400000
  168. #define CONFIG_SYS_POST_FLASH 0x00800000
  169. #define CONFIG_SYS_POST_MEM_REGIONS 0x01000000
  170. #endif /* CONFIG_POST */
  171. #endif /* _POST_H */