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