diff options
Diffstat (limited to 'arch/blackfin/kernel/traps.c')
-rw-r--r-- | arch/blackfin/kernel/traps.c | 367 |
1 files changed, 222 insertions, 145 deletions
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c index 9a9d5083acfd..1aa2c788e228 100644 --- a/arch/blackfin/kernel/traps.c +++ b/arch/blackfin/kernel/traps.c | |||
@@ -34,20 +34,19 @@ | |||
34 | #include <linux/fs.h> | 34 | #include <linux/fs.h> |
35 | #include <asm/traps.h> | 35 | #include <asm/traps.h> |
36 | #include <asm/cacheflush.h> | 36 | #include <asm/cacheflush.h> |
37 | #include <asm/cplb.h> | ||
37 | #include <asm/blackfin.h> | 38 | #include <asm/blackfin.h> |
38 | #include <asm/irq_handler.h> | 39 | #include <asm/irq_handler.h> |
39 | #include <linux/irq.h> | 40 | #include <linux/irq.h> |
40 | #include <asm/trace.h> | 41 | #include <asm/trace.h> |
41 | #include <asm/fixed_code.h> | 42 | #include <asm/fixed_code.h> |
42 | #include <asm/dma.h> | ||
43 | 43 | ||
44 | #ifdef CONFIG_KGDB | 44 | #ifdef CONFIG_KGDB |
45 | # include <linux/debugger.h> | ||
46 | # include <linux/kgdb.h> | 45 | # include <linux/kgdb.h> |
47 | 46 | ||
48 | # define CHK_DEBUGGER_TRAP() \ | 47 | # define CHK_DEBUGGER_TRAP() \ |
49 | do { \ | 48 | do { \ |
50 | CHK_DEBUGGER(trapnr, sig, info.si_code, fp, ); \ | 49 | kgdb_handle_exception(trapnr, sig, info.si_code, fp); \ |
51 | } while (0) | 50 | } while (0) |
52 | # define CHK_DEBUGGER_TRAP_MAYBE() \ | 51 | # define CHK_DEBUGGER_TRAP_MAYBE() \ |
53 | do { \ | 52 | do { \ |
@@ -59,6 +58,15 @@ | |||
59 | # define CHK_DEBUGGER_TRAP_MAYBE() do { } while (0) | 58 | # define CHK_DEBUGGER_TRAP_MAYBE() do { } while (0) |
60 | #endif | 59 | #endif |
61 | 60 | ||
61 | |||
62 | #ifdef CONFIG_VERBOSE_DEBUG | ||
63 | #define verbose_printk(fmt, arg...) \ | ||
64 | printk(fmt, ##arg) | ||
65 | #else | ||
66 | #define verbose_printk(fmt, arg...) \ | ||
67 | ({ if (0) printk(fmt, ##arg); 0; }) | ||
68 | #endif | ||
69 | |||
62 | /* Initiate the event table handler */ | 70 | /* Initiate the event table handler */ |
63 | void __init trap_init(void) | 71 | void __init trap_init(void) |
64 | { | 72 | { |
@@ -67,10 +75,19 @@ void __init trap_init(void) | |||
67 | CSYNC(); | 75 | CSYNC(); |
68 | } | 76 | } |
69 | 77 | ||
70 | unsigned long saved_icplb_fault_addr, saved_dcplb_fault_addr; | 78 | /* |
79 | * Used to save the RETX, SEQSTAT, I/D CPLB FAULT ADDR | ||
80 | * values across the transition from exception to IRQ5. | ||
81 | * We put these in L1, so they are going to be in a valid | ||
82 | * location during exception context | ||
83 | */ | ||
84 | __attribute__((l1_data)) | ||
85 | unsigned long saved_retx, saved_seqstat, | ||
86 | saved_icplb_fault_addr, saved_dcplb_fault_addr; | ||
71 | 87 | ||
72 | static void decode_address(char *buf, unsigned long address) | 88 | static void decode_address(char *buf, unsigned long address) |
73 | { | 89 | { |
90 | #ifdef CONFIG_DEBUG_VERBOSE | ||
74 | struct vm_list_struct *vml; | 91 | struct vm_list_struct *vml; |
75 | struct task_struct *p; | 92 | struct task_struct *p; |
76 | struct mm_struct *mm; | 93 | struct mm_struct *mm; |
@@ -178,16 +195,39 @@ static void decode_address(char *buf, unsigned long address) | |||
178 | 195 | ||
179 | done: | 196 | done: |
180 | write_unlock_irqrestore(&tasklist_lock, flags); | 197 | write_unlock_irqrestore(&tasklist_lock, flags); |
198 | #else | ||
199 | sprintf(buf, " "); | ||
200 | #endif | ||
181 | } | 201 | } |
182 | 202 | ||
183 | asmlinkage void double_fault_c(struct pt_regs *fp) | 203 | asmlinkage void double_fault_c(struct pt_regs *fp) |
184 | { | 204 | { |
185 | console_verbose(); | 205 | console_verbose(); |
186 | oops_in_progress = 1; | 206 | oops_in_progress = 1; |
207 | #ifdef CONFIG_DEBUG_VERBOSE | ||
187 | printk(KERN_EMERG "\n" KERN_EMERG "Double Fault\n"); | 208 | printk(KERN_EMERG "\n" KERN_EMERG "Double Fault\n"); |
188 | dump_bfin_process(fp); | 209 | #ifdef CONFIG_DEBUG_DOUBLEFAULT_PRINT |
189 | dump_bfin_mem(fp); | 210 | if (((long)fp->seqstat & SEQSTAT_EXCAUSE) == VEC_UNCOV) { |
190 | show_regs(fp); | 211 | char buf[150]; |
212 | decode_address(buf, saved_retx); | ||
213 | printk(KERN_EMERG "While handling exception (EXCAUSE = 0x%x) at %s:\n", | ||
214 | (int)saved_seqstat & SEQSTAT_EXCAUSE, buf); | ||
215 | decode_address(buf, saved_dcplb_fault_addr); | ||
216 | printk(KERN_NOTICE " DCPLB_FAULT_ADDR: %s\n", buf); | ||
217 | decode_address(buf, saved_icplb_fault_addr); | ||
218 | printk(KERN_NOTICE " ICPLB_FAULT_ADDR: %s\n", buf); | ||
219 | |||
220 | decode_address(buf, fp->retx); | ||
221 | printk(KERN_NOTICE "The instruction at %s caused a double exception\n", | ||
222 | buf); | ||
223 | } else | ||
224 | #endif | ||
225 | { | ||
226 | dump_bfin_process(fp); | ||
227 | dump_bfin_mem(fp); | ||
228 | show_regs(fp); | ||
229 | } | ||
230 | #endif | ||
191 | panic("Double Fault - unrecoverable event\n"); | 231 | panic("Double Fault - unrecoverable event\n"); |
192 | 232 | ||
193 | } | 233 | } |
@@ -259,34 +299,42 @@ asmlinkage void trap_c(struct pt_regs *fp) | |||
259 | return; | 299 | return; |
260 | else | 300 | else |
261 | break; | 301 | break; |
302 | /* 0x03 - User Defined, userspace stack overflow */ | ||
303 | case VEC_EXCPT03: | ||
304 | info.si_code = SEGV_STACKFLOW; | ||
305 | sig = SIGSEGV; | ||
306 | verbose_printk(KERN_NOTICE EXC_0x03(KERN_NOTICE)); | ||
307 | CHK_DEBUGGER_TRAP_MAYBE(); | ||
308 | break; | ||
309 | /* 0x02 - KGDB initial connection and break signal trap */ | ||
310 | case VEC_EXCPT02: | ||
262 | #ifdef CONFIG_KGDB | 311 | #ifdef CONFIG_KGDB |
263 | case VEC_EXCPT02 : /* gdb connection */ | ||
264 | info.si_code = TRAP_ILLTRAP; | 312 | info.si_code = TRAP_ILLTRAP; |
265 | sig = SIGTRAP; | 313 | sig = SIGTRAP; |
266 | CHK_DEBUGGER_TRAP(); | 314 | CHK_DEBUGGER_TRAP(); |
267 | return; | 315 | return; |
268 | #else | ||
269 | /* 0x02 - User Defined, Caught by default */ | ||
270 | #endif | 316 | #endif |
271 | /* 0x03 - User Defined, userspace stack overflow */ | 317 | /* 0x04 - User Defined */ |
272 | case VEC_EXCPT03: | 318 | /* 0x05 - User Defined */ |
273 | info.si_code = SEGV_STACKFLOW; | 319 | /* 0x06 - User Defined */ |
274 | sig = SIGSEGV; | 320 | /* 0x07 - User Defined */ |
275 | printk(KERN_NOTICE EXC_0x03(KERN_NOTICE)); | 321 | /* 0x08 - User Defined */ |
276 | CHK_DEBUGGER_TRAP(); | 322 | /* 0x09 - User Defined */ |
323 | /* 0x0A - User Defined */ | ||
324 | /* 0x0B - User Defined */ | ||
325 | /* 0x0C - User Defined */ | ||
326 | /* 0x0D - User Defined */ | ||
327 | /* 0x0E - User Defined */ | ||
328 | /* 0x0F - User Defined */ | ||
329 | /* If we got here, it is most likely that someone was trying to use a | ||
330 | * custom exception handler, and it is not actually installed properly | ||
331 | */ | ||
332 | case VEC_EXCPT04 ... VEC_EXCPT15: | ||
333 | info.si_code = ILL_ILLPARAOP; | ||
334 | sig = SIGILL; | ||
335 | verbose_printk(KERN_NOTICE EXC_0x04(KERN_NOTICE)); | ||
336 | CHK_DEBUGGER_TRAP_MAYBE(); | ||
277 | break; | 337 | break; |
278 | /* 0x04 - User Defined, Caught by default */ | ||
279 | /* 0x05 - User Defined, Caught by default */ | ||
280 | /* 0x06 - User Defined, Caught by default */ | ||
281 | /* 0x07 - User Defined, Caught by default */ | ||
282 | /* 0x08 - User Defined, Caught by default */ | ||
283 | /* 0x09 - User Defined, Caught by default */ | ||
284 | /* 0x0A - User Defined, Caught by default */ | ||
285 | /* 0x0B - User Defined, Caught by default */ | ||
286 | /* 0x0C - User Defined, Caught by default */ | ||
287 | /* 0x0D - User Defined, Caught by default */ | ||
288 | /* 0x0E - User Defined, Caught by default */ | ||
289 | /* 0x0F - User Defined, Caught by default */ | ||
290 | /* 0x10 HW Single step, handled here */ | 338 | /* 0x10 HW Single step, handled here */ |
291 | case VEC_STEP: | 339 | case VEC_STEP: |
292 | info.si_code = TRAP_STEP; | 340 | info.si_code = TRAP_STEP; |
@@ -301,8 +349,8 @@ asmlinkage void trap_c(struct pt_regs *fp) | |||
301 | case VEC_OVFLOW: | 349 | case VEC_OVFLOW: |
302 | info.si_code = TRAP_TRACEFLOW; | 350 | info.si_code = TRAP_TRACEFLOW; |
303 | sig = SIGTRAP; | 351 | sig = SIGTRAP; |
304 | printk(KERN_NOTICE EXC_0x11(KERN_NOTICE)); | 352 | verbose_printk(KERN_NOTICE EXC_0x11(KERN_NOTICE)); |
305 | CHK_DEBUGGER_TRAP(); | 353 | CHK_DEBUGGER_TRAP_MAYBE(); |
306 | break; | 354 | break; |
307 | /* 0x12 - Reserved, Caught by default */ | 355 | /* 0x12 - Reserved, Caught by default */ |
308 | /* 0x13 - Reserved, Caught by default */ | 356 | /* 0x13 - Reserved, Caught by default */ |
@@ -323,44 +371,43 @@ asmlinkage void trap_c(struct pt_regs *fp) | |||
323 | case VEC_UNDEF_I: | 371 | case VEC_UNDEF_I: |
324 | info.si_code = ILL_ILLOPC; | 372 | info.si_code = ILL_ILLOPC; |
325 | sig = SIGILL; | 373 | sig = SIGILL; |
326 | printk(KERN_NOTICE EXC_0x21(KERN_NOTICE)); | 374 | verbose_printk(KERN_NOTICE EXC_0x21(KERN_NOTICE)); |
327 | CHK_DEBUGGER_TRAP(); | 375 | CHK_DEBUGGER_TRAP_MAYBE(); |
328 | break; | 376 | break; |
329 | /* 0x22 - Illegal Instruction Combination, handled here */ | 377 | /* 0x22 - Illegal Instruction Combination, handled here */ |
330 | case VEC_ILGAL_I: | 378 | case VEC_ILGAL_I: |
331 | info.si_code = ILL_ILLPARAOP; | 379 | info.si_code = ILL_ILLPARAOP; |
332 | sig = SIGILL; | 380 | sig = SIGILL; |
333 | printk(KERN_NOTICE EXC_0x22(KERN_NOTICE)); | 381 | verbose_printk(KERN_NOTICE EXC_0x22(KERN_NOTICE)); |
334 | CHK_DEBUGGER_TRAP(); | 382 | CHK_DEBUGGER_TRAP_MAYBE(); |
335 | break; | 383 | break; |
336 | /* 0x23 - Data CPLB protection violation, handled here */ | 384 | /* 0x23 - Data CPLB protection violation, handled here */ |
337 | case VEC_CPLB_VL: | 385 | case VEC_CPLB_VL: |
338 | info.si_code = ILL_CPLB_VI; | 386 | info.si_code = ILL_CPLB_VI; |
339 | sig = SIGBUS; | 387 | sig = SIGBUS; |
340 | printk(KERN_NOTICE EXC_0x23(KERN_NOTICE)); | 388 | verbose_printk(KERN_NOTICE EXC_0x23(KERN_NOTICE)); |
341 | CHK_DEBUGGER_TRAP(); | 389 | CHK_DEBUGGER_TRAP_MAYBE(); |
342 | break; | 390 | break; |
343 | /* 0x24 - Data access misaligned, handled here */ | 391 | /* 0x24 - Data access misaligned, handled here */ |
344 | case VEC_MISALI_D: | 392 | case VEC_MISALI_D: |
345 | info.si_code = BUS_ADRALN; | 393 | info.si_code = BUS_ADRALN; |
346 | sig = SIGBUS; | 394 | sig = SIGBUS; |
347 | printk(KERN_NOTICE EXC_0x24(KERN_NOTICE)); | 395 | verbose_printk(KERN_NOTICE EXC_0x24(KERN_NOTICE)); |
348 | CHK_DEBUGGER_TRAP(); | 396 | CHK_DEBUGGER_TRAP_MAYBE(); |
349 | break; | 397 | break; |
350 | /* 0x25 - Unrecoverable Event, handled here */ | 398 | /* 0x25 - Unrecoverable Event, handled here */ |
351 | case VEC_UNCOV: | 399 | case VEC_UNCOV: |
352 | info.si_code = ILL_ILLEXCPT; | 400 | info.si_code = ILL_ILLEXCPT; |
353 | sig = SIGILL; | 401 | sig = SIGILL; |
354 | printk(KERN_NOTICE EXC_0x25(KERN_NOTICE)); | 402 | verbose_printk(KERN_NOTICE EXC_0x25(KERN_NOTICE)); |
355 | CHK_DEBUGGER_TRAP(); | 403 | CHK_DEBUGGER_TRAP_MAYBE(); |
356 | break; | 404 | break; |
357 | /* 0x26 - Data CPLB Miss, normal case is handled in _cplb_hdr, | 405 | /* 0x26 - Data CPLB Miss, normal case is handled in _cplb_hdr, |
358 | error case is handled here */ | 406 | error case is handled here */ |
359 | case VEC_CPLB_M: | 407 | case VEC_CPLB_M: |
360 | info.si_code = BUS_ADRALN; | 408 | info.si_code = BUS_ADRALN; |
361 | sig = SIGBUS; | 409 | sig = SIGBUS; |
362 | printk(KERN_NOTICE EXC_0x26(KERN_NOTICE)); | 410 | verbose_printk(KERN_NOTICE EXC_0x26(KERN_NOTICE)); |
363 | CHK_DEBUGGER_TRAP(); | ||
364 | break; | 411 | break; |
365 | /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero, handled here */ | 412 | /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero, handled here */ |
366 | case VEC_CPLB_MHIT: | 413 | case VEC_CPLB_MHIT: |
@@ -368,11 +415,11 @@ asmlinkage void trap_c(struct pt_regs *fp) | |||
368 | sig = SIGSEGV; | 415 | sig = SIGSEGV; |
369 | #ifdef CONFIG_DEBUG_HUNT_FOR_ZERO | 416 | #ifdef CONFIG_DEBUG_HUNT_FOR_ZERO |
370 | if (saved_dcplb_fault_addr < FIXED_CODE_START) | 417 | if (saved_dcplb_fault_addr < FIXED_CODE_START) |
371 | printk(KERN_NOTICE "NULL pointer access\n"); | 418 | verbose_printk(KERN_NOTICE "NULL pointer access\n"); |
372 | else | 419 | else |
373 | #endif | 420 | #endif |
374 | printk(KERN_NOTICE EXC_0x27(KERN_NOTICE)); | 421 | verbose_printk(KERN_NOTICE EXC_0x27(KERN_NOTICE)); |
375 | CHK_DEBUGGER_TRAP(); | 422 | CHK_DEBUGGER_TRAP_MAYBE(); |
376 | break; | 423 | break; |
377 | /* 0x28 - Emulation Watchpoint, handled here */ | 424 | /* 0x28 - Emulation Watchpoint, handled here */ |
378 | case VEC_WATCH: | 425 | case VEC_WATCH: |
@@ -390,8 +437,8 @@ asmlinkage void trap_c(struct pt_regs *fp) | |||
390 | case VEC_ISTRU_VL: /* ADSP-BF535 only (MH) */ | 437 | case VEC_ISTRU_VL: /* ADSP-BF535 only (MH) */ |
391 | info.si_code = BUS_OPFETCH; | 438 | info.si_code = BUS_OPFETCH; |
392 | sig = SIGBUS; | 439 | sig = SIGBUS; |
393 | printk(KERN_NOTICE "BF535: VEC_ISTRU_VL\n"); | 440 | verbose_printk(KERN_NOTICE "BF535: VEC_ISTRU_VL\n"); |
394 | CHK_DEBUGGER_TRAP(); | 441 | CHK_DEBUGGER_TRAP_MAYBE(); |
395 | break; | 442 | break; |
396 | #else | 443 | #else |
397 | /* 0x29 - Reserved, Caught by default */ | 444 | /* 0x29 - Reserved, Caught by default */ |
@@ -400,22 +447,21 @@ asmlinkage void trap_c(struct pt_regs *fp) | |||
400 | case VEC_MISALI_I: | 447 | case VEC_MISALI_I: |
401 | info.si_code = BUS_ADRALN; | 448 | info.si_code = BUS_ADRALN; |
402 | sig = SIGBUS; | 449 | sig = SIGBUS; |
403 | printk(KERN_NOTICE EXC_0x2A(KERN_NOTICE)); | 450 | verbose_printk(KERN_NOTICE EXC_0x2A(KERN_NOTICE)); |
404 | CHK_DEBUGGER_TRAP(); | 451 | CHK_DEBUGGER_TRAP_MAYBE(); |
405 | break; | 452 | break; |
406 | /* 0x2B - Instruction CPLB protection violation, handled here */ | 453 | /* 0x2B - Instruction CPLB protection violation, handled here */ |
407 | case VEC_CPLB_I_VL: | 454 | case VEC_CPLB_I_VL: |
408 | info.si_code = ILL_CPLB_VI; | 455 | info.si_code = ILL_CPLB_VI; |
409 | sig = SIGBUS; | 456 | sig = SIGBUS; |
410 | printk(KERN_NOTICE EXC_0x2B(KERN_NOTICE)); | 457 | verbose_printk(KERN_NOTICE EXC_0x2B(KERN_NOTICE)); |
411 | CHK_DEBUGGER_TRAP(); | 458 | CHK_DEBUGGER_TRAP_MAYBE(); |
412 | break; | 459 | break; |
413 | /* 0x2C - Instruction CPLB miss, handled in _cplb_hdr */ | 460 | /* 0x2C - Instruction CPLB miss, handled in _cplb_hdr */ |
414 | case VEC_CPLB_I_M: | 461 | case VEC_CPLB_I_M: |
415 | info.si_code = ILL_CPLB_MISS; | 462 | info.si_code = ILL_CPLB_MISS; |
416 | sig = SIGBUS; | 463 | sig = SIGBUS; |
417 | printk(KERN_NOTICE EXC_0x2C(KERN_NOTICE)); | 464 | verbose_printk(KERN_NOTICE EXC_0x2C(KERN_NOTICE)); |
418 | CHK_DEBUGGER_TRAP(); | ||
419 | break; | 465 | break; |
420 | /* 0x2D - Instruction CPLB Multiple Hits, handled here */ | 466 | /* 0x2D - Instruction CPLB Multiple Hits, handled here */ |
421 | case VEC_CPLB_I_MHIT: | 467 | case VEC_CPLB_I_MHIT: |
@@ -423,18 +469,18 @@ asmlinkage void trap_c(struct pt_regs *fp) | |||
423 | sig = SIGSEGV; | 469 | sig = SIGSEGV; |
424 | #ifdef CONFIG_DEBUG_HUNT_FOR_ZERO | 470 | #ifdef CONFIG_DEBUG_HUNT_FOR_ZERO |
425 | if (saved_icplb_fault_addr < FIXED_CODE_START) | 471 | if (saved_icplb_fault_addr < FIXED_CODE_START) |
426 | printk(KERN_NOTICE "Jump to NULL address\n"); | 472 | verbose_printk(KERN_NOTICE "Jump to NULL address\n"); |
427 | else | 473 | else |
428 | #endif | 474 | #endif |
429 | printk(KERN_NOTICE EXC_0x2D(KERN_NOTICE)); | 475 | verbose_printk(KERN_NOTICE EXC_0x2D(KERN_NOTICE)); |
430 | CHK_DEBUGGER_TRAP(); | 476 | CHK_DEBUGGER_TRAP_MAYBE(); |
431 | break; | 477 | break; |
432 | /* 0x2E - Illegal use of Supervisor Resource, handled here */ | 478 | /* 0x2E - Illegal use of Supervisor Resource, handled here */ |
433 | case VEC_ILL_RES: | 479 | case VEC_ILL_RES: |
434 | info.si_code = ILL_PRVOPC; | 480 | info.si_code = ILL_PRVOPC; |
435 | sig = SIGILL; | 481 | sig = SIGILL; |
436 | printk(KERN_NOTICE EXC_0x2E(KERN_NOTICE)); | 482 | verbose_printk(KERN_NOTICE EXC_0x2E(KERN_NOTICE)); |
437 | CHK_DEBUGGER_TRAP(); | 483 | CHK_DEBUGGER_TRAP_MAYBE(); |
438 | break; | 484 | break; |
439 | /* 0x2F - Reserved, Caught by default */ | 485 | /* 0x2F - Reserved, Caught by default */ |
440 | /* 0x30 - Reserved, Caught by default */ | 486 | /* 0x30 - Reserved, Caught by default */ |
@@ -461,17 +507,17 @@ asmlinkage void trap_c(struct pt_regs *fp) | |||
461 | case (SEQSTAT_HWERRCAUSE_SYSTEM_MMR): | 507 | case (SEQSTAT_HWERRCAUSE_SYSTEM_MMR): |
462 | info.si_code = BUS_ADRALN; | 508 | info.si_code = BUS_ADRALN; |
463 | sig = SIGBUS; | 509 | sig = SIGBUS; |
464 | printk(KERN_NOTICE HWC_x2(KERN_NOTICE)); | 510 | verbose_printk(KERN_NOTICE HWC_x2(KERN_NOTICE)); |
465 | break; | 511 | break; |
466 | /* External Memory Addressing Error */ | 512 | /* External Memory Addressing Error */ |
467 | case (SEQSTAT_HWERRCAUSE_EXTERN_ADDR): | 513 | case (SEQSTAT_HWERRCAUSE_EXTERN_ADDR): |
468 | info.si_code = BUS_ADRERR; | 514 | info.si_code = BUS_ADRERR; |
469 | sig = SIGBUS; | 515 | sig = SIGBUS; |
470 | printk(KERN_NOTICE HWC_x3(KERN_NOTICE)); | 516 | verbose_printk(KERN_NOTICE HWC_x3(KERN_NOTICE)); |
471 | break; | 517 | break; |
472 | /* Performance Monitor Overflow */ | 518 | /* Performance Monitor Overflow */ |
473 | case (SEQSTAT_HWERRCAUSE_PERF_FLOW): | 519 | case (SEQSTAT_HWERRCAUSE_PERF_FLOW): |
474 | printk(KERN_NOTICE HWC_x12(KERN_NOTICE)); | 520 | verbose_printk(KERN_NOTICE HWC_x12(KERN_NOTICE)); |
475 | break; | 521 | break; |
476 | /* RAISE 5 instruction */ | 522 | /* RAISE 5 instruction */ |
477 | case (SEQSTAT_HWERRCAUSE_RAISE_5): | 523 | case (SEQSTAT_HWERRCAUSE_RAISE_5): |
@@ -481,21 +527,25 @@ asmlinkage void trap_c(struct pt_regs *fp) | |||
481 | printk(KERN_NOTICE HWC_default(KERN_NOTICE)); | 527 | printk(KERN_NOTICE HWC_default(KERN_NOTICE)); |
482 | break; | 528 | break; |
483 | } | 529 | } |
484 | CHK_DEBUGGER_TRAP(); | 530 | CHK_DEBUGGER_TRAP_MAYBE(); |
485 | break; | 531 | break; |
532 | /* | ||
533 | * We should be handling all known exception types above, | ||
534 | * if we get here we hit a reserved one, so panic | ||
535 | */ | ||
486 | default: | 536 | default: |
487 | info.si_code = TRAP_ILLTRAP; | 537 | oops_in_progress = 1; |
488 | sig = SIGTRAP; | 538 | info.si_code = ILL_ILLPARAOP; |
489 | printk(KERN_EMERG "Caught Unhandled Exception, code = %08lx\n", | 539 | sig = SIGILL; |
540 | verbose_printk(KERN_EMERG "Caught Unhandled Exception, code = %08lx\n", | ||
490 | (fp->seqstat & SEQSTAT_EXCAUSE)); | 541 | (fp->seqstat & SEQSTAT_EXCAUSE)); |
491 | CHK_DEBUGGER_TRAP(); | 542 | CHK_DEBUGGER_TRAP_MAYBE(); |
492 | break; | 543 | break; |
493 | } | 544 | } |
494 | 545 | ||
495 | BUG_ON(sig == 0); | 546 | BUG_ON(sig == 0); |
496 | 547 | ||
497 | if (sig != SIGTRAP) { | 548 | if (sig != SIGTRAP) { |
498 | unsigned long *stack; | ||
499 | dump_bfin_process(fp); | 549 | dump_bfin_process(fp); |
500 | dump_bfin_mem(fp); | 550 | dump_bfin_mem(fp); |
501 | show_regs(fp); | 551 | show_regs(fp); |
@@ -503,7 +553,7 @@ asmlinkage void trap_c(struct pt_regs *fp) | |||
503 | /* Print out the trace buffer if it makes sense */ | 553 | /* Print out the trace buffer if it makes sense */ |
504 | #ifndef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE | 554 | #ifndef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE |
505 | if (trapnr == VEC_CPLB_I_M || trapnr == VEC_CPLB_M) | 555 | if (trapnr == VEC_CPLB_I_M || trapnr == VEC_CPLB_M) |
506 | printk(KERN_NOTICE "No trace since you do not have " | 556 | verbose_printk(KERN_NOTICE "No trace since you do not have " |
507 | "CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE enabled\n" | 557 | "CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE enabled\n" |
508 | KERN_NOTICE "\n"); | 558 | KERN_NOTICE "\n"); |
509 | else | 559 | else |
@@ -512,20 +562,22 @@ asmlinkage void trap_c(struct pt_regs *fp) | |||
512 | 562 | ||
513 | if (oops_in_progress) { | 563 | if (oops_in_progress) { |
514 | /* Dump the current kernel stack */ | 564 | /* Dump the current kernel stack */ |
515 | printk(KERN_NOTICE "\n" KERN_NOTICE "Kernel Stack\n"); | 565 | verbose_printk(KERN_NOTICE "\n" KERN_NOTICE "Kernel Stack\n"); |
516 | show_stack(current, NULL); | 566 | show_stack(current, NULL); |
517 | |||
518 | print_modules(); | 567 | print_modules(); |
519 | #ifndef CONFIG_ACCESS_CHECK | 568 | #ifndef CONFIG_ACCESS_CHECK |
520 | printk(KERN_EMERG "Please turn on " | 569 | verbose_printk(KERN_EMERG "Please turn on " |
521 | "CONFIG_ACCESS_CHECK\n"); | 570 | "CONFIG_ACCESS_CHECK\n"); |
522 | #endif | 571 | #endif |
523 | panic("Kernel exception"); | 572 | panic("Kernel exception"); |
524 | } else { | 573 | } else { |
574 | #ifdef CONFIG_VERBOSE_DEBUG | ||
575 | unsigned long *stack; | ||
525 | /* Dump the user space stack */ | 576 | /* Dump the user space stack */ |
526 | stack = (unsigned long *)rdusp(); | 577 | stack = (unsigned long *)rdusp(); |
527 | printk(KERN_NOTICE "Userspace Stack\n"); | 578 | verbose_printk(KERN_NOTICE "Userspace Stack\n"); |
528 | show_stack(NULL, stack); | 579 | show_stack(NULL, stack); |
580 | #endif | ||
529 | } | 581 | } |
530 | } | 582 | } |
531 | 583 | ||
@@ -546,7 +598,7 @@ asmlinkage void trap_c(struct pt_regs *fp) | |||
546 | * Similar to get_user, do some address checking, then dereference | 598 | * Similar to get_user, do some address checking, then dereference |
547 | * Return true on sucess, false on bad address | 599 | * Return true on sucess, false on bad address |
548 | */ | 600 | */ |
549 | bool get_instruction(unsigned short *val, unsigned short *address) | 601 | static bool get_instruction(unsigned short *val, unsigned short *address) |
550 | { | 602 | { |
551 | 603 | ||
552 | unsigned long addr; | 604 | unsigned long addr; |
@@ -592,7 +644,7 @@ bool get_instruction(unsigned short *val, unsigned short *address) | |||
592 | 644 | ||
593 | #if L1_CODE_LENGTH != 0 | 645 | #if L1_CODE_LENGTH != 0 |
594 | if (addr >= L1_CODE_START && (addr + 2) <= (L1_CODE_START + L1_CODE_LENGTH)) { | 646 | if (addr >= L1_CODE_START && (addr + 2) <= (L1_CODE_START + L1_CODE_LENGTH)) { |
595 | dma_memcpy(val, address, 2); | 647 | isram_memcpy(val, address, 2); |
596 | return true; | 648 | return true; |
597 | } | 649 | } |
598 | #endif | 650 | #endif |
@@ -607,45 +659,48 @@ bool get_instruction(unsigned short *val, unsigned short *address) | |||
607 | * These are the normal instructions which cause change of flow, which | 659 | * These are the normal instructions which cause change of flow, which |
608 | * would be at the source of the trace buffer | 660 | * would be at the source of the trace buffer |
609 | */ | 661 | */ |
610 | void decode_instruction(unsigned short *address) | 662 | #ifdef CONFIG_DEBUG_VERBOSE |
663 | static void decode_instruction(unsigned short *address) | ||
611 | { | 664 | { |
612 | unsigned short opcode; | 665 | unsigned short opcode; |
613 | 666 | ||
614 | if (get_instruction(&opcode, address)) { | 667 | if (get_instruction(&opcode, address)) { |
615 | if (opcode == 0x0010) | 668 | if (opcode == 0x0010) |
616 | printk("RTS"); | 669 | verbose_printk("RTS"); |
617 | else if (opcode == 0x0011) | 670 | else if (opcode == 0x0011) |
618 | printk("RTI"); | 671 | verbose_printk("RTI"); |
619 | else if (opcode == 0x0012) | 672 | else if (opcode == 0x0012) |
620 | printk("RTX"); | 673 | verbose_printk("RTX"); |
621 | else if (opcode >= 0x0050 && opcode <= 0x0057) | 674 | else if (opcode >= 0x0050 && opcode <= 0x0057) |
622 | printk("JUMP (P%i)", opcode & 7); | 675 | verbose_printk("JUMP (P%i)", opcode & 7); |
623 | else if (opcode >= 0x0060 && opcode <= 0x0067) | 676 | else if (opcode >= 0x0060 && opcode <= 0x0067) |
624 | printk("CALL (P%i)", opcode & 7); | 677 | verbose_printk("CALL (P%i)", opcode & 7); |
625 | else if (opcode >= 0x0070 && opcode <= 0x0077) | 678 | else if (opcode >= 0x0070 && opcode <= 0x0077) |
626 | printk("CALL (PC+P%i)", opcode & 7); | 679 | verbose_printk("CALL (PC+P%i)", opcode & 7); |
627 | else if (opcode >= 0x0080 && opcode <= 0x0087) | 680 | else if (opcode >= 0x0080 && opcode <= 0x0087) |
628 | printk("JUMP (PC+P%i)", opcode & 7); | 681 | verbose_printk("JUMP (PC+P%i)", opcode & 7); |
629 | else if ((opcode >= 0x1000 && opcode <= 0x13FF) || (opcode >= 0x1800 && opcode <= 0x1BFF)) | 682 | else if ((opcode >= 0x1000 && opcode <= 0x13FF) || (opcode >= 0x1800 && opcode <= 0x1BFF)) |
630 | printk("IF !CC JUMP"); | 683 | verbose_printk("IF !CC JUMP"); |
631 | else if ((opcode >= 0x1400 && opcode <= 0x17ff) || (opcode >= 0x1c00 && opcode <= 0x1fff)) | 684 | else if ((opcode >= 0x1400 && opcode <= 0x17ff) || (opcode >= 0x1c00 && opcode <= 0x1fff)) |
632 | printk("IF CC JUMP"); | 685 | verbose_printk("IF CC JUMP"); |
633 | else if (opcode >= 0x2000 && opcode <= 0x2fff) | 686 | else if (opcode >= 0x2000 && opcode <= 0x2fff) |
634 | printk("JUMP.S"); | 687 | verbose_printk("JUMP.S"); |
635 | else if (opcode >= 0xe080 && opcode <= 0xe0ff) | 688 | else if (opcode >= 0xe080 && opcode <= 0xe0ff) |
636 | printk("LSETUP"); | 689 | verbose_printk("LSETUP"); |
637 | else if (opcode >= 0xe200 && opcode <= 0xe2ff) | 690 | else if (opcode >= 0xe200 && opcode <= 0xe2ff) |
638 | printk("JUMP.L"); | 691 | verbose_printk("JUMP.L"); |
639 | else if (opcode >= 0xe300 && opcode <= 0xe3ff) | 692 | else if (opcode >= 0xe300 && opcode <= 0xe3ff) |
640 | printk("CALL pcrel"); | 693 | verbose_printk("CALL pcrel"); |
641 | else | 694 | else |
642 | printk("0x%04x", opcode); | 695 | verbose_printk("0x%04x", opcode); |
643 | } | 696 | } |
644 | 697 | ||
645 | } | 698 | } |
699 | #endif | ||
646 | 700 | ||
647 | void dump_bfin_trace_buffer(void) | 701 | void dump_bfin_trace_buffer(void) |
648 | { | 702 | { |
703 | #ifdef CONFIG_DEBUG_VERBOSE | ||
649 | #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON | 704 | #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON |
650 | int tflags, i = 0; | 705 | int tflags, i = 0; |
651 | char buf[150]; | 706 | char buf[150]; |
@@ -701,6 +756,7 @@ void dump_bfin_trace_buffer(void) | |||
701 | 756 | ||
702 | trace_buffer_restore(tflags); | 757 | trace_buffer_restore(tflags); |
703 | #endif | 758 | #endif |
759 | #endif | ||
704 | } | 760 | } |
705 | EXPORT_SYMBOL(dump_bfin_trace_buffer); | 761 | EXPORT_SYMBOL(dump_bfin_trace_buffer); |
706 | 762 | ||
@@ -708,7 +764,7 @@ EXPORT_SYMBOL(dump_bfin_trace_buffer); | |||
708 | * Checks to see if the address pointed to is either a | 764 | * Checks to see if the address pointed to is either a |
709 | * 16-bit CALL instruction, or a 32-bit CALL instruction | 765 | * 16-bit CALL instruction, or a 32-bit CALL instruction |
710 | */ | 766 | */ |
711 | bool is_bfin_call(unsigned short *addr) | 767 | static bool is_bfin_call(unsigned short *addr) |
712 | { | 768 | { |
713 | unsigned short opcode = 0, *ins_addr; | 769 | unsigned short opcode = 0, *ins_addr; |
714 | ins_addr = (unsigned short *)addr; | 770 | ins_addr = (unsigned short *)addr; |
@@ -730,8 +786,10 @@ bool is_bfin_call(unsigned short *addr) | |||
730 | return false; | 786 | return false; |
731 | 787 | ||
732 | } | 788 | } |
789 | |||
733 | void show_stack(struct task_struct *task, unsigned long *stack) | 790 | void show_stack(struct task_struct *task, unsigned long *stack) |
734 | { | 791 | { |
792 | #ifdef CONFIG_PRINTK | ||
735 | unsigned int *addr, *endstack, *fp = 0, *frame; | 793 | unsigned int *addr, *endstack, *fp = 0, *frame; |
736 | unsigned short *ins_addr; | 794 | unsigned short *ins_addr; |
737 | char buf[150]; | 795 | char buf[150]; |
@@ -756,8 +814,10 @@ void show_stack(struct task_struct *task, unsigned long *stack) | |||
756 | } else | 814 | } else |
757 | endstack = (unsigned int *)PAGE_ALIGN((unsigned int)stack); | 815 | endstack = (unsigned int *)PAGE_ALIGN((unsigned int)stack); |
758 | 816 | ||
817 | printk(KERN_NOTICE "Stack info:\n"); | ||
759 | decode_address(buf, (unsigned int)stack); | 818 | decode_address(buf, (unsigned int)stack); |
760 | printk(KERN_NOTICE "Stack info:\n" KERN_NOTICE " SP: [0x%p] %s\n", stack, buf); | 819 | printk(KERN_NOTICE " SP: [0x%p] %s\n", stack, buf); |
820 | |||
761 | addr = (unsigned int *)((unsigned int)stack & ~0x3F); | 821 | addr = (unsigned int *)((unsigned int)stack & ~0x3F); |
762 | 822 | ||
763 | /* First thing is to look for a frame pointer */ | 823 | /* First thing is to look for a frame pointer */ |
@@ -848,7 +908,7 @@ void show_stack(struct task_struct *task, unsigned long *stack) | |||
848 | if (!j) | 908 | if (!j) |
849 | printk("\n"); | 909 | printk("\n"); |
850 | } | 910 | } |
851 | 911 | #endif | |
852 | } | 912 | } |
853 | 913 | ||
854 | void dump_stack(void) | 914 | void dump_stack(void) |
@@ -866,38 +926,39 @@ EXPORT_SYMBOL(dump_stack); | |||
866 | 926 | ||
867 | void dump_bfin_process(struct pt_regs *fp) | 927 | void dump_bfin_process(struct pt_regs *fp) |
868 | { | 928 | { |
929 | #ifdef CONFIG_DEBUG_VERBOSE | ||
869 | /* We should be able to look at fp->ipend, but we don't push it on the | 930 | /* We should be able to look at fp->ipend, but we don't push it on the |
870 | * stack all the time, so do this until we fix that */ | 931 | * stack all the time, so do this until we fix that */ |
871 | unsigned int context = bfin_read_IPEND(); | 932 | unsigned int context = bfin_read_IPEND(); |
872 | 933 | ||
873 | if (oops_in_progress) | 934 | if (oops_in_progress) |
874 | printk(KERN_EMERG "Kernel OOPS in progress\n"); | 935 | verbose_printk(KERN_EMERG "Kernel OOPS in progress\n"); |
875 | 936 | ||
876 | if (context & 0x0020 && (fp->seqstat & SEQSTAT_EXCAUSE) == VEC_HWERR) | 937 | if (context & 0x0020 && (fp->seqstat & SEQSTAT_EXCAUSE) == VEC_HWERR) |
877 | printk(KERN_NOTICE "HW Error context\n"); | 938 | verbose_printk(KERN_NOTICE "HW Error context\n"); |
878 | else if (context & 0x0020) | 939 | else if (context & 0x0020) |
879 | printk(KERN_NOTICE "Deferred Exception context\n"); | 940 | verbose_printk(KERN_NOTICE "Deferred Exception context\n"); |
880 | else if (context & 0x3FC0) | 941 | else if (context & 0x3FC0) |
881 | printk(KERN_NOTICE "Interrupt context\n"); | 942 | verbose_printk(KERN_NOTICE "Interrupt context\n"); |
882 | else if (context & 0x4000) | 943 | else if (context & 0x4000) |
883 | printk(KERN_NOTICE "Deferred Interrupt context\n"); | 944 | verbose_printk(KERN_NOTICE "Deferred Interrupt context\n"); |
884 | else if (context & 0x8000) | 945 | else if (context & 0x8000) |
885 | printk(KERN_NOTICE "Kernel process context\n"); | 946 | verbose_printk(KERN_NOTICE "Kernel process context\n"); |
886 | 947 | ||
887 | /* Because we are crashing, and pointers could be bad, we check things | 948 | /* Because we are crashing, and pointers could be bad, we check things |
888 | * pretty closely before we use them | 949 | * pretty closely before we use them |
889 | */ | 950 | */ |
890 | if ((unsigned long)current >= FIXED_CODE_START && | 951 | if ((unsigned long)current >= FIXED_CODE_START && |
891 | !((unsigned long)current & 0x3) && current->pid) { | 952 | !((unsigned long)current & 0x3) && current->pid) { |
892 | printk(KERN_NOTICE "CURRENT PROCESS:\n"); | 953 | verbose_printk(KERN_NOTICE "CURRENT PROCESS:\n"); |
893 | if (current->comm >= (char *)FIXED_CODE_START) | 954 | if (current->comm >= (char *)FIXED_CODE_START) |
894 | printk(KERN_NOTICE "COMM=%s PID=%d\n", | 955 | verbose_printk(KERN_NOTICE "COMM=%s PID=%d\n", |
895 | current->comm, current->pid); | 956 | current->comm, current->pid); |
896 | else | 957 | else |
897 | printk(KERN_NOTICE "COMM= invalid\n"); | 958 | verbose_printk(KERN_NOTICE "COMM= invalid\n"); |
898 | 959 | ||
899 | if (!((unsigned long)current->mm & 0x3) && (unsigned long)current->mm >= FIXED_CODE_START) | 960 | if (!((unsigned long)current->mm & 0x3) && (unsigned long)current->mm >= FIXED_CODE_START) |
900 | printk(KERN_NOTICE "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n" | 961 | verbose_printk(KERN_NOTICE "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n" |
901 | KERN_NOTICE " BSS = 0x%p-0x%p USER-STACK = 0x%p\n" | 962 | KERN_NOTICE " BSS = 0x%p-0x%p USER-STACK = 0x%p\n" |
902 | KERN_NOTICE "\n", | 963 | KERN_NOTICE "\n", |
903 | (void *)current->mm->start_code, | 964 | (void *)current->mm->start_code, |
@@ -908,38 +969,40 @@ void dump_bfin_process(struct pt_regs *fp) | |||
908 | (void *)current->mm->brk, | 969 | (void *)current->mm->brk, |
909 | (void *)current->mm->start_stack); | 970 | (void *)current->mm->start_stack); |
910 | else | 971 | else |
911 | printk(KERN_NOTICE "invalid mm\n"); | 972 | verbose_printk(KERN_NOTICE "invalid mm\n"); |
912 | } else | 973 | } else |
913 | printk(KERN_NOTICE "\n" KERN_NOTICE | 974 | verbose_printk(KERN_NOTICE "\n" KERN_NOTICE |
914 | "No Valid process in current context\n"); | 975 | "No Valid process in current context\n"); |
976 | #endif | ||
915 | } | 977 | } |
916 | 978 | ||
917 | void dump_bfin_mem(struct pt_regs *fp) | 979 | void dump_bfin_mem(struct pt_regs *fp) |
918 | { | 980 | { |
981 | #ifdef CONFIG_DEBUG_VERBOSE | ||
919 | unsigned short *addr, *erraddr, val = 0, err = 0; | 982 | unsigned short *addr, *erraddr, val = 0, err = 0; |
920 | char sti = 0, buf[6]; | 983 | char sti = 0, buf[6]; |
921 | 984 | ||
922 | erraddr = (void *)fp->pc; | 985 | erraddr = (void *)fp->pc; |
923 | 986 | ||
924 | printk(KERN_NOTICE "return address: [0x%p]; contents of:", erraddr); | 987 | verbose_printk(KERN_NOTICE "return address: [0x%p]; contents of:", erraddr); |
925 | 988 | ||
926 | for (addr = (unsigned short *)((unsigned long)erraddr & ~0xF) - 0x10; | 989 | for (addr = (unsigned short *)((unsigned long)erraddr & ~0xF) - 0x10; |
927 | addr < (unsigned short *)((unsigned long)erraddr & ~0xF) + 0x10; | 990 | addr < (unsigned short *)((unsigned long)erraddr & ~0xF) + 0x10; |
928 | addr++) { | 991 | addr++) { |
929 | if (!((unsigned long)addr & 0xF)) | 992 | if (!((unsigned long)addr & 0xF)) |
930 | printk("\n" KERN_NOTICE "0x%p: ", addr); | 993 | verbose_printk("\n" KERN_NOTICE "0x%p: ", addr); |
931 | 994 | ||
932 | if (get_instruction(&val, addr)) { | 995 | if (!get_instruction(&val, addr)) { |
933 | val = 0; | 996 | val = 0; |
934 | sprintf(buf, "????"); | 997 | sprintf(buf, "????"); |
935 | } else | 998 | } else |
936 | sprintf(buf, "%04x", val); | 999 | sprintf(buf, "%04x", val); |
937 | 1000 | ||
938 | if (addr == erraddr) { | 1001 | if (addr == erraddr) { |
939 | printk("[%s]", buf); | 1002 | verbose_printk("[%s]", buf); |
940 | err = val; | 1003 | err = val; |
941 | } else | 1004 | } else |
942 | printk(" %s ", buf); | 1005 | verbose_printk(" %s ", buf); |
943 | 1006 | ||
944 | /* Do any previous instructions turn on interrupts? */ | 1007 | /* Do any previous instructions turn on interrupts? */ |
945 | if (addr <= erraddr && /* in the past */ | 1008 | if (addr <= erraddr && /* in the past */ |
@@ -948,14 +1011,14 @@ void dump_bfin_mem(struct pt_regs *fp) | |||
948 | sti = 1; | 1011 | sti = 1; |
949 | } | 1012 | } |
950 | 1013 | ||
951 | printk("\n"); | 1014 | verbose_printk("\n"); |
952 | 1015 | ||
953 | /* Hardware error interrupts can be deferred */ | 1016 | /* Hardware error interrupts can be deferred */ |
954 | if (unlikely(sti && (fp->seqstat & SEQSTAT_EXCAUSE) == VEC_HWERR && | 1017 | if (unlikely(sti && (fp->seqstat & SEQSTAT_EXCAUSE) == VEC_HWERR && |
955 | oops_in_progress)){ | 1018 | oops_in_progress)){ |
956 | printk(KERN_NOTICE "Looks like this was a deferred error - sorry\n"); | 1019 | verbose_printk(KERN_NOTICE "Looks like this was a deferred error - sorry\n"); |
957 | #ifndef CONFIG_DEBUG_HWERR | 1020 | #ifndef CONFIG_DEBUG_HWERR |
958 | printk(KERN_NOTICE "The remaining message may be meaningless\n" | 1021 | verbose_printk(KERN_NOTICE "The remaining message may be meaningless\n" |
959 | KERN_NOTICE "You should enable CONFIG_DEBUG_HWERR to get a" | 1022 | KERN_NOTICE "You should enable CONFIG_DEBUG_HWERR to get a" |
960 | " better idea where it came from\n"); | 1023 | " better idea where it came from\n"); |
961 | #else | 1024 | #else |
@@ -969,34 +1032,47 @@ void dump_bfin_mem(struct pt_regs *fp) | |||
969 | /* And the last RETI points to the current userspace context */ | 1032 | /* And the last RETI points to the current userspace context */ |
970 | if ((fp + 1)->pc >= current->mm->start_code && | 1033 | if ((fp + 1)->pc >= current->mm->start_code && |
971 | (fp + 1)->pc <= current->mm->end_code) { | 1034 | (fp + 1)->pc <= current->mm->end_code) { |
972 | printk(KERN_NOTICE "It might be better to look around here : \n"); | 1035 | verbose_printk(KERN_NOTICE "It might be better to look around here : \n"); |
973 | printk(KERN_NOTICE "-------------------------------------------\n"); | 1036 | verbose_printk(KERN_NOTICE "-------------------------------------------\n"); |
974 | show_regs(fp + 1); | 1037 | show_regs(fp + 1); |
975 | printk(KERN_NOTICE "-------------------------------------------\n"); | 1038 | verbose_printk(KERN_NOTICE "-------------------------------------------\n"); |
976 | } | 1039 | } |
977 | } | 1040 | } |
978 | #endif | 1041 | #endif |
979 | } | 1042 | } |
1043 | #endif | ||
980 | } | 1044 | } |
981 | 1045 | ||
982 | void show_regs(struct pt_regs *fp) | 1046 | void show_regs(struct pt_regs *fp) |
983 | { | 1047 | { |
1048 | #ifdef CONFIG_DEBUG_VERBOSE | ||
984 | char buf [150]; | 1049 | char buf [150]; |
985 | struct irqaction *action; | 1050 | struct irqaction *action; |
986 | unsigned int i; | 1051 | unsigned int i; |
987 | unsigned long flags; | 1052 | unsigned long flags; |
988 | 1053 | ||
989 | printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\t\t%s\n", print_tainted()); | 1054 | verbose_printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\t\t%s\n", print_tainted()); |
990 | printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n", | 1055 | verbose_printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n", |
991 | (long)fp->seqstat, fp->ipend, fp->syscfg); | 1056 | (long)fp->seqstat, fp->ipend, fp->syscfg); |
992 | printk(KERN_NOTICE " HWERRCAUSE: 0x%lx\n", | 1057 | if ((fp->seqstat & SEQSTAT_EXCAUSE) == VEC_HWERR) { |
993 | (fp->seqstat & SEQSTAT_HWERRCAUSE) >> 14); | 1058 | verbose_printk(KERN_NOTICE " HWERRCAUSE: 0x%lx\n", |
994 | printk(KERN_NOTICE " EXCAUSE : 0x%lx\n", | 1059 | (fp->seqstat & SEQSTAT_HWERRCAUSE) >> 14); |
1060 | #ifdef EBIU_ERRMST | ||
1061 | /* If the error was from the EBIU, print it out */ | ||
1062 | if (bfin_read_EBIU_ERRMST() & CORE_ERROR) { | ||
1063 | verbose_printk(KERN_NOTICE " EBIU Error Reason : 0x%04x\n", | ||
1064 | bfin_read_EBIU_ERRMST()); | ||
1065 | verbose_printk(KERN_NOTICE " EBIU Error Address : 0x%08x\n", | ||
1066 | bfin_read_EBIU_ERRADD()); | ||
1067 | } | ||
1068 | #endif | ||
1069 | } | ||
1070 | verbose_printk(KERN_NOTICE " EXCAUSE : 0x%lx\n", | ||
995 | fp->seqstat & SEQSTAT_EXCAUSE); | 1071 | fp->seqstat & SEQSTAT_EXCAUSE); |
996 | for (i = 6; i <= 15 ; i++) { | 1072 | for (i = 6; i <= 15 ; i++) { |
997 | if (fp->ipend & (1 << i)) { | 1073 | if (fp->ipend & (1 << i)) { |
998 | decode_address(buf, bfin_read32(EVT0 + 4*i)); | 1074 | decode_address(buf, bfin_read32(EVT0 + 4*i)); |
999 | printk(KERN_NOTICE " physical IVG%i asserted : %s\n", i, buf); | 1075 | verbose_printk(KERN_NOTICE " physical IVG%i asserted : %s\n", i, buf); |
1000 | } | 1076 | } |
1001 | } | 1077 | } |
1002 | 1078 | ||
@@ -1009,64 +1085,65 @@ void show_regs(struct pt_regs *fp) | |||
1009 | goto unlock; | 1085 | goto unlock; |
1010 | 1086 | ||
1011 | decode_address(buf, (unsigned int)action->handler); | 1087 | decode_address(buf, (unsigned int)action->handler); |
1012 | printk(KERN_NOTICE " logical irq %3d mapped : %s", i, buf); | 1088 | verbose_printk(KERN_NOTICE " logical irq %3d mapped : %s", i, buf); |
1013 | for (action = action->next; action; action = action->next) { | 1089 | for (action = action->next; action; action = action->next) { |
1014 | decode_address(buf, (unsigned int)action->handler); | 1090 | decode_address(buf, (unsigned int)action->handler); |
1015 | printk(", %s", buf); | 1091 | verbose_printk(", %s", buf); |
1016 | } | 1092 | } |
1017 | printk("\n"); | 1093 | verbose_printk("\n"); |
1018 | unlock: | 1094 | unlock: |
1019 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); | 1095 | spin_unlock_irqrestore(&irq_desc[i].lock, flags); |
1020 | } | 1096 | } |
1021 | } | 1097 | } |
1022 | 1098 | ||
1023 | decode_address(buf, fp->rete); | 1099 | decode_address(buf, fp->rete); |
1024 | printk(KERN_NOTICE " RETE: %s\n", buf); | 1100 | verbose_printk(KERN_NOTICE " RETE: %s\n", buf); |
1025 | decode_address(buf, fp->retn); | 1101 | decode_address(buf, fp->retn); |
1026 | printk(KERN_NOTICE " RETN: %s\n", buf); | 1102 | verbose_printk(KERN_NOTICE " RETN: %s\n", buf); |
1027 | decode_address(buf, fp->retx); | 1103 | decode_address(buf, fp->retx); |
1028 | printk(KERN_NOTICE " RETX: %s\n", buf); | 1104 | verbose_printk(KERN_NOTICE " RETX: %s\n", buf); |
1029 | decode_address(buf, fp->rets); | 1105 | decode_address(buf, fp->rets); |
1030 | printk(KERN_NOTICE " RETS: %s\n", buf); | 1106 | verbose_printk(KERN_NOTICE " RETS: %s\n", buf); |
1031 | decode_address(buf, fp->pc); | 1107 | decode_address(buf, fp->pc); |
1032 | printk(KERN_NOTICE " PC : %s\n", buf); | 1108 | verbose_printk(KERN_NOTICE " PC : %s\n", buf); |
1033 | 1109 | ||
1034 | if (((long)fp->seqstat & SEQSTAT_EXCAUSE) && | 1110 | if (((long)fp->seqstat & SEQSTAT_EXCAUSE) && |
1035 | (((long)fp->seqstat & SEQSTAT_EXCAUSE) != VEC_HWERR)) { | 1111 | (((long)fp->seqstat & SEQSTAT_EXCAUSE) != VEC_HWERR)) { |
1036 | decode_address(buf, saved_dcplb_fault_addr); | 1112 | decode_address(buf, saved_dcplb_fault_addr); |
1037 | printk(KERN_NOTICE "DCPLB_FAULT_ADDR: %s\n", buf); | 1113 | verbose_printk(KERN_NOTICE "DCPLB_FAULT_ADDR: %s\n", buf); |
1038 | decode_address(buf, saved_icplb_fault_addr); | 1114 | decode_address(buf, saved_icplb_fault_addr); |
1039 | printk(KERN_NOTICE "ICPLB_FAULT_ADDR: %s\n", buf); | 1115 | verbose_printk(KERN_NOTICE "ICPLB_FAULT_ADDR: %s\n", buf); |
1040 | } | 1116 | } |
1041 | 1117 | ||
1042 | printk(KERN_NOTICE "\n" KERN_NOTICE "PROCESSOR STATE:\n"); | 1118 | verbose_printk(KERN_NOTICE "\n" KERN_NOTICE "PROCESSOR STATE:\n"); |
1043 | printk(KERN_NOTICE " R0 : %08lx R1 : %08lx R2 : %08lx R3 : %08lx\n", | 1119 | verbose_printk(KERN_NOTICE " R0 : %08lx R1 : %08lx R2 : %08lx R3 : %08lx\n", |
1044 | fp->r0, fp->r1, fp->r2, fp->r3); | 1120 | fp->r0, fp->r1, fp->r2, fp->r3); |
1045 | printk(KERN_NOTICE " R4 : %08lx R5 : %08lx R6 : %08lx R7 : %08lx\n", | 1121 | verbose_printk(KERN_NOTICE " R4 : %08lx R5 : %08lx R6 : %08lx R7 : %08lx\n", |
1046 | fp->r4, fp->r5, fp->r6, fp->r7); | 1122 | fp->r4, fp->r5, fp->r6, fp->r7); |
1047 | printk(KERN_NOTICE " P0 : %08lx P1 : %08lx P2 : %08lx P3 : %08lx\n", | 1123 | verbose_printk(KERN_NOTICE " P0 : %08lx P1 : %08lx P2 : %08lx P3 : %08lx\n", |
1048 | fp->p0, fp->p1, fp->p2, fp->p3); | 1124 | fp->p0, fp->p1, fp->p2, fp->p3); |
1049 | printk(KERN_NOTICE " P4 : %08lx P5 : %08lx FP : %08lx SP : %08lx\n", | 1125 | verbose_printk(KERN_NOTICE " P4 : %08lx P5 : %08lx FP : %08lx SP : %08lx\n", |
1050 | fp->p4, fp->p5, fp->fp, (long)fp); | 1126 | fp->p4, fp->p5, fp->fp, (long)fp); |
1051 | printk(KERN_NOTICE " LB0: %08lx LT0: %08lx LC0: %08lx\n", | 1127 | verbose_printk(KERN_NOTICE " LB0: %08lx LT0: %08lx LC0: %08lx\n", |
1052 | fp->lb0, fp->lt0, fp->lc0); | 1128 | fp->lb0, fp->lt0, fp->lc0); |
1053 | printk(KERN_NOTICE " LB1: %08lx LT1: %08lx LC1: %08lx\n", | 1129 | verbose_printk(KERN_NOTICE " LB1: %08lx LT1: %08lx LC1: %08lx\n", |
1054 | fp->lb1, fp->lt1, fp->lc1); | 1130 | fp->lb1, fp->lt1, fp->lc1); |
1055 | printk(KERN_NOTICE " B0 : %08lx L0 : %08lx M0 : %08lx I0 : %08lx\n", | 1131 | verbose_printk(KERN_NOTICE " B0 : %08lx L0 : %08lx M0 : %08lx I0 : %08lx\n", |
1056 | fp->b0, fp->l0, fp->m0, fp->i0); | 1132 | fp->b0, fp->l0, fp->m0, fp->i0); |
1057 | printk(KERN_NOTICE " B1 : %08lx L1 : %08lx M1 : %08lx I1 : %08lx\n", | 1133 | verbose_printk(KERN_NOTICE " B1 : %08lx L1 : %08lx M1 : %08lx I1 : %08lx\n", |
1058 | fp->b1, fp->l1, fp->m1, fp->i1); | 1134 | fp->b1, fp->l1, fp->m1, fp->i1); |
1059 | printk(KERN_NOTICE " B2 : %08lx L2 : %08lx M2 : %08lx I2 : %08lx\n", | 1135 | verbose_printk(KERN_NOTICE " B2 : %08lx L2 : %08lx M2 : %08lx I2 : %08lx\n", |
1060 | fp->b2, fp->l2, fp->m2, fp->i2); | 1136 | fp->b2, fp->l2, fp->m2, fp->i2); |
1061 | printk(KERN_NOTICE " B3 : %08lx L3 : %08lx M3 : %08lx I3 : %08lx\n", | 1137 | verbose_printk(KERN_NOTICE " B3 : %08lx L3 : %08lx M3 : %08lx I3 : %08lx\n", |
1062 | fp->b3, fp->l3, fp->m3, fp->i3); | 1138 | fp->b3, fp->l3, fp->m3, fp->i3); |
1063 | printk(KERN_NOTICE "A0.w: %08lx A0.x: %08lx A1.w: %08lx A1.x: %08lx\n", | 1139 | verbose_printk(KERN_NOTICE "A0.w: %08lx A0.x: %08lx A1.w: %08lx A1.x: %08lx\n", |
1064 | fp->a0w, fp->a0x, fp->a1w, fp->a1x); | 1140 | fp->a0w, fp->a0x, fp->a1w, fp->a1x); |
1065 | 1141 | ||
1066 | printk(KERN_NOTICE "USP : %08lx ASTAT: %08lx\n", | 1142 | verbose_printk(KERN_NOTICE "USP : %08lx ASTAT: %08lx\n", |
1067 | rdusp(), fp->astat); | 1143 | rdusp(), fp->astat); |
1068 | 1144 | ||
1069 | printk(KERN_NOTICE "\n"); | 1145 | verbose_printk(KERN_NOTICE "\n"); |
1146 | #endif | ||
1070 | } | 1147 | } |
1071 | 1148 | ||
1072 | #ifdef CONFIG_SYS_BFIN_SPINLOCK_L1 | 1149 | #ifdef CONFIG_SYS_BFIN_SPINLOCK_L1 |