aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin
diff options
context:
space:
mode:
authorRobin Getz <robin.getz@analog.com>2007-06-21 04:34:08 -0400
committerBryan Wu <bryan.wu@analog.com>2007-06-21 04:34:08 -0400
commit669b792c77bbc30e9f4d9c95dbc918dc348c49c2 (patch)
tree2d8403e9e3cf998eda8465a322261d45e24cd26a /arch/blackfin
parent29440a2b4cd37e32dfe0fa60ef1665775b24dab1 (diff)
Blackfin arch: Clean up trace buffer handling, No major functional changes.
Turns on trace earlier, so crashes at kernel start should print out a trace, making things easier to debug. Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Mike Frysinger <michael.frysinger@analog.com> Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Diffstat (limited to 'arch/blackfin')
-rw-r--r--arch/blackfin/kernel/setup.c14
-rw-r--r--arch/blackfin/kernel/traps.c11
-rw-r--r--arch/blackfin/mach-bf533/head.S5
-rw-r--r--arch/blackfin/mach-bf537/head.S6
-rw-r--r--arch/blackfin/mach-bf548/head.S5
-rw-r--r--arch/blackfin/mach-bf561/head.S6
-rw-r--r--arch/blackfin/mach-common/entry.S33
-rw-r--r--arch/blackfin/mach-common/interrupt.S8
8 files changed, 45 insertions, 43 deletions
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 07c1cfdc958e..a86bf6545781 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -194,6 +194,17 @@ void __init setup_arch(char **cmdline_p)
194 /* this give a chance to get printk() working before crash. */ 194 /* this give a chance to get printk() working before crash. */
195#endif 195#endif
196 196
197 printk(KERN_INFO "Hardware Trace ");
198 if (bfin_read_TBUFCTL() & 0x1 )
199 printk("Active ");
200 else
201 printk("Off ");
202 if (bfin_read_TBUFCTL() & 0x2)
203 printk("and Enabled\n");
204 else
205 printk("and Disabled\n");
206
207
197#if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH) 208#if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH)
198 /* we need to initialize the Flashrom device here since we might 209 /* we need to initialize the Flashrom device here since we might
199 * do things with flash early on in the boot 210 * do things with flash early on in the boot
@@ -397,9 +408,6 @@ void __init setup_arch(char **cmdline_p)
397 _bfin_swrst = bfin_read_SWRST(); 408 _bfin_swrst = bfin_read_SWRST();
398#endif 409#endif
399 410
400 printk(KERN_INFO "Hardware Trace Enabled\n");
401 bfin_write_TBUFCTL(0x03);
402
403 /* Copy atomic sequences to their fixed location, and sanity check that 411 /* Copy atomic sequences to their fixed location, and sanity check that
404 these locations are the ones that we advertise to userspace. */ 412 these locations are the ones that we advertise to userspace. */
405 memcpy((void *)FIXED_CODE_START, &fixed_code_start, 413 memcpy((void *)FIXED_CODE_START, &fixed_code_start,
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index 56058b0b6d4a..a58d0f50be20 100644
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -33,6 +33,7 @@
33#include <asm/blackfin.h> 33#include <asm/blackfin.h>
34#include <asm/uaccess.h> 34#include <asm/uaccess.h>
35#include <asm/irq_handler.h> 35#include <asm/irq_handler.h>
36#include <asm/trace.h>
36#include <linux/interrupt.h> 37#include <linux/interrupt.h>
37#include <linux/module.h> 38#include <linux/module.h>
38#include <linux/kallsyms.h> 39#include <linux/kallsyms.h>
@@ -131,16 +132,6 @@ static int printk_address(unsigned long address)
131 return printk("[<0x%p>]", (void*)address); 132 return printk("[<0x%p>]", (void*)address);
132} 133}
133 134
134#define trace_buffer_save(x) \
135 do { \
136 (x) = bfin_read_TBUFCTL(); \
137 bfin_write_TBUFCTL((x) & ~TBUFEN); \
138 } while (0)
139#define trace_buffer_restore(x) \
140 do { \
141 bfin_write_TBUFCTL((x)); \
142 } while (0)
143
144asmlinkage void trap_c(struct pt_regs *fp) 135asmlinkage void trap_c(struct pt_regs *fp)
145{ 136{
146 int j, sig = 0; 137 int j, sig = 0;
diff --git a/arch/blackfin/mach-bf533/head.S b/arch/blackfin/mach-bf533/head.S
index 7e2aa8d0f44f..7dd0e9c3a936 100644
--- a/arch/blackfin/mach-bf533/head.S
+++ b/arch/blackfin/mach-bf533/head.S
@@ -30,6 +30,7 @@
30#include <linux/linkage.h> 30#include <linux/linkage.h>
31#include <linux/init.h> 31#include <linux/init.h>
32#include <asm/blackfin.h> 32#include <asm/blackfin.h>
33#include <asm/trace.h>
33#if CONFIG_BFIN_KERNEL_CLOCK 34#if CONFIG_BFIN_KERNEL_CLOCK
34#include <asm/mach/mem_init.h> 35#include <asm/mach/mem_init.h>
35#endif 36#endif
@@ -96,6 +97,10 @@ ENTRY(__start)
96 M2 = r0; 97 M2 = r0;
97 M3 = r0; 98 M3 = r0;
98 99
100 trace_buffer_start(p0,r0);
101 P0 = R1;
102 R0 = R1;
103
99#if CONFIG_DEBUG_KERNEL_START 104#if CONFIG_DEBUG_KERNEL_START
100 105
101/* 106/*
diff --git a/arch/blackfin/mach-bf537/head.S b/arch/blackfin/mach-bf537/head.S
index 7d902bbd860f..429c8a1019da 100644
--- a/arch/blackfin/mach-bf537/head.S
+++ b/arch/blackfin/mach-bf537/head.S
@@ -30,6 +30,8 @@
30#include <linux/linkage.h> 30#include <linux/linkage.h>
31#include <linux/init.h> 31#include <linux/init.h>
32#include <asm/blackfin.h> 32#include <asm/blackfin.h>
33#include <asm/trace.h>
34
33#if CONFIG_BFIN_KERNEL_CLOCK 35#if CONFIG_BFIN_KERNEL_CLOCK
34#include <asm/mach/mem_init.h> 36#include <asm/mach/mem_init.h>
35#endif 37#endif
@@ -93,6 +95,10 @@ ENTRY(__start)
93 M2 = r0; 95 M2 = r0;
94 M3 = r0; 96 M3 = r0;
95 97
98 trace_buffer_start(p0,r0);
99 P0 = R1;
100 R0 = R1;
101
96 /* Turn off the icache */ 102 /* Turn off the icache */
97 p0.l = (IMEM_CONTROL & 0xFFFF); 103 p0.l = (IMEM_CONTROL & 0xFFFF);
98 p0.h = (IMEM_CONTROL >> 16); 104 p0.h = (IMEM_CONTROL >> 16);
diff --git a/arch/blackfin/mach-bf548/head.S b/arch/blackfin/mach-bf548/head.S
index 0e1a25447391..06751ae8b857 100644
--- a/arch/blackfin/mach-bf548/head.S
+++ b/arch/blackfin/mach-bf548/head.S
@@ -29,6 +29,7 @@
29 29
30#include <linux/linkage.h> 30#include <linux/linkage.h>
31#include <asm/blackfin.h> 31#include <asm/blackfin.h>
32#include <asm/trace.h>
32#if CONFIG_BFIN_KERNEL_CLOCK 33#if CONFIG_BFIN_KERNEL_CLOCK
33#include <asm/mach/mem_init.h> 34#include <asm/mach/mem_init.h>
34#endif 35#endif
@@ -91,6 +92,10 @@ ENTRY(__stext)
91 M2 = r0; 92 M2 = r0;
92 M3 = r0; 93 M3 = r0;
93 94
95 trace_buffer_start(p0,r0);
96 P0 = R1;
97 R0 = R1;
98
94 /* Turn off the icache */ 99 /* Turn off the icache */
95 p0.l = (IMEM_CONTROL & 0xFFFF); 100 p0.l = (IMEM_CONTROL & 0xFFFF);
96 p0.h = (IMEM_CONTROL >> 16); 101 p0.h = (IMEM_CONTROL >> 16);
diff --git a/arch/blackfin/mach-bf561/head.S b/arch/blackfin/mach-bf561/head.S
index 31cbc75c85cf..2f08bcb2dded 100644
--- a/arch/blackfin/mach-bf561/head.S
+++ b/arch/blackfin/mach-bf561/head.S
@@ -30,6 +30,8 @@
30#include <linux/linkage.h> 30#include <linux/linkage.h>
31#include <linux/init.h> 31#include <linux/init.h>
32#include <asm/blackfin.h> 32#include <asm/blackfin.h>
33#include <asm/trace.h>
34
33#if CONFIG_BFIN_KERNEL_CLOCK 35#if CONFIG_BFIN_KERNEL_CLOCK
34#include <asm/mach/mem_init.h> 36#include <asm/mach/mem_init.h>
35#endif 37#endif
@@ -93,6 +95,10 @@ ENTRY(__start)
93 M2 = r0; 95 M2 = r0;
94 M3 = r0; 96 M3 = r0;
95 97
98 trace_buffer_start(p0,r0);
99 P0 = R1;
100 R0 = R1;
101
96 /* Turn off the icache */ 102 /* Turn off the icache */
97 p0.l = (IMEM_CONTROL & 0xFFFF); 103 p0.l = (IMEM_CONTROL & 0xFFFF);
98 p0.h = (IMEM_CONTROL >> 16); 104 p0.h = (IMEM_CONTROL >> 16);
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index c4a32ea06c4b..15603275f749 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -54,29 +54,10 @@
54#include <asm/errno.h> 54#include <asm/errno.h>
55#include <asm/thread_info.h> /* TIF_NEED_RESCHED */ 55#include <asm/thread_info.h> /* TIF_NEED_RESCHED */
56#include <asm/asm-offsets.h> 56#include <asm/asm-offsets.h>
57#include <asm/trace.h>
57 58
58#include <asm/mach-common/context.S> 59#include <asm/mach-common/context.S>
59 60
60#ifdef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE
61 /*
62 * TODO: this should be proper save/restore, but for now
63 * we'll just cheat and use 0x1/0x13
64 */
65# define DEBUG_START_HWTRACE \
66 P5.l = LO(TBUFCTL); \
67 P5.h = HI(TBUFCTL); \
68 R7 = 0x13; \
69 [P5] = R7;
70# define DEBUG_STOP_HWTRACE \
71 P5.l = LO(TBUFCTL); \
72 P5.h = HI(TBUFCTL); \
73 R7 = 0x01; \
74 [P5] = R7;
75#else
76# define DEBUG_START_HWTRACE
77# define DEBUG_STOP_HWTRACE
78#endif
79
80#ifdef CONFIG_EXCPT_IRQ_SYSC_L1 61#ifdef CONFIG_EXCPT_IRQ_SYSC_L1
81.section .l1.text 62.section .l1.text
82#else 63#else
@@ -110,7 +91,7 @@ ENTRY(_ex_icplb)
110 ASTAT = [sp++]; 91 ASTAT = [sp++];
111 SAVE_ALL_SYS 92 SAVE_ALL_SYS
112 call __cplb_hdr; 93 call __cplb_hdr;
113 DEBUG_START_HWTRACE 94 DEBUG_START_HWTRACE(p5, r7)
114 RESTORE_ALL_SYS 95 RESTORE_ALL_SYS
115 SP = RETN; 96 SP = RETN;
116 rtx; 97 rtx;
@@ -128,7 +109,7 @@ ENTRY(_ex_spinlock)
128ENDPROC(_ex_spinlock) 109ENDPROC(_ex_spinlock)
129 110
130ENTRY(_ex_syscall) 111ENTRY(_ex_syscall)
131 DEBUG_START_HWTRACE 112 DEBUG_START_HWTRACE(p5, r7)
132 (R7:6,P5:4) = [sp++]; 113 (R7:6,P5:4) = [sp++];
133 ASTAT = [sp++]; 114 ASTAT = [sp++];
134 raise 15; /* invoked by TRAP #0, for sys call */ 115 raise 15; /* invoked by TRAP #0, for sys call */
@@ -186,7 +167,7 @@ ENTRY(_ex_single_step)
186 if !cc jump _ex_trap_c; 167 if !cc jump _ex_trap_c;
187 168
188_return_from_exception: 169_return_from_exception:
189 DEBUG_START_HWTRACE 170 DEBUG_START_HWTRACE(p5, r7)
190#ifdef ANOMALY_05000257 171#ifdef ANOMALY_05000257
191 R7=LC0; 172 R7=LC0;
192 LC0=R7; 173 LC0=R7;
@@ -208,7 +189,7 @@ ENTRY(_handle_bad_cplb)
208 * need to make a CPLB exception look like a normal exception 189 * need to make a CPLB exception look like a normal exception
209 */ 190 */
210 191
211 DEBUG_START_HWTRACE 192 DEBUG_START_HWTRACE(p5, r7)
212 RESTORE_ALL_SYS 193 RESTORE_ALL_SYS
213 [--sp] = ASTAT; 194 [--sp] = ASTAT;
214 [--sp] = (R7:6, P5:4); 195 [--sp] = (R7:6, P5:4);
@@ -251,7 +232,7 @@ ENTRY(_ex_trap_c)
251 R6 = SEQSTAT; 232 R6 = SEQSTAT;
252 [P5] = R6; 233 [P5] = R6;
253 234
254 DEBUG_START_HWTRACE 235 DEBUG_START_HWTRACE(p5, r7)
255 (R7:6,P5:4) = [sp++]; 236 (R7:6,P5:4) = [sp++];
256 ASTAT = [sp++]; 237 ASTAT = [sp++];
257 SP = RETN; 238 SP = RETN;
@@ -335,7 +316,7 @@ ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/
335 /* Try to deal with syscalls quickly. */ 316 /* Try to deal with syscalls quickly. */
336 [--sp] = ASTAT; 317 [--sp] = ASTAT;
337 [--sp] = (R7:6, P5:4); 318 [--sp] = (R7:6, P5:4);
338 DEBUG_STOP_HWTRACE 319 DEBUG_STOP_HWTRACE(p5, r7)
339 r7 = SEQSTAT; /* reason code is in bit 5:0 */ 320 r7 = SEQSTAT; /* reason code is in bit 5:0 */
340 r6.l = lo(SEQSTAT_EXCAUSE); 321 r6.l = lo(SEQSTAT_EXCAUSE);
341 r6.h = hi(SEQSTAT_EXCAUSE); 322 r6.h = hi(SEQSTAT_EXCAUSE);
diff --git a/arch/blackfin/mach-common/interrupt.S b/arch/blackfin/mach-common/interrupt.S
index 8be548e061bf..203e20709163 100644
--- a/arch/blackfin/mach-common/interrupt.S
+++ b/arch/blackfin/mach-common/interrupt.S
@@ -34,6 +34,7 @@
34#include <linux/linkage.h> 34#include <linux/linkage.h>
35#include <asm/entry.h> 35#include <asm/entry.h>
36#include <asm/asm-offsets.h> 36#include <asm/asm-offsets.h>
37#include <asm/trace.h>
37 38
38#include <asm/mach-common/context.S> 39#include <asm/mach-common/context.S>
39 40
@@ -170,10 +171,9 @@ ENTRY(_evt_ivhw)
170 r7.l = W[p5]; 171 r7.l = W[p5];
1711: 1721:
172#endif 173#endif
173 p0.l = lo(TBUFCTL); 174
174 p0.h = hi(TBUFCTL); 175 trace_buffer_stop(p0, r0);
175 r0 = 1; 176
176 [p0] = r0;
177 r0 = IRQ_HWERR; 177 r0 = IRQ_HWERR;
178 r1 = sp; 178 r1 = sp;
179 179