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