1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30#include <linux/uaccess.h>
31#include <linux/interrupt.h>
32#include <linux/module.h>
33#include <linux/kallsyms.h>
34#include <linux/fs.h>
35#include <asm/traps.h>
36#include <asm/cacheflush.h>
37#include <asm/blackfin.h>
38#include <asm/irq_handler.h>
39#include <asm/trace.h>
40#include <asm/fixed_code.h>
41
42#ifdef CONFIG_KGDB
43# include <linux/debugger.h>
44# include <linux/kgdb.h>
45
46# define CHK_DEBUGGER_TRAP() \
47 do { \
48 CHK_DEBUGGER(trapnr, sig, info.si_code, fp, ); \
49 } while (0)
50# define CHK_DEBUGGER_TRAP_MAYBE() \
51 do { \
52 if (kgdb_connected) \
53 CHK_DEBUGGER_TRAP(); \
54 } while (0)
55#else
56# define CHK_DEBUGGER_TRAP() do { } while (0)
57# define CHK_DEBUGGER_TRAP_MAYBE() do { } while (0)
58#endif
59
60
61void __init trap_init(void)
62{
63 CSYNC();
64 bfin_write_EVT3(trap);
65 CSYNC();
66}
67
68int kstack_depth_to_print = 48;
69
70static void decode_address(char *buf, unsigned long address)
71{
72 struct vm_list_struct *vml;
73 struct task_struct *p;
74 struct mm_struct *mm;
75 unsigned long flags, offset;
76 unsigned int in_exception = bfin_read_IPEND() & 0x10;
77
78#ifdef CONFIG_KALLSYMS
79 unsigned long symsize;
80 const char *symname;
81 char *modname;
82 char *delim = ":";
83 char namebuf[128];
84
85
86 symname = kallsyms_lookup(address, &symsize, &offset, &modname, namebuf);
87
88 if (symname) {
89
90 if (!modname)
91 modname = delim = "";
92 sprintf(buf, "<0x%p> { %s%s%s%s + 0x%lx }",
93 (void *)address, delim, modname, delim, symname,
94 (unsigned long)offset);
95 return;
96
97 }
98#endif
99
100
101 if (address >= FIXED_CODE_START && address < FIXED_CODE_END) {
102 sprintf(buf, "<0x%p> /* Maybe fixed code section */", (void *)address);
103 return;
104 }
105
106
107 if (address < CONFIG_BOOT_LOAD) {
108 sprintf(buf, "<0x%p> /* Maybe null pointer? */", (void *)address);
109 return;
110 }
111
112
113
114
115
116 write_lock_irqsave(&tasklist_lock, flags);
117 for_each_process(p) {
118 mm = (in_exception ? p->mm : get_task_mm(p));
119 if (!mm)
120 continue;
121
122 vml = mm->context.vmlist;
123 while (vml) {
124 struct vm_area_struct *vma = vml->vma;
125
126 if (address >= vma->vm_start && address < vma->vm_end) {
127 char *name = p->comm;
128 struct file *file = vma->vm_file;
129 if (file) {
130 char _tmpbuf[256];
131 name = d_path(file->f_dentry,
132 file->f_vfsmnt,
133 _tmpbuf,
134 sizeof(_tmpbuf));
135 }
136
137
138
139
140 if (current->mm &&
141 (address > current->mm->start_code) &&
142 (address < current->mm->end_code))
143 offset = address - current->mm->start_code;
144 else
145 offset = (address - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT);
146
147 sprintf(buf, "<0x%p> [ %s + 0x%lx ]",
148 (void *)address, name, offset);
149 if (!in_exception)
150 mmput(mm);
151 goto done;
152 }
153
154 vml = vml->next;
155 }
156 if (!in_exception)
157 mmput(mm);
158 }
159
160
161 sprintf(buf, "<0x%p> /* unknown address */", (void *)address);
162
163done:
164 write_unlock_irqrestore(&tasklist_lock, flags);
165}
166
167asmlinkage void double_fault_c(struct pt_regs *fp)
168{
169 console_verbose();
170 oops_in_progress = 1;
171 printk(KERN_EMERG "\n" KERN_EMERG "Double Fault\n");
172 dump_bfin_process(fp);
173 dump_bfin_mem((void *)fp->retx);
174 show_regs(fp);
175 panic("Double Fault - unrecoverable event\n");
176
177}
178
179asmlinkage void trap_c(struct pt_regs *fp)
180{
181#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
182 int j;
183#endif
184 int sig = 0;
185 siginfo_t info;
186 unsigned long trapnr = fp->seqstat & SEQSTAT_EXCAUSE;
187
188 trace_buffer_save(j);
189
190
191
192
193
194
195
196
197
198 if ((bfin_read_IPEND() & 0xFFC0)
199#ifdef CONFIG_KGDB
200 && trapnr != VEC_EXCPT02
201#endif
202 ){
203 console_verbose();
204 oops_in_progress = 1;
205 } else if (current) {
206 if (current->mm == NULL) {
207 console_verbose();
208 oops_in_progress = 1;
209 }
210 }
211
212
213
214
215
216 fp->orig_pc = fp->retx;
217
218
219
220
221 switch (trapnr) {
222
223
224
225
226
227
228
229
230
231
232
233 case VEC_EXCPT01:
234 info.si_code = TRAP_ILLTRAP;
235 sig = SIGTRAP;
236 CHK_DEBUGGER_TRAP_MAYBE();
237
238 if (fp->ipend & 0xffc0)
239 return;
240 else
241 break;
242#ifdef CONFIG_KGDB
243 case VEC_EXCPT02 :
244 info.si_code = TRAP_ILLTRAP;
245 sig = SIGTRAP;
246 CHK_DEBUGGER_TRAP();
247 return;
248#else
249
250#endif
251
252 case VEC_EXCPT03:
253 info.si_code = SEGV_STACKFLOW;
254 sig = SIGSEGV;
255 printk(KERN_NOTICE EXC_0x03(KERN_NOTICE));
256 CHK_DEBUGGER_TRAP();
257 break;
258
259
260
261
262
263
264
265
266
267
268
269
270
271 case VEC_STEP:
272 info.si_code = TRAP_STEP;
273 sig = SIGTRAP;
274 CHK_DEBUGGER_TRAP_MAYBE();
275
276 if (fp->ipend & 0xffc0)
277 return;
278 else
279 break;
280
281 case VEC_OVFLOW:
282 info.si_code = TRAP_TRACEFLOW;
283 sig = SIGTRAP;
284 printk(KERN_NOTICE EXC_0x11(KERN_NOTICE));
285 CHK_DEBUGGER_TRAP();
286 break;
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303 case VEC_UNDEF_I:
304 info.si_code = ILL_ILLOPC;
305 sig = SIGILL;
306 printk(KERN_NOTICE EXC_0x21(KERN_NOTICE));
307 CHK_DEBUGGER_TRAP();
308 break;
309
310 case VEC_ILGAL_I:
311 info.si_code = ILL_ILLPARAOP;
312 sig = SIGILL;
313 printk(KERN_NOTICE EXC_0x22(KERN_NOTICE));
314 CHK_DEBUGGER_TRAP();
315 break;
316
317 case VEC_CPLB_VL:
318 info.si_code = ILL_CPLB_VI;
319 sig = SIGBUS;
320 printk(KERN_NOTICE EXC_0x23(KERN_NOTICE));
321 CHK_DEBUGGER_TRAP();
322 break;
323
324 case VEC_MISALI_D:
325 info.si_code = BUS_ADRALN;
326 sig = SIGBUS;
327 printk(KERN_NOTICE EXC_0x24(KERN_NOTICE));
328 CHK_DEBUGGER_TRAP();
329 break;
330
331 case VEC_UNCOV:
332 info.si_code = ILL_ILLEXCPT;
333 sig = SIGILL;
334 printk(KERN_NOTICE EXC_0x25(KERN_NOTICE));
335 CHK_DEBUGGER_TRAP();
336 break;
337
338
339 case VEC_CPLB_M:
340 info.si_code = BUS_ADRALN;
341 sig = SIGBUS;
342 printk(KERN_NOTICE EXC_0x26(KERN_NOTICE));
343 CHK_DEBUGGER_TRAP();
344 break;
345
346 case VEC_CPLB_MHIT:
347 info.si_code = ILL_CPLB_MULHIT;
348#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
349 sig = SIGSEGV;
350 printk(KERN_NOTICE "NULL pointer access (probably)\n");
351#else
352 sig = SIGILL;
353 printk(KERN_NOTICE EXC_0x27(KERN_NOTICE));
354#endif
355 CHK_DEBUGGER_TRAP();
356 break;
357
358 case VEC_WATCH:
359 info.si_code = TRAP_WATCHPT;
360 sig = SIGTRAP;
361 pr_debug(EXC_0x28(KERN_DEBUG));
362 CHK_DEBUGGER_TRAP_MAYBE();
363
364 if (fp->ipend & 0xffc0)
365 return;
366 else
367 break;
368#ifdef CONFIG_BF535
369
370 case VEC_ISTRU_VL:
371 info.si_code = BUS_OPFETCH;
372 sig = SIGBUS;
373 printk(KERN_NOTICE "BF535: VEC_ISTRU_VL\n");
374 CHK_DEBUGGER_TRAP();
375 break;
376#else
377
378#endif
379
380 case VEC_MISALI_I:
381 info.si_code = BUS_ADRALN;
382 sig = SIGBUS;
383 printk(KERN_NOTICE EXC_0x2A(KERN_NOTICE));
384 CHK_DEBUGGER_TRAP();
385 break;
386
387 case VEC_CPLB_I_VL:
388 info.si_code = ILL_CPLB_VI;
389 sig = SIGBUS;
390 printk(KERN_NOTICE EXC_0x2B(KERN_NOTICE));
391 CHK_DEBUGGER_TRAP();
392 break;
393
394 case VEC_CPLB_I_M:
395 info.si_code = ILL_CPLB_MISS;
396 sig = SIGBUS;
397 printk(KERN_NOTICE EXC_0x2C(KERN_NOTICE));
398 CHK_DEBUGGER_TRAP();
399 break;
400
401 case VEC_CPLB_I_MHIT:
402 info.si_code = ILL_CPLB_MULHIT;
403#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
404 sig = SIGSEGV;
405 printk(KERN_NOTICE "Jump to address 0 - 0x0fff\n");
406#else
407 sig = SIGILL;
408 printk(KERN_NOTICE EXC_0x2D(KERN_NOTICE));
409#endif
410 CHK_DEBUGGER_TRAP();
411 break;
412
413 case VEC_ILL_RES:
414 info.si_code = ILL_PRVOPC;
415 sig = SIGILL;
416 printk(KERN_NOTICE EXC_0x2E(KERN_NOTICE));
417 CHK_DEBUGGER_TRAP();
418 break;
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436 default:
437 info.si_code = TRAP_ILLTRAP;
438 sig = SIGTRAP;
439 printk(KERN_EMERG "Caught Unhandled Exception, code = %08lx\n",
440 (fp->seqstat & SEQSTAT_EXCAUSE));
441 CHK_DEBUGGER_TRAP();
442 break;
443 }
444
445 BUG_ON(sig == 0);
446
447 if (sig != SIGTRAP) {
448 unsigned long stack;
449 dump_bfin_process(fp);
450 dump_bfin_mem((void *)fp->retx);
451 show_regs(fp);
452
453
454#ifndef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE
455 if (trapnr == VEC_CPLB_I_M || trapnr == VEC_CPLB_M)
456 printk(KERN_NOTICE "No trace since you do not have "
457 "CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE enabled\n"
458 KERN_NOTICE "\n");
459 else
460#endif
461 dump_bfin_trace_buffer();
462 show_stack(current, &stack);
463 if (oops_in_progress) {
464#ifndef CONFIG_ACCESS_CHECK
465 printk(KERN_EMERG "Please turn on "
466 "CONFIG_ACCESS_CHECK\n");
467#endif
468 panic("Kernel exception");
469 }
470 }
471
472 info.si_signo = sig;
473 info.si_errno = 0;
474 info.si_addr = (void *)fp->pc;
475 force_sig_info(sig, &info, current);
476
477
478
479
480
481 if (trapnr == VEC_CPLB_I_M && sig != SIGTRAP)
482 fp->pc = SAFE_USER_INSTRUCTION;
483
484 trace_buffer_restore(j);
485 return;
486}
487
488
489
490#define EXPAND_LEN ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN) * 256 - 1)
491
492void dump_bfin_trace_buffer(void)
493{
494#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
495 int tflags, i = 0;
496 char buf[150];
497#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
498 int j, index;
499#endif
500
501 trace_buffer_save(tflags);
502
503 printk(KERN_NOTICE "Hardware Trace:\n");
504
505 if (likely(bfin_read_TBUFSTAT() & TBUFCNT)) {
506 for (; bfin_read_TBUFSTAT() & TBUFCNT; i++) {
507 decode_address(buf, (unsigned long)bfin_read_TBUF());
508 printk(KERN_NOTICE "%4i Target : %s\n", i, buf);
509 decode_address(buf, (unsigned long)bfin_read_TBUF());
510 printk(KERN_NOTICE " Source : %s\n", buf);
511 }
512 }
513
514#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
515 if (trace_buff_offset)
516 index = trace_buff_offset/4 - 1;
517 else
518 index = EXPAND_LEN;
519
520 j = (1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN) * 128;
521 while (j) {
522 decode_address(buf, software_trace_buff[index]);
523 printk(KERN_NOTICE "%4i Target : %s\n", i, buf);
524 index -= 1;
525 if (index < 0 )
526 index = EXPAND_LEN;
527 decode_address(buf, software_trace_buff[index]);
528 printk(KERN_NOTICE " Source : %s\n", buf);
529 index -= 1;
530 if (index < 0)
531 index = EXPAND_LEN;
532 j--;
533 i++;
534 }
535#endif
536
537 trace_buffer_restore(tflags);
538#endif
539}
540EXPORT_SYMBOL(dump_bfin_trace_buffer);
541
542static void show_trace(struct task_struct *tsk, unsigned long *sp)
543{
544 unsigned long addr;
545
546 printk(KERN_NOTICE "\n" KERN_NOTICE "Call Trace:\n");
547
548 while (!kstack_end(sp)) {
549 addr = *sp++;
550
551
552
553
554
555
556
557
558 if (kernel_text_address(addr))
559 print_ip_sym(addr);
560 }
561
562 printk(KERN_NOTICE "\n");
563}
564
565void show_stack(struct task_struct *task, unsigned long *stack)
566{
567 unsigned long *endstack, addr;
568 int i;
569
570
571
572
573
574 if (!stack) {
575 if (task)
576 stack = (unsigned long *)task->thread.ksp;
577 else
578 stack = (unsigned long *)&stack;
579 }
580
581 addr = (unsigned long)stack;
582 endstack = (unsigned long *)PAGE_ALIGN(addr);
583
584 printk(KERN_NOTICE "Stack from %08lx:", (unsigned long)stack);
585 for (i = 0; i < kstack_depth_to_print; i++) {
586 if (stack + 1 > endstack)
587 break;
588 if (i % 8 == 0)
589 printk("\n" KERN_NOTICE " ");
590 printk(" %08lx", *stack++);
591 }
592 printk("\n");
593
594 show_trace(task, stack);
595}
596
597void dump_stack(void)
598{
599 unsigned long stack;
600#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
601 int tflags;
602#endif
603 trace_buffer_save(tflags);
604 dump_bfin_trace_buffer();
605 show_stack(current, &stack);
606 trace_buffer_restore(tflags);
607}
608EXPORT_SYMBOL(dump_stack);
609
610void dump_bfin_process(struct pt_regs *fp)
611{
612
613
614 unsigned int context = bfin_read_IPEND();
615
616 if (oops_in_progress)
617 printk(KERN_EMERG "Kernel OOPS in progress\n");
618
619 if (context & 0x0020)
620 printk(KERN_NOTICE "Deferred excecption or HW Error context\n");
621 else if (context & 0x3FC0)
622 printk(KERN_NOTICE "Interrupt context\n");
623 else if (context & 0x4000)
624 printk(KERN_NOTICE "Deferred Interrupt context\n");
625 else if (context & 0x8000)
626 printk(KERN_NOTICE "Kernel process context\n");
627
628 if (current->pid && current->mm) {
629 printk(KERN_NOTICE "CURRENT PROCESS:\n");
630 printk(KERN_NOTICE "COMM=%s PID=%d\n",
631 current->comm, current->pid);
632
633 printk(KERN_NOTICE "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n"
634 KERN_NOTICE "BSS = 0x%p-0x%p USER-STACK = 0x%p\n"
635 KERN_NOTICE "\n",
636 (void *)current->mm->start_code,
637 (void *)current->mm->end_code,
638 (void *)current->mm->start_data,
639 (void *)current->mm->end_data,
640 (void *)current->mm->end_data,
641 (void *)current->mm->brk,
642 (void *)current->mm->start_stack);
643 } else
644 printk(KERN_NOTICE "\n" KERN_NOTICE
645 "No Valid process in current context\n");
646}
647
648void dump_bfin_mem(void *retaddr)
649{
650
651 if (retaddr >= (void *)FIXED_CODE_START && retaddr < (void *)physical_mem_end
652#if L1_CODE_LENGTH != 0
653
654
655 && !(retaddr >= (void *)L1_CODE_START
656 && retaddr < (void *)(L1_CODE_START + L1_CODE_LENGTH))
657#endif
658 ) {
659 int i = ((unsigned int)retaddr & 0xFFFFFFF0) - 32;
660 unsigned short x = 0;
661 printk(KERN_NOTICE "return address: [0x%p]; contents of:", retaddr);
662 for (; i < ((unsigned int)retaddr & 0xFFFFFFF0) + 32; i += 2) {
663 if (!(i & 0xF))
664 printk("\n" KERN_NOTICE "0x%08x: ", i);
665
666 if (get_user(x, (unsigned short *)i))
667 break;
668#ifndef CONFIG_DEBUG_HWERR
669
670
671
672
673
674 if (oops_in_progress && x >= 0x0040 && x <= 0x0047 && i <= 0)
675 panic("\n\nWARNING : You should reconfigure"
676 " the kernel to turn on\n"
677 " 'Hardware error interrupt"
678 " debugging'\n"
679 " The rest of this error"
680 " is meanless\n");
681#endif
682 if (i == (unsigned int)retaddr)
683 printk("[%04x]", x);
684 else
685 printk(" %04x ", x);
686 }
687 printk("\n");
688 } else
689 printk("\n" KERN_NOTICE
690 "Cannot look at the [PC] <%p> for it is"
691 " in unreadable memory - sorry\n", retaddr);
692}
693
694void show_regs(struct pt_regs *fp)
695{
696 char buf [150];
697
698 printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\n");
699 printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n",
700 (long)fp->seqstat, fp->ipend, fp->syscfg);
701
702 decode_address(buf, fp->rete);
703 printk(KERN_NOTICE " RETE: %s\n", buf);
704 decode_address(buf, fp->retn);
705 printk(KERN_NOTICE " RETN: %s\n", buf);
706 decode_address(buf, fp->retx);
707 printk(KERN_NOTICE " RETX: %s\n", buf);
708 decode_address(buf, fp->rets);
709 printk(KERN_NOTICE " RETS: %s\n", buf);
710 decode_address(buf, fp->pc);
711 printk(KERN_NOTICE " PC: %s\n", buf);
712
713 if ((long)fp->seqstat & SEQSTAT_EXCAUSE) {
714 decode_address(buf, bfin_read_DCPLB_FAULT_ADDR());
715 printk(KERN_NOTICE "DCPLB_FAULT_ADDR: %s\n", buf);
716 decode_address(buf, bfin_read_ICPLB_FAULT_ADDR());
717 printk(KERN_NOTICE "ICPLB_FAULT_ADDR: %s\n", buf);
718 }
719
720 printk(KERN_NOTICE "\n" KERN_NOTICE "PROCESSOR STATE:\n");
721 printk(KERN_NOTICE " R0 : %08lx R1 : %08lx R2 : %08lx R3 : %08lx\n",
722 fp->r0, fp->r1, fp->r2, fp->r3);
723 printk(KERN_NOTICE " R4 : %08lx R5 : %08lx R6 : %08lx R7 : %08lx\n",
724 fp->r4, fp->r5, fp->r6, fp->r7);
725 printk(KERN_NOTICE " P0 : %08lx P1 : %08lx P2 : %08lx P3 : %08lx\n",
726 fp->p0, fp->p1, fp->p2, fp->p3);
727 printk(KERN_NOTICE " P4 : %08lx P5 : %08lx FP : %08lx SP : %08lx\n",
728 fp->p4, fp->p5, fp->fp, (long)fp);
729 printk(KERN_NOTICE " LB0: %08lx LT0: %08lx LC0: %08lx\n",
730 fp->lb0, fp->lt0, fp->lc0);
731 printk(KERN_NOTICE " LB1: %08lx LT1: %08lx LC1: %08lx\n",
732 fp->lb1, fp->lt1, fp->lc1);
733 printk(KERN_NOTICE " B0 : %08lx L0 : %08lx M0 : %08lx I0 : %08lx\n",
734 fp->b0, fp->l0, fp->m0, fp->i0);
735 printk(KERN_NOTICE " B1 : %08lx L1 : %08lx M1 : %08lx I1 : %08lx\n",
736 fp->b1, fp->l1, fp->m1, fp->i1);
737 printk(KERN_NOTICE " B2 : %08lx L2 : %08lx M2 : %08lx I2 : %08lx\n",
738 fp->b2, fp->l2, fp->m2, fp->i2);
739 printk(KERN_NOTICE " B3 : %08lx L3 : %08lx M3 : %08lx I3 : %08lx\n",
740 fp->b3, fp->l3, fp->m3, fp->i3);
741 printk(KERN_NOTICE "A0.w: %08lx A0.x: %08lx A1.w: %08lx A1.x: %08lx\n",
742 fp->a0w, fp->a0x, fp->a1w, fp->a1x);
743
744 printk(KERN_NOTICE "USP : %08lx ASTAT: %08lx\n",
745 rdusp(), fp->astat);
746
747 printk(KERN_NOTICE "\n");
748}
749
750#ifdef CONFIG_SYS_BFIN_SPINLOCK_L1
751asmlinkage int sys_bfin_spinlock(int *spinlock)__attribute__((l1_text));
752#endif
753
754asmlinkage int sys_bfin_spinlock(int *spinlock)
755{
756 int ret = 0;
757 int tmp = 0;
758
759 local_irq_disable();
760 ret = get_user(tmp, spinlock);
761 if (ret == 0) {
762 if (tmp)
763 ret = 1;
764 tmp = 1;
765 put_user(tmp, spinlock);
766 }
767 local_irq_enable();
768 return ret;
769}
770
771int bfin_request_exception(unsigned int exception, void (*handler)(void))
772{
773 void (*curr_handler)(void);
774
775 if (exception > 0x3F)
776 return -EINVAL;
777
778 curr_handler = ex_table[exception];
779
780 if (curr_handler != ex_replaceable)
781 return -EBUSY;
782
783 ex_table[exception] = handler;
784
785 return 0;
786}
787EXPORT_SYMBOL(bfin_request_exception);
788
789int bfin_free_exception(unsigned int exception, void (*handler)(void))
790{
791 void (*curr_handler)(void);
792
793 if (exception > 0x3F)
794 return -EINVAL;
795
796 curr_handler = ex_table[exception];
797
798 if (curr_handler != handler)
799 return -EBUSY;
800
801 ex_table[exception] = ex_replaceable;
802
803 return 0;
804}
805EXPORT_SYMBOL(bfin_free_exception);
806
807void panic_cplb_error(int cplb_panic, struct pt_regs *fp)
808{
809 switch (cplb_panic) {
810 case CPLB_NO_UNLOCKED:
811 printk(KERN_EMERG "All CPLBs are locked\n");
812 break;
813 case CPLB_PROT_VIOL:
814 return;
815 case CPLB_NO_ADDR_MATCH:
816 return;
817 case CPLB_UNKNOWN_ERR:
818 printk(KERN_EMERG "Unknown CPLB Exception\n");
819 break;
820 }
821
822 oops_in_progress = 1;
823
824 printk(KERN_EMERG "DCPLB_FAULT_ADDR=%p\n", (void *)bfin_read_DCPLB_FAULT_ADDR());
825 printk(KERN_EMERG "ICPLB_FAULT_ADDR=%p\n", (void *)bfin_read_ICPLB_FAULT_ADDR());
826 dump_bfin_process(fp);
827 dump_bfin_mem((void *)fp->retx);
828 show_regs(fp);
829 dump_stack();
830 panic("Unrecoverable event\n");
831}
832