]>
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__ | |
800eb096 MZ |
14 | #include <asm/io.h> |
15 | ||
c5404b64 | 16 | #if defined(CONFIG_POST) |
800eb096 | 17 | |
9cebc4ad | 18 | #ifndef CFG_POST_EXTERNAL_WORD_FUNCS |
1e019503 TR |
19 | #ifdef CFG_SYS_POST_WORD_ADDR |
20 | #define _POST_WORD_ADDR CFG_SYS_POST_WORD_ADDR | |
800eb096 MZ |
21 | #else |
22 | ||
61abced7 | 23 | #if defined(CONFIG_ARCH_MPC8360) |
38d67a4e | 24 | #include <linux/immap_qe.h> |
800eb096 MZ |
25 | #define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CPM_POST_WORD_ADDR) |
26 | ||
27 | #elif defined (CONFIG_MPC85xx) | |
8790ac03 | 28 | #include <asm/immap_85xx.h> |
5155207a | 29 | #define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CFG_SYS_MPC85xx_PIC_OFFSET + \ |
9de0aa74 | 30 | offsetof(ccsr_pic_t, tfrr)) |
7133d4c4 WD |
31 | #endif |
32 | ||
800eb096 MZ |
33 | #ifndef _POST_WORD_ADDR |
34 | #error "_POST_WORD_ADDR currently not implemented for this platform!" | |
35 | #endif | |
1e019503 | 36 | #endif /* CFG_SYS_POST_WORD_ADDR */ |
800eb096 MZ |
37 | |
38 | static inline ulong post_word_load (void) | |
39 | { | |
40 | return in_le32((volatile void *)(_POST_WORD_ADDR)); | |
41 | } | |
42 | ||
43 | static inline void post_word_store (ulong value) | |
44 | { | |
45 | out_le32((volatile void *)(_POST_WORD_ADDR), value); | |
46 | } | |
3e161ced VL |
47 | |
48 | #else | |
49 | ||
50 | extern ulong post_word_load(void); | |
51 | extern void post_word_store(ulong value); | |
52 | ||
9cebc4ad | 53 | #endif /* CFG_POST_EXTERNAL_WORD_FUNCS */ |
c5404b64 | 54 | #endif /* defined (CONFIG_POST) */ |
800eb096 MZ |
55 | #endif /* __ASSEMBLY__ */ |
56 | ||
7133d4c4 WD |
57 | #ifdef CONFIG_POST |
58 | ||
59 | #define POST_POWERON 0x01 /* test runs on power-on booting */ | |
8564acf9 WD |
60 | #define POST_NORMAL 0x02 /* test runs on normal booting */ |
61 | #define POST_SLOWTEST 0x04 /* test is slow, enabled by key press */ | |
7133d4c4 WD |
62 | #define POST_POWERTEST 0x08 /* test runs after watchdog reset */ |
63 | ||
27b207fd WD |
64 | #define POST_COLDBOOT 0x80 /* first boot after power-on */ |
65 | ||
7133d4c4 WD |
66 | #define POST_ROM 0x0100 /* test runs in ROM */ |
67 | #define POST_RAM 0x0200 /* test runs in RAM */ | |
68 | #define POST_MANUAL 0x0400 /* test runs on diag command */ | |
69 | #define POST_REBOOT 0x0800 /* test may cause rebooting */ | |
800eb096 | 70 | #define POST_PREREL 0x1000 /* test runs before relocation */ |
7133d4c4 | 71 | |
b428f6a8 | 72 | #define POST_CRITICAL 0x2000 /* Use failbootcmd if test failed */ |
28a38506 | 73 | #define POST_STOP 0x4000 /* Interrupt POST sequence on fail */ |
b428f6a8 | 74 | |
7133d4c4 | 75 | #define POST_MEM (POST_RAM | POST_ROM) |
8564acf9 WD |
76 | #define POST_ALWAYS (POST_NORMAL | \ |
77 | POST_SLOWTEST | \ | |
78 | POST_MANUAL | \ | |
7133d4c4 WD |
79 | POST_POWERON ) |
80 | ||
b428f6a8 YT |
81 | #define POST_FAIL_SAVE 0x80 |
82 | ||
e070a56c MZ |
83 | #define POST_BEFORE 1 |
84 | #define POST_AFTER 0 | |
85 | #define POST_PASSED 1 | |
86 | #define POST_FAILED 0 | |
87 | ||
7133d4c4 WD |
88 | #ifndef __ASSEMBLY__ |
89 | ||
90 | struct post_test { | |
91 | char *name; | |
92 | char *cmd; | |
93 | char *desc; | |
94 | int flags; | |
95 | int (*test) (int flags); | |
4532cb69 WD |
96 | int (*init_f) (void); |
97 | void (*reloc) (void); | |
228f29ac | 98 | unsigned long testid; |
7133d4c4 | 99 | }; |
4532cb69 | 100 | int post_init_f (void); |
7133d4c4 WD |
101 | void post_bootmode_init (void); |
102 | int post_bootmode_get (unsigned int * last_test); | |
103 | void post_bootmode_clear (void); | |
104 | int post_run (char *name, int flags); | |
105 | int post_info (char *name); | |
106 | int post_log (char *format, ...); | |
4532cb69 | 107 | unsigned long post_time_ms (unsigned long base); |
7133d4c4 | 108 | |
7addd3c6 OP |
109 | /** |
110 | * post_output_backlog() - Print POST results | |
111 | * | |
112 | * Print POST results during the generic board init sequence, after | |
113 | * relocation. | |
114 | * | |
115 | * Return: 0 if OK | |
116 | */ | |
117 | int post_output_backlog(void); | |
118 | ||
7133d4c4 WD |
119 | extern struct post_test post_list[]; |
120 | extern unsigned int post_list_size; | |
27b207fd | 121 | extern int post_hotkeys_pressed(void); |
eaf5e65a | 122 | extern int memory_post_test(int flags); |
7133d4c4 | 123 | |
ce82ff05 YT |
124 | /* |
125 | * If GCC is configured to use a version of GAS that supports | |
126 | * the .gnu_attribute directive, it will use that directive to | |
127 | * record certain properties of the output code. | |
128 | * This feature is new to GCC 4.3.0. | |
129 | * .gnu_attribute is new to GAS 2.18. | |
130 | */ | |
131 | #if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 3) | |
132 | /* Tag_GNU_Power_ABI_FP/soft-float */ | |
133 | #define GNU_FPOST_ATTR asm(".gnu_attribute 4, 2"); | |
134 | #else | |
135 | #define GNU_FPOST_ATTR | |
136 | #endif /* __GNUC__ */ | |
7133d4c4 WD |
137 | #endif /* __ASSEMBLY__ */ |
138 | ||
1e019503 TR |
139 | #define CFG_SYS_POST_RTC 0x00000001 |
140 | #define CFG_SYS_POST_WATCHDOG 0x00000002 | |
65cc0e2a | 141 | #define CFG_SYS_POST_MEMORY 0x00000004 |
1e019503 TR |
142 | #define CFG_SYS_POST_CPU 0x00000008 |
143 | #define CFG_SYS_POST_I2C 0x00000010 | |
144 | #define CFG_SYS_POST_CACHE 0x00000020 | |
145 | #define CFG_SYS_POST_UART 0x00000040 | |
146 | #define CFG_SYS_POST_ETHER 0x00000080 | |
147 | #define CFG_SYS_POST_USB 0x00000200 | |
148 | #define CFG_SYS_POST_SPR 0x00000400 | |
149 | #define CFG_SYS_POST_SYSMON 0x00000800 | |
150 | #define CFG_SYS_POST_DSP 0x00001000 | |
151 | #define CFG_SYS_POST_OCM 0x00002000 | |
152 | #define CFG_SYS_POST_FPU 0x00004000 | |
153 | #define CFG_SYS_POST_ECC 0x00008000 | |
154 | #define CFG_SYS_POST_BSPEC1 0x00010000 | |
155 | #define CFG_SYS_POST_BSPEC2 0x00020000 | |
156 | #define CFG_SYS_POST_BSPEC3 0x00040000 | |
157 | #define CFG_SYS_POST_BSPEC4 0x00080000 | |
158 | #define CFG_SYS_POST_BSPEC5 0x00100000 | |
159 | #define CFG_SYS_POST_CODEC 0x00200000 | |
160 | #define CFG_SYS_POST_COPROC 0x00400000 | |
161 | #define CFG_SYS_POST_FLASH 0x00800000 | |
65cc0e2a | 162 | #define CFG_SYS_POST_MEM_REGIONS 0x01000000 |
7133d4c4 WD |
163 | |
164 | #endif /* CONFIG_POST */ | |
165 | ||
166 | #endif /* _POST_H */ |