diff options
author | Robin Getz <robin.getz@analog.com> | 2007-10-09 05:31:46 -0400 |
---|---|---|
committer | Bryan Wu <bryan.wu@analog.com> | 2007-10-09 05:31:46 -0400 |
commit | 337d390b3a9c1ce92a12bdb77b9ae6ded6273b12 (patch) | |
tree | 2c870e325162c3d1a66390fb6d6db3e92de9e2eb /arch/blackfin | |
parent | ce3afa1c043ab3d4125671441a57353d80f5f6f7 (diff) |
Blackfin arch: Print out debug info, as early as possible
Print out debug info, as early as possible - even before the
kernel initializes the interrupt vectors. Now we can print out debug
messages almost anytime during the boot process.
Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Diffstat (limited to 'arch/blackfin')
-rw-r--r-- | arch/blackfin/kernel/early_printk.c | 61 | ||||
-rw-r--r-- | arch/blackfin/mach-bf533/head.S | 6 | ||||
-rw-r--r-- | arch/blackfin/mach-bf537/head.S | 6 | ||||
-rw-r--r-- | arch/blackfin/mach-bf548/head.S | 6 | ||||
-rw-r--r-- | arch/blackfin/mach-bf561/head.S | 6 | ||||
-rw-r--r-- | arch/blackfin/mach-common/entry.S | 43 |
6 files changed, 122 insertions, 6 deletions
diff --git a/arch/blackfin/kernel/early_printk.c b/arch/blackfin/kernel/early_printk.c index 9bf61706694f..6ec518a81113 100644 --- a/arch/blackfin/kernel/early_printk.c +++ b/arch/blackfin/kernel/early_printk.c | |||
@@ -38,13 +38,13 @@ extern struct console *bfin_earlyserial_init(unsigned int port, | |||
38 | 38 | ||
39 | static struct console *early_console; | 39 | static struct console *early_console; |
40 | 40 | ||
41 | /* Default console | 41 | /* Default console */ |
42 | * Port n == ttyBFn | ||
43 | * cflags == UART output modes | ||
44 | */ | ||
45 | #define DEFAULT_PORT 0 | 42 | #define DEFAULT_PORT 0 |
46 | #define DEFAULT_CFLAG CS8|B57600 | 43 | #define DEFAULT_CFLAG CS8|B57600 |
47 | 44 | ||
45 | /* Default console for early crashes */ | ||
46 | #define DEFAULT_EARLY_PORT "serial,uart0,57600" | ||
47 | |||
48 | #ifdef CONFIG_SERIAL_CORE | 48 | #ifdef CONFIG_SERIAL_CORE |
49 | /* What should get here is "0,57600" */ | 49 | /* What should get here is "0,57600" */ |
50 | static struct console * __init earlyserial_init(char *buf) | 50 | static struct console * __init earlyserial_init(char *buf) |
@@ -158,4 +158,57 @@ int __init setup_early_printk(char *buf) | |||
158 | return 0; | 158 | return 0; |
159 | } | 159 | } |
160 | 160 | ||
161 | /* | ||
162 | * Set up a temporary Event Vector Table, so if something bad happens before | ||
163 | * the kernel is fully started, it doesn't vector off into somewhere we don't | ||
164 | * know | ||
165 | */ | ||
166 | |||
167 | asmlinkage void __init init_early_exception_vectors(void) | ||
168 | { | ||
169 | SSYNC(); | ||
170 | |||
171 | /* cannot program in software: | ||
172 | * evt0 - emulation (jtag) | ||
173 | * evt1 - reset | ||
174 | */ | ||
175 | bfin_write_EVT2(early_trap); | ||
176 | bfin_write_EVT3(early_trap); | ||
177 | bfin_write_EVT5(early_trap); | ||
178 | bfin_write_EVT6(early_trap); | ||
179 | bfin_write_EVT7(early_trap); | ||
180 | bfin_write_EVT8(early_trap); | ||
181 | bfin_write_EVT9(early_trap); | ||
182 | bfin_write_EVT10(early_trap); | ||
183 | bfin_write_EVT11(early_trap); | ||
184 | bfin_write_EVT12(early_trap); | ||
185 | bfin_write_EVT13(early_trap); | ||
186 | bfin_write_EVT14(early_trap); | ||
187 | bfin_write_EVT15(early_trap); | ||
188 | CSYNC(); | ||
189 | |||
190 | /* Set all the return from interupt, exception, NMI to a known place | ||
191 | * so if we do a RETI, RETX or RETN by mistake - we go somewhere known | ||
192 | * Note - don't change RETS - we are in a subroutine, or | ||
193 | * RETE - since it might screw up if emulator is attached | ||
194 | */ | ||
195 | asm("\tRETI = %0; RETX = %0; RETN = %0;\n" | ||
196 | : : "p"(early_trap)); | ||
197 | |||
198 | } | ||
199 | |||
200 | asmlinkage void __init early_trap_c(struct pt_regs *fp, void *retaddr) | ||
201 | { | ||
202 | /* This can happen before the uart is initialized, so initialize | ||
203 | * the UART now | ||
204 | */ | ||
205 | if (likely(early_console == NULL)) | ||
206 | setup_early_printk(DEFAULT_EARLY_PORT); | ||
207 | |||
208 | dump_bfin_regs(fp, retaddr); | ||
209 | dump_bfin_trace_buffer(); | ||
210 | |||
211 | panic("Died early"); | ||
212 | } | ||
213 | |||
161 | early_param("earlyprintk", setup_early_printk); | 214 | early_param("earlyprintk", setup_early_printk); |
diff --git a/arch/blackfin/mach-bf533/head.S b/arch/blackfin/mach-bf533/head.S index fa6dc0d8593b..1ded945a6fa0 100644 --- a/arch/blackfin/mach-bf533/head.S +++ b/arch/blackfin/mach-bf533/head.S | |||
@@ -181,6 +181,12 @@ ENTRY(__start) | |||
181 | fp = sp; | 181 | fp = sp; |
182 | usp = sp; | 182 | usp = sp; |
183 | 183 | ||
184 | #ifdef CONFIG_EARLY_PRINTK | ||
185 | SP += -12; | ||
186 | call _init_early_exception_vectors; | ||
187 | SP += 12; | ||
188 | #endif | ||
189 | |||
184 | /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */ | 190 | /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */ |
185 | call _bf53x_relocate_l1_mem; | 191 | call _bf53x_relocate_l1_mem; |
186 | #if CONFIG_BFIN_KERNEL_CLOCK | 192 | #if CONFIG_BFIN_KERNEL_CLOCK |
diff --git a/arch/blackfin/mach-bf537/head.S b/arch/blackfin/mach-bf537/head.S index 2c4ae466d4e9..3014fe8dd155 100644 --- a/arch/blackfin/mach-bf537/head.S +++ b/arch/blackfin/mach-bf537/head.S | |||
@@ -224,6 +224,12 @@ ENTRY(__start) | |||
224 | fp = sp; | 224 | fp = sp; |
225 | usp = sp; | 225 | usp = sp; |
226 | 226 | ||
227 | #ifdef CONFIG_EARLY_PRINTK | ||
228 | SP += -12; | ||
229 | call _init_early_exception_vectors; | ||
230 | SP += 12; | ||
231 | #endif | ||
232 | |||
227 | /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */ | 233 | /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */ |
228 | call _bf53x_relocate_l1_mem; | 234 | call _bf53x_relocate_l1_mem; |
229 | #if CONFIG_BFIN_KERNEL_CLOCK | 235 | #if CONFIG_BFIN_KERNEL_CLOCK |
diff --git a/arch/blackfin/mach-bf548/head.S b/arch/blackfin/mach-bf548/head.S index 532ed0930b5e..3071c243d426 100644 --- a/arch/blackfin/mach-bf548/head.S +++ b/arch/blackfin/mach-bf548/head.S | |||
@@ -125,6 +125,12 @@ ENTRY(__stext) | |||
125 | FP = SP; | 125 | FP = SP; |
126 | USP = SP; | 126 | USP = SP; |
127 | 127 | ||
128 | #ifdef CONFIG_EARLY_PRINTK | ||
129 | SP += -12; | ||
130 | call _init_early_exception_vectors; | ||
131 | SP += 12; | ||
132 | #endif | ||
133 | |||
128 | /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */ | 134 | /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */ |
129 | call _bf53x_relocate_l1_mem; | 135 | call _bf53x_relocate_l1_mem; |
130 | #if CONFIG_BFIN_KERNEL_CLOCK | 136 | #if CONFIG_BFIN_KERNEL_CLOCK |
diff --git a/arch/blackfin/mach-bf561/head.S b/arch/blackfin/mach-bf561/head.S index fd39891ae0fe..96a3d456fb6d 100644 --- a/arch/blackfin/mach-bf561/head.S +++ b/arch/blackfin/mach-bf561/head.S | |||
@@ -169,6 +169,12 @@ ENTRY(__start) | |||
169 | fp = sp; | 169 | fp = sp; |
170 | usp = sp; | 170 | usp = sp; |
171 | 171 | ||
172 | #ifdef CONFIG_EARLY_PRINTK | ||
173 | SP += -12; | ||
174 | call _init_early_exception_vectors; | ||
175 | SP += 12; | ||
176 | #endif | ||
177 | |||
172 | /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */ | 178 | /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */ |
173 | call _bf53x_relocate_l1_mem; | 179 | call _bf53x_relocate_l1_mem; |
174 | #if CONFIG_BFIN_KERNEL_CLOCK | 180 | #if CONFIG_BFIN_KERNEL_CLOCK |
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S index e2239361cac3..a56b231d94ce 100644 --- a/arch/blackfin/mach-common/entry.S +++ b/arch/blackfin/mach-common/entry.S | |||
@@ -835,12 +835,13 @@ ENTRY(_ex_trace_buff_full) | |||
835 | P2 = [sp++]; | 835 | P2 = [sp++]; |
836 | P3 = [sp++]; | 836 | P3 = [sp++]; |
837 | jump _return_from_exception; | 837 | jump _return_from_exception; |
838 | ENDPROC(_ex_trace_buff_full) | ||
838 | 839 | ||
839 | #if CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN == 4 | 840 | #if CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN == 4 |
840 | .data | 841 | .data |
841 | #else | 842 | #else |
842 | .section .l1.data.B | 843 | .section .l1.data.B |
843 | #endif | 844 | #endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN */ |
844 | ENTRY(_trace_buff_offset) | 845 | ENTRY(_trace_buff_offset) |
845 | .long 0; | 846 | .long 0; |
846 | ALIGN | 847 | ALIGN |
@@ -848,7 +849,45 @@ ENTRY(_software_trace_buff) | |||
848 | .rept ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*256); | 849 | .rept ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*256); |
849 | .long 0 | 850 | .long 0 |
850 | .endr | 851 | .endr |
851 | #endif | 852 | #endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND */ |
853 | |||
854 | #if CONFIG_EARLY_PRINTK | ||
855 | .section .init.text | ||
856 | ENTRY(_early_trap) | ||
857 | SAVE_ALL_SYS | ||
858 | trace_buffer_stop(p0,r0); | ||
859 | |||
860 | /* Turn caches off, to ensure we don't get double exceptions */ | ||
861 | |||
862 | P4.L = LO(IMEM_CONTROL); | ||
863 | P4.H = HI(IMEM_CONTROL); | ||
864 | |||
865 | R5 = [P4]; /* Control Register*/ | ||
866 | BITCLR(R5,ENICPLB_P); | ||
867 | CLI R1; | ||
868 | SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */ | ||
869 | .align 8; | ||
870 | [P4] = R5; | ||
871 | SSYNC; | ||
872 | |||
873 | P4.L = LO(DMEM_CONTROL); | ||
874 | P4.H = HI(DMEM_CONTROL); | ||
875 | R5 = [P4]; | ||
876 | BITCLR(R5,ENDCPLB_P); | ||
877 | SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */ | ||
878 | .align 8; | ||
879 | [P4] = R5; | ||
880 | SSYNC; | ||
881 | STI R1; | ||
882 | |||
883 | r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */ | ||
884 | r1 = RETX; | ||
885 | |||
886 | SP += -12; | ||
887 | call _early_trap_c; | ||
888 | SP += 12; | ||
889 | ENDPROC(_early_trap) | ||
890 | #endif /* CONFIG_EARLY_PRINTK */ | ||
852 | 891 | ||
853 | /* | 892 | /* |
854 | * Put these in the kernel data section - that should always be covered by | 893 | * Put these in the kernel data section - that should always be covered by |