Blackfin arch: split apart dump_bfin_regs and merge/remove show_regs from process.c, which was largely duplicated

Signed-off-by: Mike Frysinger <michael.frysinger@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
This commit is contained in:
Mike Frysinger 2007-11-21 16:46:49 +08:00 committed by Bryan Wu
parent 9cb07b23db
commit 49dce9124b
5 changed files with 60 additions and 54 deletions

View 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");

View 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)

View 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,16 +605,28 @@ 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 (!oops_in_progress) {
if (current->pid && current->mm) {
printk(KERN_NOTICE "\n" KERN_NOTICE "CURRENT PROCESS:\n");
printk(KERN_NOTICE "CURRENT PROCESS:\n");
printk(KERN_NOTICE "COMM=%s PID=%d\n",
current->comm, current->pid);
@ -624,15 +640,13 @@ void dump_bfin_regs(struct pt_regs *fp, void *retaddr)
(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();
}
} else
printk(KERN_NOTICE "\n" KERN_NOTICE
"No Valid process in current context\n");
}
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");
}

View 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 */

View 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);