3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6 * Michael Zaidman, Kodak, michael.zaidman@kodak.com
7 * post_word_{load|store} cleanup.
9 * SPDX-License-Identifier: GPL-2.0+
18 #if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
20 #ifndef CONFIG_POST_EXTERNAL_WORD_FUNCS
21 #ifdef CONFIG_SYS_POST_WORD_ADDR
22 #define _POST_WORD_ADDR CONFIG_SYS_POST_WORD_ADDR
26 #define _POST_WORD_ADDR (MPC5XXX_SRAM + MPC5XXX_SRAM_POST_SIZE)
28 #elif defined(CONFIG_MPC512X)
29 #define _POST_WORD_ADDR \
30 (CONFIG_SYS_SRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET - 0x4)
32 #elif defined(CONFIG_8xx)
33 #define _POST_WORD_ADDR \
34 (((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_dpmem + CPM_POST_WORD_ADDR)
36 #elif defined(CONFIG_MPC8260)
37 #include <asm/cpm_8260.h>
38 #define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CPM_POST_WORD_ADDR)
40 #elif defined(CONFIG_MPC8360)
41 #include <linux/immap_qe.h>
42 #define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CPM_POST_WORD_ADDR)
44 #elif defined (CONFIG_MPC85xx)
45 #include <asm/immap_85xx.h>
46 #define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_PIC_OFFSET + \
47 offsetof(ccsr_pic_t, tfrr))
49 #elif defined (CONFIG_MPC86xx)
50 #include <asm/immap_86xx.h>
51 #define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CONFIG_SYS_MPC86xx_PIC_OFFSET + \
52 offsetof(ccsr_pic_t, tfrr))
54 #elif defined (CONFIG_4xx)
55 #define _POST_WORD_ADDR \
56 (CONFIG_SYS_OCM_DATA_ADDR + CONFIG_SYS_GBL_DATA_OFFSET - 0x4)
59 #ifndef _POST_WORD_ADDR
60 #error "_POST_WORD_ADDR currently not implemented for this platform!"
62 #endif /* CONFIG_SYS_POST_WORD_ADDR */
64 static inline ulong post_word_load (void)
66 return in_le32((volatile void *)(_POST_WORD_ADDR));
69 static inline void post_word_store (ulong value)
71 out_le32((volatile void *)(_POST_WORD_ADDR), value);
76 extern ulong post_word_load(void);
77 extern void post_word_store(ulong value);
79 #endif /* CONFIG_POST_EXTERNAL_WORD_FUNCS */
80 #endif /* defined (CONFIG_POST) || defined(CONFIG_LOGBUFFER) */
81 #endif /* __ASSEMBLY__ */
85 #define POST_POWERON 0x01 /* test runs on power-on booting */
86 #define POST_NORMAL 0x02 /* test runs on normal booting */
87 #define POST_SLOWTEST 0x04 /* test is slow, enabled by key press */
88 #define POST_POWERTEST 0x08 /* test runs after watchdog reset */
90 #define POST_COLDBOOT 0x80 /* first boot after power-on */
92 #define POST_ROM 0x0100 /* test runs in ROM */
93 #define POST_RAM 0x0200 /* test runs in RAM */
94 #define POST_MANUAL 0x0400 /* test runs on diag command */
95 #define POST_REBOOT 0x0800 /* test may cause rebooting */
96 #define POST_PREREL 0x1000 /* test runs before relocation */
98 #define POST_CRITICAL 0x2000 /* Use failbootcmd if test failed */
99 #define POST_STOP 0x4000 /* Interrupt POST sequence on fail */
101 #define POST_MEM (POST_RAM | POST_ROM)
102 #define POST_ALWAYS (POST_NORMAL | \
107 #define POST_FAIL_SAVE 0x80
109 #define POST_BEFORE 1
111 #define POST_PASSED 1
112 #define POST_FAILED 0
121 int (*test) (int flags);
122 int (*init_f) (void);
123 void (*reloc) (void);
124 unsigned long testid;
126 int post_init_f (void);
127 void post_bootmode_init (void);
128 int post_bootmode_get (unsigned int * last_test);
129 void post_bootmode_clear (void);
130 void post_output_backlog ( void );
131 int post_run (char *name, int flags);
132 int post_info (char *name);
133 int post_log (char *format, ...);
134 #ifdef CONFIG_NEEDS_MANUAL_RELOC
135 void post_reloc (void);
137 unsigned long post_time_ms (unsigned long base);
139 extern struct post_test post_list[];
140 extern unsigned int post_list_size;
141 extern int post_hotkeys_pressed(void);
142 extern int memory_post_test(int flags);
145 * If GCC is configured to use a version of GAS that supports
146 * the .gnu_attribute directive, it will use that directive to
147 * record certain properties of the output code.
148 * This feature is new to GCC 4.3.0.
149 * .gnu_attribute is new to GAS 2.18.
151 #if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
152 /* Tag_GNU_Power_ABI_FP/soft-float */
153 #define GNU_FPOST_ATTR asm(".gnu_attribute 4, 2");
155 #define GNU_FPOST_ATTR
156 #endif /* __GNUC__ */
157 #endif /* __ASSEMBLY__ */
159 #define CONFIG_SYS_POST_RTC 0x00000001
160 #define CONFIG_SYS_POST_WATCHDOG 0x00000002
161 #define CONFIG_SYS_POST_MEMORY 0x00000004
162 #define CONFIG_SYS_POST_CPU 0x00000008
163 #define CONFIG_SYS_POST_I2C 0x00000010
164 #define CONFIG_SYS_POST_CACHE 0x00000020
165 #define CONFIG_SYS_POST_UART 0x00000040
166 #define CONFIG_SYS_POST_ETHER 0x00000080
167 #define CONFIG_SYS_POST_SPI 0x00000100
168 #define CONFIG_SYS_POST_USB 0x00000200
169 #define CONFIG_SYS_POST_SPR 0x00000400
170 #define CONFIG_SYS_POST_SYSMON 0x00000800
171 #define CONFIG_SYS_POST_DSP 0x00001000
172 #define CONFIG_SYS_POST_OCM 0x00002000
173 #define CONFIG_SYS_POST_FPU 0x00004000
174 #define CONFIG_SYS_POST_ECC 0x00008000
175 #define CONFIG_SYS_POST_BSPEC1 0x00010000
176 #define CONFIG_SYS_POST_BSPEC2 0x00020000
177 #define CONFIG_SYS_POST_BSPEC3 0x00040000
178 #define CONFIG_SYS_POST_BSPEC4 0x00080000
179 #define CONFIG_SYS_POST_BSPEC5 0x00100000
180 #define CONFIG_SYS_POST_CODEC 0x00200000
181 #define CONFIG_SYS_POST_COPROC 0x00400000
182 #define CONFIG_SYS_POST_FLASH 0x00800000
183 #define CONFIG_SYS_POST_MEM_REGIONS 0x01000000
185 #endif /* CONFIG_POST */