wdenk | 7133d4c | 2002-09-12 22:42:52 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2002 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
Michael Zaidman | 800eb09 | 2010-09-20 08:51:53 +0200 | [diff] [blame] | 5 | * (C) Copyright 2010 |
| 6 | * Michael Zaidman, Kodak, michael.zaidman@kodak.com |
| 7 | * post_word_{load|store} cleanup. |
| 8 | * |
wdenk | 7133d4c | 2002-09-12 22:42:52 +0000 | [diff] [blame] | 9 | * 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 Zaidman | 800eb09 | 2010-09-20 08:51:53 +0200 | [diff] [blame] | 32 | #include <asm/io.h> |
| 33 | |
| 34 | #if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER) |
| 35 | |
| 36 | #ifdef CONFIG_SYS_POST_WORD_ADDR |
| 37 | #define _POST_WORD_ADDR CONFIG_SYS_POST_WORD_ADDR |
| 38 | #else |
| 39 | |
| 40 | #ifdef CONFIG_MPC5xxx |
| 41 | #define _POST_WORD_ADDR (MPC5XXX_SRAM + MPC5XXX_SRAM_POST_SIZE) |
| 42 | |
| 43 | #elif defined(CONFIG_MPC512X) |
| 44 | #define _POST_WORD_ADDR \ |
| 45 | (CONFIG_SYS_SRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET - 0x4) |
| 46 | |
| 47 | #elif defined(CONFIG_8xx) |
| 48 | #define _POST_WORD_ADDR \ |
| 49 | (((immap_t *)CONFIG_SYS_IMMR)->im_cpm.cp_dpmem + CPM_POST_WORD_ADDR) |
| 50 | |
| 51 | #elif defined(CONFIG_MPC8260) |
| 52 | #include <asm/cpm_8260.h> |
| 53 | #define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CPM_POST_WORD_ADDR) |
| 54 | |
| 55 | #elif defined(CONFIG_MPC8360) |
| 56 | #include <asm/immap_qe.h> |
| 57 | #define _POST_WORD_ADDR (CONFIG_SYS_IMMR + CPM_POST_WORD_ADDR) |
| 58 | |
| 59 | #elif defined (CONFIG_MPC85xx) |
York Sun | 8790ac0 | 2010-09-28 15:20:35 -0700 | [diff] [blame] | 60 | #include <asm/immap_85xx.h> |
| 61 | #define _POST_WORD_ADDR (CONFIG_SYS_IMMR + offsetof(ccsr_pic_t, tfrr)) |
Michael Zaidman | 800eb09 | 2010-09-20 08:51:53 +0200 | [diff] [blame] | 62 | |
Peter Tyser | 65f2351 | 2010-10-22 00:20:32 -0500 | [diff] [blame^] | 63 | #elif defined (CONFIG_MPC86xx) |
| 64 | #include <asm/immap_86xx.h> |
| 65 | #define _POST_WORD_ADDR (CONFIG_SYS_IMMR + offsetof(ccsr_pic_t, tfrr)) |
| 66 | |
Michael Zaidman | 800eb09 | 2010-09-20 08:51:53 +0200 | [diff] [blame] | 67 | #elif defined (CONFIG_4xx) |
| 68 | #define _POST_WORD_ADDR \ |
| 69 | (CONFIG_SYS_OCM_DATA_ADDR + CONFIG_SYS_GBL_DATA_OFFSET - 0x4) |
wdenk | 7133d4c | 2002-09-12 22:42:52 +0000 | [diff] [blame] | 70 | #endif |
| 71 | |
Michael Zaidman | 800eb09 | 2010-09-20 08:51:53 +0200 | [diff] [blame] | 72 | #ifndef _POST_WORD_ADDR |
| 73 | #error "_POST_WORD_ADDR currently not implemented for this platform!" |
| 74 | #endif |
| 75 | #endif /* CONFIG_SYS_POST_WORD_ADDR */ |
| 76 | |
| 77 | static inline ulong post_word_load (void) |
| 78 | { |
| 79 | return in_le32((volatile void *)(_POST_WORD_ADDR)); |
| 80 | } |
| 81 | |
| 82 | static inline void post_word_store (ulong value) |
| 83 | { |
| 84 | out_le32((volatile void *)(_POST_WORD_ADDR), value); |
| 85 | } |
| 86 | #endif /* defined (CONFIG_POST) || defined(CONFIG_LOGBUFFER) */ |
| 87 | #endif /* __ASSEMBLY__ */ |
| 88 | |
wdenk | 7133d4c | 2002-09-12 22:42:52 +0000 | [diff] [blame] | 89 | #ifdef CONFIG_POST |
| 90 | |
| 91 | #define POST_POWERON 0x01 /* test runs on power-on booting */ |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 92 | #define POST_NORMAL 0x02 /* test runs on normal booting */ |
| 93 | #define POST_SLOWTEST 0x04 /* test is slow, enabled by key press */ |
wdenk | 7133d4c | 2002-09-12 22:42:52 +0000 | [diff] [blame] | 94 | #define POST_POWERTEST 0x08 /* test runs after watchdog reset */ |
| 95 | |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 96 | #define POST_COLDBOOT 0x80 /* first boot after power-on */ |
| 97 | |
wdenk | 7133d4c | 2002-09-12 22:42:52 +0000 | [diff] [blame] | 98 | #define POST_ROM 0x0100 /* test runs in ROM */ |
| 99 | #define POST_RAM 0x0200 /* test runs in RAM */ |
| 100 | #define POST_MANUAL 0x0400 /* test runs on diag command */ |
| 101 | #define POST_REBOOT 0x0800 /* test may cause rebooting */ |
Michael Zaidman | 800eb09 | 2010-09-20 08:51:53 +0200 | [diff] [blame] | 102 | #define POST_PREREL 0x1000 /* test runs before relocation */ |
wdenk | 7133d4c | 2002-09-12 22:42:52 +0000 | [diff] [blame] | 103 | |
Yuri Tikhonov | b428f6a | 2008-02-04 14:11:03 +0100 | [diff] [blame] | 104 | #define POST_CRITICAL 0x2000 /* Use failbootcmd if test failed */ |
Yuri Tikhonov | 28a3850 | 2008-05-08 15:45:26 +0200 | [diff] [blame] | 105 | #define POST_STOP 0x4000 /* Interrupt POST sequence on fail */ |
Yuri Tikhonov | b428f6a | 2008-02-04 14:11:03 +0100 | [diff] [blame] | 106 | |
wdenk | 7133d4c | 2002-09-12 22:42:52 +0000 | [diff] [blame] | 107 | #define POST_MEM (POST_RAM | POST_ROM) |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 108 | #define POST_ALWAYS (POST_NORMAL | \ |
| 109 | POST_SLOWTEST | \ |
| 110 | POST_MANUAL | \ |
wdenk | 7133d4c | 2002-09-12 22:42:52 +0000 | [diff] [blame] | 111 | POST_POWERON ) |
| 112 | |
Yuri Tikhonov | b428f6a | 2008-02-04 14:11:03 +0100 | [diff] [blame] | 113 | #define POST_FAIL_SAVE 0x80 |
| 114 | |
Michael Zaidman | e070a56 | 2010-03-01 11:47:36 +0200 | [diff] [blame] | 115 | #define POST_BEFORE 1 |
| 116 | #define POST_AFTER 0 |
| 117 | #define POST_PASSED 1 |
| 118 | #define POST_FAILED 0 |
| 119 | |
wdenk | 7133d4c | 2002-09-12 22:42:52 +0000 | [diff] [blame] | 120 | #ifndef __ASSEMBLY__ |
| 121 | |
| 122 | struct post_test { |
| 123 | char *name; |
| 124 | char *cmd; |
| 125 | char *desc; |
| 126 | int flags; |
| 127 | int (*test) (int flags); |
wdenk | 4532cb6 | 2003-04-27 22:52:51 +0000 | [diff] [blame] | 128 | int (*init_f) (void); |
| 129 | void (*reloc) (void); |
wdenk | 228f29a | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 130 | unsigned long testid; |
wdenk | 7133d4c | 2002-09-12 22:42:52 +0000 | [diff] [blame] | 131 | }; |
wdenk | 4532cb6 | 2003-04-27 22:52:51 +0000 | [diff] [blame] | 132 | int post_init_f (void); |
wdenk | 7133d4c | 2002-09-12 22:42:52 +0000 | [diff] [blame] | 133 | void post_bootmode_init (void); |
| 134 | int post_bootmode_get (unsigned int * last_test); |
| 135 | void post_bootmode_clear (void); |
wdenk | 228f29a | 2002-12-08 09:53:23 +0000 | [diff] [blame] | 136 | void post_output_backlog ( void ); |
wdenk | 7133d4c | 2002-09-12 22:42:52 +0000 | [diff] [blame] | 137 | int post_run (char *name, int flags); |
| 138 | int post_info (char *name); |
| 139 | int post_log (char *format, ...); |
Peter Tyser | 521af04 | 2009-09-21 11:20:36 -0500 | [diff] [blame] | 140 | #ifndef CONFIG_RELOC_FIXUP_WORKS |
wdenk | 7133d4c | 2002-09-12 22:42:52 +0000 | [diff] [blame] | 141 | void post_reloc (void); |
Peter Tyser | 521af04 | 2009-09-21 11:20:36 -0500 | [diff] [blame] | 142 | #endif |
wdenk | 4532cb6 | 2003-04-27 22:52:51 +0000 | [diff] [blame] | 143 | unsigned long post_time_ms (unsigned long base); |
wdenk | 7133d4c | 2002-09-12 22:42:52 +0000 | [diff] [blame] | 144 | |
| 145 | extern struct post_test post_list[]; |
| 146 | extern unsigned int post_list_size; |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 147 | extern int post_hotkeys_pressed(void); |
wdenk | 7133d4c | 2002-09-12 22:42:52 +0000 | [diff] [blame] | 148 | |
Yuri Tikhonov | ce82ff0 | 2008-12-20 14:54:21 +0300 | [diff] [blame] | 149 | /* |
| 150 | * If GCC is configured to use a version of GAS that supports |
| 151 | * the .gnu_attribute directive, it will use that directive to |
| 152 | * record certain properties of the output code. |
| 153 | * This feature is new to GCC 4.3.0. |
| 154 | * .gnu_attribute is new to GAS 2.18. |
| 155 | */ |
| 156 | #if (__GNUC__ >= 4 && __GNUC_MINOR__ >= 3) |
| 157 | /* Tag_GNU_Power_ABI_FP/soft-float */ |
| 158 | #define GNU_FPOST_ATTR asm(".gnu_attribute 4, 2"); |
| 159 | #else |
| 160 | #define GNU_FPOST_ATTR |
| 161 | #endif /* __GNUC__ */ |
wdenk | 7133d4c | 2002-09-12 22:42:52 +0000 | [diff] [blame] | 162 | #endif /* __ASSEMBLY__ */ |
| 163 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 164 | #define CONFIG_SYS_POST_RTC 0x00000001 |
| 165 | #define CONFIG_SYS_POST_WATCHDOG 0x00000002 |
| 166 | #define CONFIG_SYS_POST_MEMORY 0x00000004 |
| 167 | #define CONFIG_SYS_POST_CPU 0x00000008 |
| 168 | #define CONFIG_SYS_POST_I2C 0x00000010 |
| 169 | #define CONFIG_SYS_POST_CACHE 0x00000020 |
| 170 | #define CONFIG_SYS_POST_UART 0x00000040 |
| 171 | #define CONFIG_SYS_POST_ETHER 0x00000080 |
| 172 | #define CONFIG_SYS_POST_SPI 0x00000100 |
| 173 | #define CONFIG_SYS_POST_USB 0x00000200 |
| 174 | #define CONFIG_SYS_POST_SPR 0x00000400 |
| 175 | #define CONFIG_SYS_POST_SYSMON 0x00000800 |
| 176 | #define CONFIG_SYS_POST_DSP 0x00001000 |
| 177 | #define CONFIG_SYS_POST_OCM 0x00002000 |
| 178 | #define CONFIG_SYS_POST_FPU 0x00004000 |
| 179 | #define CONFIG_SYS_POST_ECC 0x00008000 |
| 180 | #define CONFIG_SYS_POST_BSPEC1 0x00010000 |
| 181 | #define CONFIG_SYS_POST_BSPEC2 0x00020000 |
| 182 | #define CONFIG_SYS_POST_BSPEC3 0x00040000 |
| 183 | #define CONFIG_SYS_POST_BSPEC4 0x00080000 |
| 184 | #define CONFIG_SYS_POST_BSPEC5 0x00100000 |
| 185 | #define CONFIG_SYS_POST_CODEC 0x00200000 |
Anatolij Gustschin | 29fd7ce | 2010-04-24 19:27:11 +0200 | [diff] [blame] | 186 | #define CONFIG_SYS_POST_COPROC 0x00400000 |
wdenk | 7133d4c | 2002-09-12 22:42:52 +0000 | [diff] [blame] | 187 | |
| 188 | #endif /* CONFIG_POST */ |
| 189 | |
| 190 | #endif /* _POST_H */ |