diff options
author | Mike Frysinger <vapier.adi@gmail.com> | 2008-02-02 02:47:24 -0500 |
---|---|---|
committer | Bryan Wu <bryan.wu@analog.com> | 2008-02-02 02:47:24 -0500 |
commit | 80f31c8a03d2f0644d0ceaf14e7e0108a007c962 (patch) | |
tree | 71af89f61a1e9f969b9d24977e97ed5982f98237 | |
parent | a3acf52885a2312efb30a043062ef88dc3813082 (diff) |
[Blackfin] arch: change the trace buffer control start/stop logic in the exception handlers
To save/restore the trace buffer control so that if we take an exception
after turning off the trace buffer at a higher level we dont inadvertently
turn the trace buffer back on
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
-rw-r--r-- | arch/blackfin/mach-common/entry.S | 12 | ||||
-rw-r--r-- | include/asm-blackfin/trace.h | 35 |
2 files changed, 24 insertions, 23 deletions
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S index fdd9bf43361e..2cbb7a0bc38e 100644 --- a/arch/blackfin/mach-common/entry.S +++ b/arch/blackfin/mach-common/entry.S | |||
@@ -121,6 +121,7 @@ ENTRY(_ex_icplb_miss) | |||
121 | (R7:6,P5:4) = [sp++]; | 121 | (R7:6,P5:4) = [sp++]; |
122 | ASTAT = [sp++]; | 122 | ASTAT = [sp++]; |
123 | SAVE_ALL_SYS | 123 | SAVE_ALL_SYS |
124 | DEBUG_HWTRACE_SAVE(p5, r7) | ||
124 | #ifdef CONFIG_MPU | 125 | #ifdef CONFIG_MPU |
125 | R0 = SEQSTAT; | 126 | R0 = SEQSTAT; |
126 | R1 = SP; | 127 | R1 = SP; |
@@ -132,14 +133,13 @@ ENTRY(_ex_icplb_miss) | |||
132 | #else | 133 | #else |
133 | call __cplb_hdr; | 134 | call __cplb_hdr; |
134 | #endif | 135 | #endif |
135 | DEBUG_START_HWTRACE(p5, r7) | 136 | DEBUG_HWTRACE_RESTORE(p5, r7) |
136 | RESTORE_ALL_SYS | 137 | RESTORE_ALL_SYS |
137 | SP = EX_SCRATCH_REG; | 138 | SP = EX_SCRATCH_REG; |
138 | rtx; | 139 | rtx; |
139 | ENDPROC(_ex_icplb_miss) | 140 | ENDPROC(_ex_icplb_miss) |
140 | 141 | ||
141 | ENTRY(_ex_syscall) | 142 | ENTRY(_ex_syscall) |
142 | DEBUG_START_HWTRACE(p5, r7) | ||
143 | (R7:6,P5:4) = [sp++]; | 143 | (R7:6,P5:4) = [sp++]; |
144 | ASTAT = [sp++]; | 144 | ASTAT = [sp++]; |
145 | raise 15; /* invoked by TRAP #0, for sys call */ | 145 | raise 15; /* invoked by TRAP #0, for sys call */ |
@@ -178,7 +178,6 @@ ENTRY(_ex_single_step) | |||
178 | ENDPROC(_ex_single_step) | 178 | ENDPROC(_ex_single_step) |
179 | 179 | ||
180 | ENTRY(_bfin_return_from_exception) | 180 | ENTRY(_bfin_return_from_exception) |
181 | DEBUG_START_HWTRACE(p5, r7) | ||
182 | #if ANOMALY_05000257 | 181 | #if ANOMALY_05000257 |
183 | R7=LC0; | 182 | R7=LC0; |
184 | LC0=R7; | 183 | LC0=R7; |
@@ -200,10 +199,9 @@ ENTRY(_handle_bad_cplb) | |||
200 | * need to make a CPLB exception look like a normal exception | 199 | * need to make a CPLB exception look like a normal exception |
201 | */ | 200 | */ |
202 | 201 | ||
203 | DEBUG_START_HWTRACE(p5, r7) | ||
204 | RESTORE_ALL_SYS | 202 | RESTORE_ALL_SYS |
205 | [--sp] = ASTAT; | 203 | [--sp] = ASTAT; |
206 | [--sp] = (R7:6, P5:4); | 204 | [--sp] = (R7:6,P5:4); |
207 | 205 | ||
208 | ENTRY(_ex_replaceable) | 206 | ENTRY(_ex_replaceable) |
209 | nop; | 207 | nop; |
@@ -253,7 +251,6 @@ ENTRY(_ex_trap_c) | |||
253 | R6 = SEQSTAT; | 251 | R6 = SEQSTAT; |
254 | [P5] = R6; | 252 | [P5] = R6; |
255 | 253 | ||
256 | DEBUG_START_HWTRACE(p5, r7) | ||
257 | (R7:6,P5:4) = [sp++]; | 254 | (R7:6,P5:4) = [sp++]; |
258 | ASTAT = [sp++]; | 255 | ASTAT = [sp++]; |
259 | SP = EX_SCRATCH_REG; | 256 | SP = EX_SCRATCH_REG; |
@@ -382,8 +379,7 @@ ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/ | |||
382 | sp.h = _exception_stack_top; | 379 | sp.h = _exception_stack_top; |
383 | /* Try to deal with syscalls quickly. */ | 380 | /* Try to deal with syscalls quickly. */ |
384 | [--sp] = ASTAT; | 381 | [--sp] = ASTAT; |
385 | [--sp] = (R7:6, P5:4); | 382 | [--sp] = (R7:6,P5:4); |
386 | DEBUG_STOP_HWTRACE(p5, r7) | ||
387 | r7 = SEQSTAT; /* reason code is in bit 5:0 */ | 383 | r7 = SEQSTAT; /* reason code is in bit 5:0 */ |
388 | r6.l = lo(SEQSTAT_EXCAUSE); | 384 | r6.l = lo(SEQSTAT_EXCAUSE); |
389 | r6.h = hi(SEQSTAT_EXCAUSE); | 385 | r6.h = hi(SEQSTAT_EXCAUSE); |
diff --git a/include/asm-blackfin/trace.h b/include/asm-blackfin/trace.h index 6313aace9d59..ef18afbc2101 100644 --- a/include/asm-blackfin/trace.h +++ b/include/asm-blackfin/trace.h | |||
@@ -46,42 +46,47 @@ extern unsigned long software_trace_buff[]; | |||
46 | 46 | ||
47 | #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON | 47 | #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON |
48 | 48 | ||
49 | #define TRACE_BUFFER_START(preg, dreg) trace_buffer_start(preg, dreg) | ||
50 | #define TRACE_BUFFER_STOP(preg, dreg) trace_buffer_stop(preg, dreg) | ||
51 | |||
52 | #define trace_buffer_stop(preg, dreg) \ | 49 | #define trace_buffer_stop(preg, dreg) \ |
53 | preg.L = LO(TBUFCTL); \ | 50 | preg.L = LO(TBUFCTL); \ |
54 | preg.H = HI(TBUFCTL); \ | 51 | preg.H = HI(TBUFCTL); \ |
55 | dreg = 0x1; \ | 52 | dreg = 0x1; \ |
56 | [preg] = dreg; | 53 | [preg] = dreg; |
57 | 54 | ||
58 | #define trace_buffer_start(preg, dreg) \ | ||
59 | preg.L = LO(TBUFCTL); \ | ||
60 | preg.H = HI(TBUFCTL); \ | ||
61 | dreg = BFIN_TRACE_ON; \ | ||
62 | [preg] = dreg; | ||
63 | |||
64 | #define trace_buffer_init(preg, dreg) \ | 55 | #define trace_buffer_init(preg, dreg) \ |
65 | preg.L = LO(TBUFCTL); \ | 56 | preg.L = LO(TBUFCTL); \ |
66 | preg.H = HI(TBUFCTL); \ | 57 | preg.H = HI(TBUFCTL); \ |
67 | dreg = BFIN_TRACE_INIT; \ | 58 | dreg = BFIN_TRACE_INIT; \ |
68 | [preg] = dreg; | 59 | [preg] = dreg; |
69 | 60 | ||
61 | #define trace_buffer_save(preg, dreg) \ | ||
62 | preg.L = LO(TBUFCTL); \ | ||
63 | preg.H = HI(TBUFCTL); \ | ||
64 | dreg = [preg]; \ | ||
65 | [sp++] = dreg; \ | ||
66 | dreg = 0x1; \ | ||
67 | [preg] = dreg; | ||
68 | |||
69 | #define trace_buffer_restore(preg, dreg) \ | ||
70 | preg.L = LO(TBUFCTL); \ | ||
71 | preg.H = HI(TBUFCTL); \ | ||
72 | dreg = [sp--]; \ | ||
73 | [preg] = dreg; | ||
74 | |||
70 | #else /* CONFIG_DEBUG_BFIN_HWTRACE_ON */ | 75 | #else /* CONFIG_DEBUG_BFIN_HWTRACE_ON */ |
71 | 76 | ||
72 | #define trace_buffer_stop(preg, dreg) | 77 | #define trace_buffer_stop(preg, dreg) |
73 | #define trace_buffer_start(preg, dreg) | ||
74 | #define trace_buffer_init(preg, dreg) | 78 | #define trace_buffer_init(preg, dreg) |
79 | #define trace_buffer_save(preg, dreg) | ||
80 | #define trace_buffer_restore(preg, dreg) | ||
75 | 81 | ||
76 | #endif /* CONFIG_DEBUG_BFIN_HWTRACE_ON */ | 82 | #endif /* CONFIG_DEBUG_BFIN_HWTRACE_ON */ |
77 | 83 | ||
78 | #ifdef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE | 84 | #ifdef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE |
79 | # define DEBUG_START_HWTRACE(preg, dreg) trace_buffer_start(preg, dreg) | 85 | # define DEBUG_HWTRACE_SAVE(preg, dreg) trace_buffer_save(preg, dreg) |
80 | # define DEBUG_STOP_HWTRACE(preg, dreg) trace_buffer_stop(preg, dreg) | 86 | # define DEBUG_HWTRACE_RESTORE(preg, dreg) trace_buffer_restore(preg, dreg) |
81 | |||
82 | #else | 87 | #else |
83 | # define DEBUG_START_HWTRACE(preg, dreg) | 88 | # define DEBUG_HWTRACE_SAVE(preg, dreg) |
84 | # define DEBUG_STOP_HWTRACE(preg, dreg) | 89 | # define DEBUG_HWTRACE_RESTORE(preg, dreg) |
85 | #endif | 90 | #endif |
86 | 91 | ||
87 | #endif /* __ASSEMBLY__ */ | 92 | #endif /* __ASSEMBLY__ */ |