]> err.no Git - linux-2.6/commitdiff
Blackfin arch: split apart dump_bfin_regs and merge/remove show_regs from process...
authorMike Frysinger <michael.frysinger@analog.com>
Wed, 21 Nov 2007 08:46:49 +0000 (16:46 +0800)
committerBryan Wu <bryan.wu@analog.com>
Wed, 21 Nov 2007 08:46:49 +0000 (16:46 +0800)
Signed-off-by: Mike Frysinger <michael.frysinger@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
arch/blackfin/kernel/early_printk.c
arch/blackfin/kernel/process.c
arch/blackfin/kernel/traps.c
arch/blackfin/mach-common/irqpanic.c
include/asm-blackfin/bfin-global.h

index 6ec518a81113c2571df593dd6fe6f2e08c7a24ec..724f4a5a1d46b3339bdc9047750eb7dffc3e7470 100644 (file)
@@ -205,7 +205,8 @@ asmlinkage void __init early_trap_c(struct pt_regs *fp, void *retaddr)
        if (likely(early_console == NULL))
                setup_early_printk(DEFAULT_EARLY_PORT);
 
-       dump_bfin_regs(fp, retaddr);
+       dump_bfin_mem((void *)fp->retx);
+       show_regs(fp);
        dump_bfin_trace_buffer();
 
        panic("Died early");
index 1a8cf3364e92fd87b508e8158acb04736283da2b..5bf15125f0d6064fa14f6e5ce4b6cccd4847cd59 100644 (file)
@@ -134,27 +134,6 @@ void cpu_idle(void)
        }
 }
 
-void show_regs(struct pt_regs *regs)
-{
-       printk(KERN_NOTICE "\n");
-       printk(KERN_NOTICE
-              "PC: %08lu  Status: %04lu  SysStatus: %04lu  RETS: %08lu\n",
-              regs->pc, regs->astat, regs->seqstat, regs->rets);
-       printk(KERN_NOTICE
-              "A0.x: %08lx  A0.w: %08lx  A1.x: %08lx  A1.w: %08lx\n",
-              regs->a0x, regs->a0w, regs->a1x, regs->a1w);
-       printk(KERN_NOTICE "P0: %08lx  P1: %08lx  P2: %08lx  P3: %08lx\n",
-              regs->p0, regs->p1, regs->p2, regs->p3);
-       printk(KERN_NOTICE "P4: %08lx  P5: %08lx\n", regs->p4, regs->p5);
-       printk(KERN_NOTICE "R0: %08lx  R1: %08lx  R2: %08lx  R3: %08lx\n",
-              regs->r0, regs->r1, regs->r2, regs->r3);
-       printk(KERN_NOTICE "R4: %08lx  R5: %08lx  R6: %08lx  R7: %08lx\n",
-              regs->r4, regs->r5, regs->r6, regs->r7);
-
-       if (!regs->ipend)
-               printk(KERN_NOTICE "USP: %08lx\n", rdusp());
-}
-
 /* Fill in the fpu structure for a core dump.  */
 
 int dump_fpu(struct pt_regs *regs, elf_fpregset_t * fpregs)
index 910cdd43fe60e6eca52bc135a2ea85a0d3ca8ede..21a55ef19cbd3d89fe8213a6f1ba442156584178 100644 (file)
@@ -169,7 +169,9 @@ asmlinkage void double_fault_c(struct pt_regs *fp)
        console_verbose();
        oops_in_progress = 1;
        printk(KERN_EMERG "\n" KERN_EMERG "Double Fault\n");
-       dump_bfin_regs(fp, (void *)fp->retx);
+       dump_bfin_process(fp);
+       dump_bfin_mem((void *)fp->retx);
+       show_regs(fp);
        panic("Double Fault - unrecoverable event\n");
 
 }
@@ -444,7 +446,9 @@ asmlinkage void trap_c(struct pt_regs *fp)
 
        if (sig != SIGTRAP) {
                unsigned long stack;
-               dump_bfin_regs(fp, (void *)fp->retx);
+               dump_bfin_process(fp);
+               dump_bfin_mem((void *)fp->retx);
+               show_regs(fp);
 
                /* Print out the trace buffer if it makes sense */
 #ifndef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE
@@ -601,38 +605,48 @@ void dump_stack(void)
        show_stack(current, &stack);
        trace_buffer_restore(tflags);
 }
-
 EXPORT_SYMBOL(dump_stack);
 
-void dump_bfin_regs(struct pt_regs *fp, void *retaddr)
+void dump_bfin_process(struct pt_regs *fp)
 {
-       char buf [150];
+       /* We should be able to look at fp->ipend, but we don't push it on the
+        * stack all the time, so do this until we fix that */
+       unsigned int context = bfin_read_IPEND();
+
+       if (oops_in_progress)
+               printk(KERN_EMERG "Kernel OOPS in progress\n");
+
+       if (context & 0x0020)
+               printk(KERN_NOTICE "Deferred excecption or HW Error context\n");
+       else if (context & 0x3FC0)
+               printk(KERN_NOTICE "Interrupt context\n");
+       else if (context & 0x4000)
+               printk(KERN_NOTICE "Deferred Interrupt context\n");
+       else if (context & 0x8000)
+               printk(KERN_NOTICE "Kernel process context\n");
+
+       if (current->pid && current->mm) {
+               printk(KERN_NOTICE "CURRENT PROCESS:\n");
+               printk(KERN_NOTICE "COMM=%s PID=%d\n",
+                       current->comm, current->pid);
+
+               printk(KERN_NOTICE "TEXT = 0x%p-0x%p  DATA = 0x%p-0x%p\n"
+                       KERN_NOTICE "BSS = 0x%p-0x%p   USER-STACK = 0x%p\n"
+                       KERN_NOTICE "\n",
+                       (void *)current->mm->start_code,
+                       (void *)current->mm->end_code,
+                       (void *)current->mm->start_data,
+                       (void *)current->mm->end_data,
+                       (void *)current->mm->end_data,
+                       (void *)current->mm->brk,
+                       (void *)current->mm->start_stack);
+       } else
+               printk(KERN_NOTICE "\n" KERN_NOTICE
+                    "No Valid process in current context\n");
+}
 
