blob: 5ebd535823259e45215c90231d9ae110926370ec [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 *
Wolfgang Denkd79de1d2013-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 Zaidmanf969a682010-09-20 08:51:53 +020016#include <asm/io.h>
17
18#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
19
Valentin Longchampb2596e02011-09-02 04:59:04 +000020#ifndef CONFIG_POST_EXTERNAL_WORD_FUNCS
Michael Zaidmanf969a682010-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
32#elif defined(CONFIG_8xx)
33#define _POST_WORD_ADDR \
34 (((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_dpmem + CPM_POST_WORD_ADDR)
35
36#elif defined(CONFIG_MPC8260)
37#include <asm/cpm_8260.h>
38#define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CPM_POST_WORD_ADDR)
39
40#elif defined(CONFIG_MPC8360)
Zhao Qiang978679d2014-06-03 16:27:07 +080041#include <linux/immap_qe.h>
Michael Zaidmanf969a682010-09-20 08:51:53 +020042#define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CPM_POST_WORD_ADDR)
43
44#elif defined (CONFIG_MPC85xx)
York Sunf7541b42010-09-28 15:20:35 -070045#include <asm/immap_85xx.h>
Kumar Galae3a5d372010-12-01 06:42:04 -060046#define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_PIC_OFFSET + \
47 offsetof(ccsr_pic_t, tfrr))
Michael Zaidmanf969a682010-09-20 08:51:53 +020048
Peter Tyser04ce2a82010-10-22 00:20:32 -050049#elif defined (CONFIG_MPC86xx)
50#include <asm/immap_86xx.h>
Kumar Galae3a5d372010-12-01 06:42:04 -060051#define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CONFIG_SYS_MPC86xx_PIC_OFFSET + \
52 offsetof(ccsr_pic_t, tfrr))
Peter Tyser04ce2a82010-10-22 00:20:32 -050053
Michael Zaidmanf969a682010-09-20 08:51:53 +020054#elif defined (CONFIG_4xx)
55#define _POST_WORD_ADDR \
56 (CONFIG_SYS_OCM_DATA_ADDR + CONFIG_SYS_GBL_DATA_OFFSET - 0x4)
wdenk7133d4c2002-09-12 22:42:52 +000057#endif
58
Michael Zaidmanf969a682010-09-20 08:51:53 +020059#ifndef _POST_WORD_ADDR
60#error "_POST_WORD_ADDR currently not implemented for this platform!"
61#endif
62#endif /* CONFIG_SYS_POST_WORD_ADDR */
63
64static inline ulong post_word_load (void)
65{
66 return in_le32((volatile void *)(_POST_WORD_ADDR));
67}
68
69static inline void post_word_store (ulong value)
70{
71 out_le32((volatile void *)(_POST_WORD_ADDR), value);
72}
Valentin Longchampb2596e02011-09-02 04:59:04 +000073
74#else
75
76extern ulong post_word_load(void);
77extern void post_word_store(ulong value);
78
79#endif /* CONFIG_POST_EXTERNAL_WORD_FUNCS */
Michael Zaidmanf969a682010-09-20 08:51:53 +020080#endif /* defined (CONFIG_POST) || defined(CONFIG_LOGBUFFER) */
81#endif /* __ASSEMBLY__ */
82
wdenk7133d4c2002-09-12 22:42:52 +000083#ifdef CONFIG_POST
84
85#define POST_POWERON 0x01 /* test runs on power-on booting */
wdenkdccbda02003-07-14 22:13:32 +000086#define POST_NORMAL 0x02 /* test runs on normal booting */
87#define POST_SLOWTEST 0x04 /* test is slow, enabled by key press */
wdenk7133d4c2002-09-12 22:42:52 +000088#define POST_POWERTEST 0x08 /* test runs after watchdog reset */
89
wdenk874ac262003-07-24 23:38:38 +000090#define POST_COLDBOOT 0x80 /* first boot after power-on */
91
wdenk7133d4c2002-09-12 22:42:52 +000092#define POST_ROM 0x0100 /* test runs in ROM */
93#define POST_RAM 0x0200 /* test runs in RAM */
94#define POST_MANUAL 0x0400 /* test runs on diag command */
95#define POST_REBOOT 0x0800 /* test may cause rebooting */
Michael Zaidmanf969a682010-09-20 08:51:53 +020096#define POST_PREREL 0x1000 /* test runs before relocation */
wdenk7133d4c2002-09-12 22:42:52 +000097
Yuri Tikhonovd773efb2008-02-04 14:11:03 +010098#define POST_CRITICAL 0x2000 /* Use failbootcmd if test failed */
Yuri Tikhonovbc439b02008-05-08 15:45:26 +020099#define POST_STOP 0x4000 /* Interrupt POST sequence on fail */
Yuri Tikhonovd773efb2008-02-04 14:11:03 +0100100
wdenk7133d4c2002-09-12 22:42:52 +0000101#define POST_MEM (POST_RAM | POST_ROM)
wdenkdccbda02003-07-14 22:13:32 +0000102#define POST_ALWAYS (POST_NORMAL | \
103 POST_SLOWTEST | \
104 POST_MANUAL | \
wdenk7133d4c2002-09-12 22:42:52 +0000105 POST_POWERON )
106
Yuri Tikhonovd773efb2008-02-04 14:11:03 +0100107#define POST_FAIL_SAVE 0x80
108
Michael Zaidmane3ac2b92010-03-01 11:47:36 +0200109#define POST_BEFORE 1
110#define POST_AFTER 0
111#define POST_PASSED 1
112#define POST_FAILED 0
113
wdenk7133d4c2002-09-12 22:42:52 +0000114#ifndef __ASSEMBLY__
115
116struct post_test {
117 char *name;
118 char *cmd;
119 char *desc;
120 int flags;
121 int (*test) (int flags);
wdenkc08f1582003-04-27 22:52:51 +0000122 int (*init_f) (void);
123 void (*reloc) (void);
wdenk9dfa8d12002-12-08 09:53:23 +0000124 unsigned long testid;
wdenk7133d4c2002-09-12 22:42:52 +0000125};
wdenkc08f1582003-04-27 22:52:51 +0000126int post_init_f (void);
wdenk7133d4c2002-09-12 22:42:52 +0000127void post_bootmode_init (void);
128int post_bootmode_get (unsigned int * last_test);
129void post_bootmode_clear (void);
wdenk9dfa8d12002-12-08 09:53:23 +0000130void post_output_backlog ( void );
wdenk7133d4c2002-09-12 22:42:52 +0000131int post_run (char *name, int flags);
132int post_info (char *name);
133int post_log (char *format, ...);
Wolfgang Denkd0813e52010-10-28 20:00:11 +0200134#ifdef CONFIG_NEEDS_MANUAL_RELOC
wdenk7133d4c2002-09-12 22:42:52 +0000135void post_reloc (void);
Peter Tyser9057cbf2009-09-21 11:20:36 -0500136#endif
wdenkc08f1582003-04-27 22:52:51 +0000137unsigned long post_time_ms (unsigned long base);
wdenk7133d4c2002-09-12 22:42:52 +0000138
139extern struct post_test post_list[];
140extern unsigned int post_list_size;
wdenk874ac262003-07-24 23:38:38 +0000141extern int post_hotkeys_pressed(void);
Heiko Schocher4f151d92011-07-26 20:31:08 +0000142extern int memory_post_test(int flags);
wdenk7133d4c2002-09-12 22:42:52 +0000143
Yuri Tikhonov7ed66f72008-12-20 14:54:21 +0300144/*
145 * If GCC is configured to use a version of GAS that supports
146 * the .gnu_attribute directive, it will use that directive to
147 * record certain properties of the output code.
148 * This feature is new to GCC 4.3.0.
149 * .gnu_attribute is new to GAS 2.18.
150 */
151#if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
152/* Tag_GNU_Power_ABI_FP/soft-float */
153#define GNU_FPOST_ATTR asm(".gnu_attribute 4, 2");
154#else
155#define GNU_FPOST_ATTR
156#endif /* __GNUC__ */
wdenk7133d4c2002-09-12 22:42:52 +0000157#endif /* __ASSEMBLY__ */
158
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200159#define CONFIG_SYS_POST_RTC 0x00000001
160#define CONFIG_SYS_POST_WATCHDOG 0x00000002
161#define CONFIG_SYS_POST_MEMORY 0x00000004
162#define CONFIG_SYS_POST_CPU 0x00000008
163#define CONFIG_SYS_POST_I2C 0x00000010
164#define CONFIG_SYS_POST_CACHE 0x00000020
165#define CONFIG_SYS_POST_UART 0x00000040
166#define CONFIG_SYS_POST_ETHER 0x00000080
167#define CONFIG_SYS_POST_SPI 0x00000100
168#define CONFIG_SYS_POST_USB 0x00000200
169#define CONFIG_SYS_POST_SPR 0x00000400
170#define CONFIG_SYS_POST_SYSMON 0x00000800
171#define CONFIG_SYS_POST_DSP 0x00001000
172#define CONFIG_SYS_POST_OCM 0x00002000
173#define CONFIG_SYS_POST_FPU 0x00004000
174#define CONFIG_SYS_POST_ECC 0x00008000
175#define CONFIG_SYS_POST_BSPEC1 0x00010000
176#define CONFIG_SYS_POST_BSPEC2 0x00020000
177#define CONFIG_SYS_POST_BSPEC3 0x00040000
178#define CONFIG_SYS_POST_BSPEC4 0x00080000
179#define CONFIG_SYS_POST_BSPEC5 0x00100000
180#define CONFIG_SYS_POST_CODEC 0x00200000
Anatolij Gustschin810b2072010-04-24 19:27:11 +0200181#define CONFIG_SYS_POST_COPROC 0x00400000
Mike Frysinger813531f2011-05-10 13:35:40 +0000182#define CONFIG_SYS_POST_FLASH 0x00800000
Valentin Longchamp24db42a2011-09-12 04:18:40 +0000183#define CONFIG_SYS_POST_MEM_REGIONS 0x01000000
wdenk7133d4c2002-09-12 22:42:52 +0000184
wdenk7133d4c2002-09-12 22:42:52 +0000185#endif /* CONFIG_POST */
186
187#endif /* _POST_H */