blob: ac93f439692f95f4cdc6e8fb57f276b9bc3e5f29 [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 Zaidmanf969a682010-09-20 08:51:53 +02005 * (C) Copyright 2010
6 * Michael Zaidman, Kodak, michael.zaidman@kodak.com
7 * post_word_{load|store} cleanup.
8 *
wdenk7133d4c2002-09-12 22:42:52 +00009 * See file CREDITS for list of people who contributed to this
10 * project.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of
15 * the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 * MA 02111-1307 USA
26 */
27#ifndef _POST_H
28#define _POST_H
29
30#ifndef __ASSEMBLY__
31#include <common.h>
Michael Zaidmanf969a682010-09-20 08:51:53 +020032#include <asm/io.h>
33
34#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
35
Valentin Longchampb2596e02011-09-02 04:59:04 +000036#ifndef CONFIG_POST_EXTERNAL_WORD_FUNCS
Michael Zaidmanf969a682010-09-20 08:51:53 +020037#ifdef CONFIG_SYS_POST_WORD_ADDR
38#define _POST_WORD_ADDR CONFIG_SYS_POST_WORD_ADDR
39#else
40
41#ifdef CONFIG_MPC5xxx
42#define _POST_WORD_ADDR (MPC5XXX_SRAM + MPC5XXX_SRAM_POST_SIZE)
43
44#elif defined(CONFIG_MPC512X)
45#define _POST_WORD_ADDR \
46 (CONFIG_SYS_SRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET - 0x4)
47
48#elif defined(CONFIG_8xx)
49#define _POST_WORD_ADDR \
50 (((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_dpmem + CPM_POST_WORD_ADDR)
51
52#elif defined(CONFIG_MPC8260)
53#include <asm/cpm_8260.h>
54#define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CPM_POST_WORD_ADDR)
55
56#elif defined(CONFIG_MPC8360)
57#include <asm/immap_qe.h>
58#define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CPM_POST_WORD_ADDR)
59
60#elif defined (CONFIG_MPC85xx)
York Sunf7541b42010-09-28 15:20:35 -070061#include <asm/immap_85xx.h>
Kumar Galae3a5d372010-12-01 06:42:04 -060062#define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_PIC_OFFSET + \
63 offsetof(ccsr_pic_t, tfrr))
Michael Zaidmanf969a682010-09-20 08:51:53 +020064
Peter Tyser04ce2a82010-10-22 00:20:32 -050065#elif defined (CONFIG_MPC86xx)
66#include <asm/immap_86xx.h>
Kumar Galae3a5d372010-12-01 06:42:04 -060067#define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CONFIG_SYS_MPC86xx_PIC_OFFSET + \
68 offsetof(ccsr_pic_t, tfrr))
Peter Tyser04ce2a82010-10-22 00:20:32 -050069
Michael Zaidmanf969a682010-09-20 08:51:53 +020070#elif defined (CONFIG_4xx)
71#define _POST_WORD_ADDR \
72 (CONFIG_SYS_OCM_DATA_ADDR + CONFIG_SYS_GBL_DATA_OFFSET - 0x4)
wdenk7133d4c2002-09-12 22:42:52 +000073#endif
74
Michael Zaidmanf969a682010-09-20 08:51:53 +020075#ifndef _POST_WORD_ADDR
76#error "_POST_WORD_ADDR currently not implemented for this platform!"
77#endif
78#endif /* CONFIG_SYS_POST_WORD_ADDR */
79
80static inline ulong post_word_load (void)
81{
82 return in_le32((volatile void *)(_POST_WORD_ADDR));
83}
84
85static inline void post_word_store (ulong value)
86{
87 out_le32((volatile void *)(_POST_WORD_ADDR), value);
88}
Valentin Longchampb2596e02011-09-02 04:59:04 +000089
90#else
91
92extern ulong post_word_load(void);
93extern void post_word_store(ulong value);
94
95#endif /* CONFIG_POST_EXTERNAL_WORD_FUNCS */
Michael Zaidmanf969a682010-09-20 08:51:53 +020096#endif /* defined (CONFIG_POST) || defined(CONFIG_LOGBUFFER) */
97#endif /* __ASSEMBLY__ */
98
wdenk7133d4c2002-09-12 22:42:52 +000099#ifdef CONFIG_POST
100
101#define POST_POWERON 0x01 /* test runs on power-on booting */
wdenkdccbda02003-07-14 22:13:32 +0000102#define POST_NORMAL 0x02 /* test runs on normal booting */
103#define POST_SLOWTEST 0x04 /* test is slow, enabled by key press */
wdenk7133d4c2002-09-12 22:42:52 +0000104#define POST_POWERTEST 0x08 /* test runs after watchdog reset */
105
wdenk874ac262003-07-24 23:38:38 +0000106#define POST_COLDBOOT 0x80 /* first boot after power-on */
107
wdenk7133d4c2002-09-12 22:42:52 +0000108#define POST_ROM 0x0100 /* test runs in ROM */
109#define POST_RAM 0x0200 /* test runs in RAM */
110#define POST_MANUAL 0x0400 /* test runs on diag command */
111#define POST_REBOOT 0x0800 /* test may cause rebooting */
Michael Zaidmanf969a682010-09-20 08:51:53 +0200112#define POST_PREREL 0x1000 /* test runs before relocation */
wdenk7133d4c2002-09-12 22:42:52 +0000113
Yuri Tikhonovd773efb2008-02-04 14:11:03 +0100114#define POST_CRITICAL 0x2000 /* Use failbootcmd if test failed */
Yuri Tikhonovbc439b02008-05-08 15:45:26 +0200115#define POST_STOP 0x4000 /* Interrupt POST sequence on fail */
Yuri Tikhonovd773efb2008-02-04 14:11:03 +0100116
wdenk7133d4c2002-09-12 22:42:52 +0000117#define POST_MEM (POST_RAM | POST_ROM)
wdenkdccbda02003-07-14 22:13:32 +0000118#define POST_ALWAYS (POST_NORMAL | \
119 POST_SLOWTEST | \
120 POST_MANUAL | \
wdenk7133d4c2002-09-12 22:42:52 +0000121 POST_POWERON )
122
Yuri Tikhonovd773efb2008-02-04 14:11:03 +0100123#define POST_FAIL_SAVE 0x80
124
Michael Zaidmane3ac2b92010-03-01 11:47:36 +0200125#define POST_BEFORE 1
126#define POST_AFTER 0
127#define POST_PASSED 1
128#define POST_FAILED 0
129
wdenk7133d4c2002-09-12 22:42:52 +0000130#ifndef __ASSEMBLY__
131
132struct post_test {
133 char *name;
134 char *cmd;
135 char *desc;
136 int flags;
137 int (*test) (int flags);
wdenkc08f1582003-04-27 22:52:51 +0000138 int (*init_f) (void);
139 void (*reloc) (void);
wdenk9dfa8d12002-12-08 09:53:23 +0000140 unsigned long testid;
wdenk7133d4c2002-09-12 22:42:52 +0000141};
wdenkc08f1582003-04-27 22:52:51 +0000142int post_init_f (void);
wdenk7133d4c2002-09-12 22:42:52 +0000143void post_bootmode_init (void);
144int post_bootmode_get (unsigned int * last_test);
145void post_bootmode_clear (void);
wdenk9dfa8d12002-12-08 09:53:23 +0000146void post_output_backlog ( void );
wdenk7133d4c2002-09-12 22:42:52 +0000147int post_run (char *name, int flags);
148int post_info (char *name);
149int post_log (char *format, ...);
Wolfgang Denkd0813e52010-10-28 20:00:11 +0200150#ifdef CONFIG_NEEDS_MANUAL_RELOC
wdenk7133d4c2002-09-12 22:42:52 +0000151void post_reloc (void);
Peter Tyser9057cbf2009-09-21 11:20:36 -0500152#endif
wdenkc08f1582003-04-27 22:52:51 +0000153unsigned long post_time_ms (unsigned long base);
wdenk7133d4c2002-09-12 22:42:52 +0000154
155extern struct post_test post_list[];
156extern unsigned int post_list_size;
wdenk874ac262003-07-24 23:38:38 +0000157extern int post_hotkeys_pressed(void);
Heiko Schocher4f151d92011-07-26 20:31:08 +0000158extern int memory_post_test(int flags);
wdenk7133d4c2002-09-12 22:42:52 +0000159
Yuri Tikhonov7ed66f72008-12-20 14:54:21 +0300160/*
161 * If GCC is configured to use a version of GAS that supports
162 * the .gnu_attribute directive, it will use that directive to
163 * record certain properties of the output code.
164 * This feature is new to GCC 4.3.0.
165 * .gnu_attribute is new to GAS 2.18.
166 */
167#if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
168/* Tag_GNU_Power_ABI_FP/soft-float */
169#define GNU_FPOST_ATTR asm(".gnu_attribute 4, 2");
170#else
171#define GNU_FPOST_ATTR
172#endif /* __GNUC__ */
wdenk7133d4c2002-09-12 22:42:52 +0000173#endif /* __ASSEMBLY__ */
174
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200175#define CONFIG_SYS_POST_RTC 0x00000001
176#define CONFIG_SYS_POST_WATCHDOG 0x00000002
177#define CONFIG_SYS_POST_MEMORY 0x00000004
178#define CONFIG_SYS_POST_CPU 0x00000008
179#define CONFIG_SYS_POST_I2C 0x00000010
180#define CONFIG_SYS_POST_CACHE 0x00000020
181#define CONFIG_SYS_POST_UART 0x00000040
182#define CONFIG_SYS_POST_ETHER 0x00000080
183#define CONFIG_SYS_POST_SPI 0x00000100
184#define CONFIG_SYS_POST_USB 0x00000200
185#define CONFIG_SYS_POST_SPR 0x00000400
186#define CONFIG_SYS_POST_SYSMON 0x00000800
187#define CONFIG_SYS_POST_DSP 0x00001000
188#define CONFIG_SYS_POST_OCM 0x00002000
189#define CONFIG_SYS_POST_FPU 0x00004000
190#define CONFIG_SYS_POST_ECC 0x00008000
191#define CONFIG_SYS_POST_BSPEC1 0x00010000
192#define CONFIG_SYS_POST_BSPEC2 0x00020000
193#define CONFIG_SYS_POST_BSPEC3 0x00040000
194#define CONFIG_SYS_POST_BSPEC4 0x00080000
195#define CONFIG_SYS_POST_BSPEC5 0x00100000
196#define CONFIG_SYS_POST_CODEC 0x00200000
Anatolij Gustschin810b2072010-04-24 19:27:11 +0200197#define CONFIG_SYS_POST_COPROC 0x00400000
Mike Frysinger813531f2011-05-10 13:35:40 +0000198#define CONFIG_SYS_POST_FLASH 0x00800000
Valentin Longchamp24db42a2011-09-12 04:18:40 +0000199#define CONFIG_SYS_POST_MEM_REGIONS 0x01000000
wdenk7133d4c2002-09-12 22:42:52 +0000200
wdenk7133d4c2002-09-12 22:42:52 +0000201#endif /* CONFIG_POST */
202
203#endif /* _POST_H */