-       if (!oops_in_progress) {
-               if (current->pid && current->mm) {
-                       printk(KERN_NOTICE "\n" KERN_NOTICE "CURRENT PROCESS:\n");
-                       printk(KERN_NOTICE "COMM=%s PID=%d\n",
-                               current->comm, current->pid);
-
-                       printk(KERN_NOTICE "TEXT = 0x%p-0x%p  DATA = 0x%p-0x%p\n"
-                               KERN_NOTICE "BSS = 0x%p-0x%p   USER-STACK = 0x%p\n"
-                               KERN_NOTICE "\n",
-                               (void *)current->mm->start_code,
-                               (void *)current->mm->end_code,
-                               (void *)current->mm->start_data,
-                               (void *)current->mm->end_data,
-                               (void *)current->mm->end_data,
-                               (void *)current->mm->brk,
-                               (void *)current->mm->start_stack);
-               } else {
-                       printk (KERN_NOTICE "\n" KERN_NOTICE
-                            "No Valid pid - Either things are really messed up,"
-                            " or you are in the kernel\n");
-               }
-       } else {
-               printk(KERN_NOTICE "Kernel or interrupt exception\n");
-               print_modules();
-       }
+void dump_bfin_mem(void *retaddr)
+{
 
        if (retaddr >= (void *)FIXED_CODE_START  && retaddr < (void *)physical_mem_end
 #if L1_CODE_LENGTH != 0
@@ -675,6 +689,11 @@ void dump_bfin_regs(struct pt_regs *fp, void *retaddr)
                printk("\n" KERN_NOTICE
                        "Cannot look at the [PC] <%p> for it is"
                        " in unreadable memory - sorry\n", retaddr);
+}
+
+void show_regs(struct pt_regs *fp)
+{
+       char buf [150];
 
        printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\n");
        printk(KERN_NOTICE " SEQSTAT: %08lx  IPEND: %04lx  SYSCFG: %04lx\n",
@@ -688,6 +707,8 @@ void dump_bfin_regs(struct pt_regs *fp, void *retaddr)
        printk(KERN_NOTICE " RETX: %s\n", buf);
        decode_address(buf, fp->rets);
        printk(KERN_NOTICE " RETS: %s\n", buf);
+       decode_address(buf, fp->pc);
+       printk(KERN_NOTICE " PC: %s\n", buf);
 
        if ((long)fp->seqstat & SEQSTAT_EXCAUSE) {
                decode_address(buf, bfin_read_DCPLB_FAULT_ADDR());
@@ -802,7 +823,9 @@ void panic_cplb_error(int cplb_panic, struct pt_regs *fp)
 
        printk(KERN_EMERG "DCPLB_FAULT_ADDR=%p\n", (void *)bfin_read_DCPLB_FAULT_ADDR());
        printk(KERN_EMERG "ICPLB_FAULT_ADDR=%p\n", (void *)bfin_read_ICPLB_FAULT_ADDR());
-       dump_bfin_regs(fp, (void *)fp->retx);
+       dump_bfin_process(fp);
+       dump_bfin_mem((void *)fp->retx);
+       show_regs(fp);
        dump_stack();
        panic("Unrecoverable event\n");
 }
index d62c2e277d7b6e444954c4fb7756a7f19b816e7b..b22959b197e5c3e3d0643c19653092fa93238072 100644 (file)
@@ -173,7 +173,9 @@ asmlinkage void irq_panic(int reason, struct pt_regs *regs)
        }
 
        regs->ipend = bfin_read_IPEND();
-       dump_bfin_regs(regs, (void *)regs->pc);
+       dump_bfin_process(regs);
+       dump_bfin_mem((void *)regs->pc);
+       show_regs(regs);
        if (0 == (info.si_signo = sig) || 0 == user_mode(regs)) /* in kernelspace */
                panic("Unhandled IRQ or exceptions!\n");
        else {                  /* in userspace */
index 6ef501b35df01d1be0964f935f35942ace4d4ab7..39bdd86871cf1bd496262cb55dc1cc06511fbe59 100644 (file)
@@ -50,7 +50,8 @@ extern unsigned long get_sclk(void);
 extern unsigned long sclk_to_usecs(unsigned long sclk);
 extern unsigned long usecs_to_sclk(unsigned long usecs);
 
-extern void dump_bfin_regs(struct pt_regs *fp, void *retaddr);
+extern void dump_bfin_process(struct pt_regs *regs);
+extern void dump_bfin_mem(void *retaddr);
 extern void dump_bfin_trace_buffer(void);
 
 extern int init_arch_irq(void);