blob: 8bee125f91d4e37d0a190b0cbe33b8a5d8366c0f [file] [log] [blame]
wdenk7133d4c2002-09-12 22:42:52 +00001/*
2 * (C) Copyright 2002
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
Michael Zaidman800eb092010-09-20 08:51:53 +02005 * (C) Copyright 2010
6 * Michael Zaidman, Kodak, michael.zaidman@kodak.com
7 * post_word_{load|store} cleanup.
8 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02009 * SPDX-License-Identifier: GPL-2.0+
wdenk7133d4c2002-09-12 22:42:52 +000010 */
11#ifndef _POST_H
12#define _POST_H
13
14#ifndef __ASSEMBLY__
15#include <common.h>
Michael Zaidman800eb092010-09-20 08:51:53 +020016#include <asm/io.h>
17
18#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
19
Valentin Longchamp3e161ce2011-09-02 04:59:04 +000020#ifndef CONFIG_POST_EXTERNAL_WORD_FUNCS
Michael Zaidman800eb092010-09-20 08:51:53 +020021#ifdef CONFIG_SYS_POST_WORD_ADDR
22#define _POST_WORD_ADDR CONFIG_SYS_POST_WORD_ADDR
23#else
24
25#ifdef CONFIG_MPC5xxx
26#define _POST_WORD_ADDR (MPC5XXX_SRAM + MPC5XXX_SRAM_POST_SIZE)
27
28#elif defined(CONFIG_MPC512X)
29#define _POST_WORD_ADDR \
30 (CONFIG_SYS_SRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET - 0x4)
31
Michael Zaidman800eb092010-09-20 08:51:53 +020032#elif defined(CONFIG_MPC8360)
Zhao Qiang38d67a4e2014-06-03 16:27:07 +080033#include <linux/immap_qe.h>
Michael Zaidman800eb092010-09-20 08:51:53 +020034#define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CPM_POST_WORD_ADDR)
35
36#elif defined (CONFIG_MPC85xx)
York Sun8790ac02010-09-28 15:20:35 -070037#include <asm/immap_85xx.h>
Kumar Gala9de0aa72010-12-01 06:42:04 -060038#define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_PIC_OFFSET + \
39 offsetof(ccsr_pic_t, tfrr))
Michael Zaidman800eb092010-09-20 08:51:53 +020040
Peter Tyser65f23512010-10-22 00:20:32 -050041#elif defined (CONFIG_MPC86xx)
42#include <asm/immap_86xx.h>
Kumar Gala9de0aa72010-12-01 06:42:04 -060043#define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CONFIG_SYS_MPC86xx_PIC_OFFSET + \
44 offsetof(ccsr_pic_t, tfrr))
Peter Tyser65f23512010-10-22 00:20:32 -050045
Michael Zaidman800eb092010-09-20 08:51:53 +020046#elif defined (CONFIG_4xx)
47#define _POST_WORD_ADDR \
48 (CONFIG_SYS_OCM_DATA_ADDR + CONFIG_SYS_GBL_DATA_OFFSET - 0x4)
wdenk7133d4c2002-09-12 22:42:52 +000049#endif
50
Michael Zaidman800eb092010-09-20 08:51:53 +020051#ifndef _POST_WORD_ADDR
52#error "_POST_WORD_ADDR currently not implemented for this platform!"
53#endif
54#endif /* CONFIG_SYS_POST_WORD_ADDR */
55
56static inline ulong post_word_load (void)
57{
58 return in_le32((volatile void *)(_POST_WORD_ADDR));
59}
60
61static inline void post_word_store (ulong value)
62{
63 out_le32((volatile void *)(_POST_WORD_ADDR), value);
64}
Valentin Longchamp3e161ce2011-09-02 04:59:04 +000065
66#else
67
68extern ulong post_word_load(void);
69extern void post_word_store(ulong value);
70
71#endif /* CONFIG_POST_EXTERNAL_WORD_FUNCS */
Michael Zaidman800eb092010-09-20 08:51:53 +020072#endif /* defined (CONFIG_POST) || defined(CONFIG_LOGBUFFER) */
73#endif /* __ASSEMBLY__ */
74
wdenk7133d4c2002-09-12 22:42:52 +000075#ifdef CONFIG_POST
76
77#define POST_POWERON 0x01 /* test runs on power-on booting */
wdenk8564acf2003-07-14 22:13:32 +000078#define POST_NORMAL 0x02 /* test runs on normal booting */
79#define POST_SLOWTEST 0x04 /* test is slow, enabled by key press */
wdenk7133d4c2002-09-12 22:42:52 +000080#define POST_POWERTEST 0x08 /* test runs after watchdog reset */
81
wdenk27b207f2003-07-24 23:38:38 +000082#define POST_COLDBOOT 0x80 /* first boot after power-on */
83
wdenk7133d4c2002-09-12 22:42:52 +000084#define POST_ROM 0x0100 /* test runs in ROM */
85#define POST_RAM 0x0200 /* test runs in RAM */
86#define POST_MANUAL 0x0400 /* test runs on diag command */
87#define POST_REBOOT 0x0800 /* test may cause rebooting */
Michael Zaidman800eb092010-09-20 08:51:53 +020088#define POST_PREREL 0x1000 /* test runs before relocation */
wdenk7133d4c2002-09-12 22:42:52 +000089
Yuri Tikhonovb428f6a2008-02-04 14:11:03 +010090#define POST_CRITICAL 0x2000 /* Use failbootcmd if test failed */
Yuri Tikhonov28a38502008-05-08 15:45:26 +020091#define POST_STOP 0x4000 /* Interrupt POST sequence on fail */
Yuri Tikhonovb428f6a2008-02-04 14:11:03 +010092
wdenk7133d4c2002-09-12 22:42:52 +000093#define POST_MEM (POST_RAM | POST_ROM)
wdenk8564acf2003-07-14 22:13:32 +000094#define POST_ALWAYS (POST_NORMAL | \
95 POST_SLOWTEST | \
96 POST_MANUAL | \
wdenk7133d4c2002-09-12 22:42:52 +000097 POST_POWERON )
98
Yuri Tikhonovb428f6a2008-02-04 14:11:03 +010099#define POST_FAIL_SAVE 0x80
100
Michael Zaidmane070a562010-03-01 11:47:36 +0200101#define POST_BEFORE 1
102#define POST_AFTER 0
103#define POST_PASSED 1
104#define POST_FAILED 0
105
wdenk7133d4c2002-09-12 22:42:52 +0000106#ifndef __ASSEMBLY__
107
108struct post_test {
109 char *name;
110 char *cmd;
111 char *desc;
112 int flags;
113 int (*test) (int flags);
wdenk4532cb62003-04-27 22:52:51 +0000114 int (*init_f) (void);
115 void (*reloc) (void);
wdenk228f29a2002-12-08 09:53:23 +0000116 unsigned long testid;
wdenk7133d4c2002-09-12 22:42:52 +0000117};
wdenk4532cb62003-04-27 22:52:51 +0000118int post_init_f (void);
wdenk7133d4c2002-09-12 22:42:52 +0000119void post_bootmode_init (void);
120int post_bootmode_get (unsigned int * last_test);
121void post_bootmode_clear (void);
wdenk228f29a2002-12-08 09:53:23 +0000122void post_output_backlog ( void );
wdenk7133d4c2002-09-12 22:42:52 +0000123int post_run (char *name, int flags);
124int post_info (char *name);
125int post_log (char *format, ...);
Wolfgang Denk2e5167c2010-10-28 20:00:11 +0200126#ifdef CONFIG_NEEDS_MANUAL_RELOC
wdenk7133d4c2002-09-12 22:42:52 +0000127void post_reloc (void);
Peter Tyser521af042009-09-21 11:20:36 -0500128#endif
wdenk4532cb62003-04-27 22:52:51 +0000129unsigned long post_time_ms (unsigned long base);
wdenk7133d4c2002-09-12 22:42:52 +0000130
131extern struct post_test post_list[];
132extern unsigned int post_list_size;
wdenk27b207f2003-07-24 23:38:38 +0000133extern int post_hotkeys_pressed(void);
Heiko Schochereaf5e652011-07-26 20:31:08 +0000134extern int memory_post_test(int flags);
wdenk7133d4c2002-09-12 22:42:52 +0000135
Yuri Tikhonovce82ff02008-12-20 14:54:21 +0300136/*
137 * If GCC is configured to use a version of GAS that supports
138 * the .gnu_attribute directive, it will use that directive to
139 * record certain properties of the output code.
140 * This feature is new to GCC 4.3.0.
141 * .gnu_attribute is new to GAS 2.18.
142 */
143#if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
144/* Tag_GNU_Power_ABI_FP/soft-float */
145#define GNU_FPOST_ATTR asm(".gnu_attribute 4, 2");
146#else
147#define GNU_FPOST_ATTR
148#endif /* __GNUC__ */
wdenk7133d4c2002-09-12 22:42:52 +0000149#endif /* __ASSEMBLY__ */
150
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200151#define CONFIG_SYS_POST_RTC 0x00000001
152#define CONFIG_SYS_POST_WATCHDOG 0x00000002
153#define CONFIG_SYS_POST_MEMORY 0x00000004
154#define CONFIG_SYS_POST_CPU 0x00000008
155#define CONFIG_SYS_POST_I2C 0x00000010
156#define CONFIG_SYS_POST_CACHE 0x00000020
157#define CONFIG_SYS_POST_UART 0x00000040
158#define CONFIG_SYS_POST_ETHER 0x00000080
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200159#define CONFIG_SYS_POST_USB 0x00000200
160#define CONFIG_SYS_POST_SPR 0x00000400
161#define CONFIG_SYS_POST_SYSMON 0x00000800
162#define CONFIG_SYS_POST_DSP 0x00001000
163#define CONFIG_SYS_POST_OCM 0x00002000
164#define CONFIG_SYS_POST_FPU 0x00004000
165#define CONFIG_SYS_POST_ECC 0x00008000
166#define CONFIG_SYS_POST_BSPEC1 0x00010000
167#define CONFIG_SYS_POST_BSPEC2 0x00020000
168#define CONFIG_SYS_POST_BSPEC3 0x00040000
169#define CONFIG_SYS_POST_BSPEC4 0x00080000
170#define CONFIG_SYS_POST_BSPEC5 0x00100000
171#define CONFIG_SYS_POST_CODEC 0x00200000
Anatolij Gustschin29fd7ce2010-04-24 19:27:11 +0200172#define CONFIG_SYS_POST_COPROC 0x00400000
Mike Frysingerf6f73952011-05-10 13:35:40 +0000173#define CONFIG_SYS_POST_FLASH 0x00800000
Valentin Longchamp8d3fcb52011-09-12 04:18:40 +0000174#define CONFIG_SYS_POST_MEM_REGIONS 0x01000000
wdenk7133d4c2002-09-12 22:42:52 +0000175
wdenk7133d4c2002-09-12 22:42:52 +0000176#endif /* CONFIG_POST */
177
178#endif /* _POST_H */