fiq_debugger: rename debug->fiq_debugger

Rename variables and functions in the global namespace to avoid
future collisions.

Change-Id: Ic23a304b0f794efc94cc6d086fddd63231d99c98
Signed-off-by: Colin Cross <ccross@android.com>
This commit is contained in:
Colin Cross 2014-04-04 22:58:23 -07:00 committed by John Stultz
parent 4ef006294a
commit cfbb5d4264

View file

@ -124,10 +124,13 @@ module_param_named(console_enable, initial_console_enable, bool, 0644);
module_param_named(kgdb_enable, fiq_kgdb_enable, bool, 0644); module_param_named(kgdb_enable, fiq_kgdb_enable, bool, 0644);
#ifdef CONFIG_FIQ_DEBUGGER_WAKEUP_IRQ_ALWAYS_ON #ifdef CONFIG_FIQ_DEBUGGER_WAKEUP_IRQ_ALWAYS_ON
static inline void enable_wakeup_irq(struct fiq_debugger_state *state) {} static inline
static inline void disable_wakeup_irq(struct fiq_debugger_state *state) {} void fiq_debugger_enable_wakeup_irq(struct fiq_debugger_state *state) {}
static inline
void fiq_debugger_disable_wakeup_irq(struct fiq_debugger_state *state) {}
#else #else
static inline void enable_wakeup_irq(struct fiq_debugger_state *state) static inline
void fiq_debugger_enable_wakeup_irq(struct fiq_debugger_state *state)
{ {
if (state->wakeup_irq < 0) if (state->wakeup_irq < 0)
return; return;
@ -135,7 +138,8 @@ static inline void enable_wakeup_irq(struct fiq_debugger_state *state)
if (!state->wakeup_irq_no_set_wake) if (!state->wakeup_irq_no_set_wake)
enable_irq_wake(state->wakeup_irq); enable_irq_wake(state->wakeup_irq);
} }
static inline void disable_wakeup_irq(struct fiq_debugger_state *state) static inline
void fiq_debugger_disable_wakeup_irq(struct fiq_debugger_state *state)
{ {
if (state->wakeup_irq < 0) if (state->wakeup_irq < 0)
return; return;
@ -145,16 +149,16 @@ static inline void disable_wakeup_irq(struct fiq_debugger_state *state)
} }
#endif #endif
static bool inline debug_have_fiq(struct fiq_debugger_state *state) static inline bool fiq_debugger_have_fiq(struct fiq_debugger_state *state)
{ {
return (state->fiq >= 0); return (state->fiq >= 0);
} }
static void debug_force_irq(struct fiq_debugger_state *state) static void fiq_debugger_force_irq(struct fiq_debugger_state *state)
{ {
unsigned int irq = state->signal_irq; unsigned int irq = state->signal_irq;
if (WARN_ON(!debug_have_fiq(state))) if (WARN_ON(!fiq_debugger_have_fiq(state)))
return; return;
if (state->pdata->force_irq) { if (state->pdata->force_irq) {
state->pdata->force_irq(state->pdev, irq); state->pdata->force_irq(state->pdev, irq);
@ -165,7 +169,7 @@ static void debug_force_irq(struct fiq_debugger_state *state)
} }
} }
static void debug_uart_enable(struct fiq_debugger_state *state) static void fiq_debugger_uart_enable(struct fiq_debugger_state *state)
{ {
if (state->clk) if (state->clk)
clk_enable(state->clk); clk_enable(state->clk);
@ -173,7 +177,7 @@ static void debug_uart_enable(struct fiq_debugger_state *state)
state->pdata->uart_enable(state->pdev); state->pdata->uart_enable(state->pdev);
} }
static void debug_uart_disable(struct fiq_debugger_state *state) static void fiq_debugger_uart_disable(struct fiq_debugger_state *state)
{ {
if (state->pdata->uart_disable) if (state->pdata->uart_disable)
state->pdata->uart_disable(state->pdev); state->pdata->uart_disable(state->pdev);
@ -181,33 +185,33 @@ static void debug_uart_disable(struct fiq_debugger_state *state)
clk_disable(state->clk); clk_disable(state->clk);
} }
static void debug_uart_flush(struct fiq_debugger_state *state) static void fiq_debugger_uart_flush(struct fiq_debugger_state *state)
{ {
if (state->pdata->uart_flush) if (state->pdata->uart_flush)
state->pdata->uart_flush(state->pdev); state->pdata->uart_flush(state->pdev);
} }
static void debug_putc(struct fiq_debugger_state *state, char c) static void fiq_debugger_putc(struct fiq_debugger_state *state, char c)
{ {
state->pdata->uart_putc(state->pdev, c); state->pdata->uart_putc(state->pdev, c);
} }
static void debug_puts(struct fiq_debugger_state *state, char *s) static void fiq_debugger_puts(struct fiq_debugger_state *state, char *s)
{ {
unsigned c; unsigned c;
while ((c = *s++)) { while ((c = *s++)) {
if (c == '\n') if (c == '\n')
debug_putc(state, '\r'); fiq_debugger_putc(state, '\r');
debug_putc(state, c); fiq_debugger_putc(state, c);
} }
} }
static void debug_prompt(struct fiq_debugger_state *state) static void fiq_debugger_prompt(struct fiq_debugger_state *state)
{ {
debug_puts(state, "debug> "); fiq_debugger_puts(state, "debug> ");
} }
static void dump_kernel_log(struct fiq_debugger_state *state) static void fiq_debugger_dump_kernel_log(struct fiq_debugger_state *state)
{ {
char buf[512]; char buf[512];
size_t len; size_t len;
@ -218,7 +222,7 @@ static void dump_kernel_log(struct fiq_debugger_state *state)
while (kmsg_dump_get_line_nolock(&dumper, true, buf, while (kmsg_dump_get_line_nolock(&dumper, true, buf,
sizeof(buf) - 1, &len)) { sizeof(buf) - 1, &len)) {
buf[len] = 0; buf[len] = 0;
debug_puts(state, buf); fiq_debugger_puts(state, buf);
} }
} }
@ -236,7 +240,7 @@ static char *mode_name(unsigned cpsr)
} }
} }
static int debug_printf(void *cookie, const char *fmt, ...) static int fiq_debugger_printf(void *cookie, const char *fmt, ...)
{ {
struct fiq_debugger_state *state = cookie; struct fiq_debugger_state *state = cookie;
char buf[256]; char buf[256];
@ -246,12 +250,12 @@ static int debug_printf(void *cookie, const char *fmt, ...)
vsnprintf(buf, sizeof(buf), fmt, ap); vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap); va_end(ap);
debug_puts(state, buf); fiq_debugger_puts(state, buf);
return state->debug_abort; return state->debug_abort;
} }
/* Safe outside fiq context */ /* Safe outside fiq context */
static int debug_printf_nfiq(void *cookie, const char *fmt, ...) static int fiq_debugger_printf_nfiq(void *cookie, const char *fmt, ...)
{ {
struct fiq_debugger_state *state = cookie; struct fiq_debugger_state *state = cookie;
char buf[256]; char buf[256];
@ -263,29 +267,35 @@ static int debug_printf_nfiq(void *cookie, const char *fmt, ...)
va_end(ap); va_end(ap);
local_irq_save(irq_flags); local_irq_save(irq_flags);
debug_puts(state, buf); fiq_debugger_puts(state, buf);
debug_uart_flush(state); fiq_debugger_uart_flush(state);
local_irq_restore(irq_flags); local_irq_restore(irq_flags);
return state->debug_abort; return state->debug_abort;
} }
static void dump_regs(struct fiq_debugger_state *state, unsigned *regs) static void fiq_debugger_dump_regs(struct fiq_debugger_state *state,
unsigned *regs)
{ {
debug_printf(state, " r0 %08x r1 %08x r2 %08x r3 %08x\n", fiq_debugger_printf(state,
" r0 %08x r1 %08x r2 %08x r3 %08x\n",
regs[0], regs[1], regs[2], regs[3]); regs[0], regs[1], regs[2], regs[3]);
debug_printf(state, " r4 %08x r5 %08x r6 %08x r7 %08x\n", fiq_debugger_printf(state,
" r4 %08x r5 %08x r6 %08x r7 %08x\n",
regs[4], regs[5], regs[6], regs[7]); regs[4], regs[5], regs[6], regs[7]);
debug_printf(state, " r8 %08x r9 %08x r10 %08x r11 %08x mode %s\n", fiq_debugger_printf(state,
" r8 %08x r9 %08x r10 %08x r11 %08x mode %s\n",
regs[8], regs[9], regs[10], regs[11], regs[8], regs[9], regs[10], regs[11],
mode_name(regs[16])); mode_name(regs[16]));
if ((regs[16] & MODE_MASK) == USR_MODE) if ((regs[16] & MODE_MASK) == USR_MODE)
debug_printf(state, " ip %08x sp %08x lr %08x pc %08x " fiq_debugger_printf(state,
"cpsr %08x\n", regs[12], regs[13], regs[14], " ip %08x sp %08x lr %08x pc %08x cpsr %08x\n",
regs[15], regs[16]); regs[12], regs[13], regs[14], regs[15],
regs[16]);
else else
debug_printf(state, " ip %08x sp %08x lr %08x pc %08x " fiq_debugger_printf(state,
"cpsr %08x spsr %08x\n", regs[12], regs[13], " ip %08x sp %08x lr %08x pc %08x cpsr %08x spsr %08x\n",
regs[14], regs[15], regs[16], regs[17]); regs[12], regs[13], regs[14], regs[15],
regs[16], regs[17]);
} }
struct mode_regs { struct mode_regs {
@ -340,38 +350,45 @@ void __naked get_mode_regs(struct mode_regs *regs)
} }
static void dump_allregs(struct fiq_debugger_state *state, unsigned *regs) static void fiq_debugger_dump_allregs(struct fiq_debugger_state *state,
unsigned *regs)
{ {
struct mode_regs mode_regs; struct mode_regs mode_regs;
dump_regs(state, regs); fiq_debugger_dump_regs(state, regs);
get_mode_regs(&mode_regs); get_mode_regs(&mode_regs);
debug_printf(state, " svc: sp %08x lr %08x spsr %08x\n", fiq_debugger_printf(state,
" svc: sp %08x lr %08x spsr %08x\n",
mode_regs.sp_svc, mode_regs.lr_svc, mode_regs.spsr_svc); mode_regs.sp_svc, mode_regs.lr_svc, mode_regs.spsr_svc);
debug_printf(state, " abt: sp %08x lr %08x spsr %08x\n", fiq_debugger_printf(state,
" abt: sp %08x lr %08x spsr %08x\n",
mode_regs.sp_abt, mode_regs.lr_abt, mode_regs.spsr_abt); mode_regs.sp_abt, mode_regs.lr_abt, mode_regs.spsr_abt);
debug_printf(state, " und: sp %08x lr %08x spsr %08x\n", fiq_debugger_printf(state,
" und: sp %08x lr %08x spsr %08x\n",
mode_regs.sp_und, mode_regs.lr_und, mode_regs.spsr_und); mode_regs.sp_und, mode_regs.lr_und, mode_regs.spsr_und);
debug_printf(state, " irq: sp %08x lr %08x spsr %08x\n", fiq_debugger_printf(state,
" irq: sp %08x lr %08x spsr %08x\n",
mode_regs.sp_irq, mode_regs.lr_irq, mode_regs.spsr_irq); mode_regs.sp_irq, mode_regs.lr_irq, mode_regs.spsr_irq);
debug_printf(state, " fiq: r8 %08x r9 %08x r10 %08x r11 %08x " fiq_debugger_printf(state,
"r12 %08x\n", " fiq: r8 %08x r9 %08x r10 %08x r11 %08x r12 %08x\n",
mode_regs.r8_fiq, mode_regs.r9_fiq, mode_regs.r10_fiq, mode_regs.r8_fiq, mode_regs.r9_fiq, mode_regs.r10_fiq,
mode_regs.r11_fiq, mode_regs.r12_fiq); mode_regs.r11_fiq, mode_regs.r12_fiq);
debug_printf(state, " fiq: sp %08x lr %08x spsr %08x\n", fiq_debugger_printf(state,
" fiq: sp %08x lr %08x spsr %08x\n",
mode_regs.sp_fiq, mode_regs.lr_fiq, mode_regs.spsr_fiq); mode_regs.sp_fiq, mode_regs.lr_fiq, mode_regs.spsr_fiq);
} }
static void dump_irqs(struct fiq_debugger_state *state) static void fiq_debugger_dump_irqs(struct fiq_debugger_state *state)
{ {
int n; int n;
struct irq_desc *desc; struct irq_desc *desc;
debug_printf(state, "irqnr total since-last status name\n"); fiq_debugger_printf(state,
"irqnr total since-last status name\n");
for_each_irq_desc(n, desc) { for_each_irq_desc(n, desc) {
struct irqaction *act = desc->action; struct irqaction *act = desc->action;
if (!act && !kstat_irqs(n)) if (!act && !kstat_irqs(n))
continue; continue;
debug_printf(state, "%5d: %10u %11u %8x %s\n", n, fiq_debugger_printf(state, "%5d: %10u %11u %8x %s\n", n,
kstat_irqs(n), kstat_irqs(n),
kstat_irqs(n) - state->last_irqs[n], kstat_irqs(n) - state->last_irqs[n],
desc->status_use_accessors, desc->status_use_accessors,
@ -390,14 +407,14 @@ static int report_trace(struct stackframe *frame, void *d)
struct stacktrace_state *sts = d; struct stacktrace_state *sts = d;
if (sts->depth) { if (sts->depth) {
debug_printf(sts->state, fiq_debugger_printf(sts->state,
" pc: %p (%pF), lr %p (%pF), sp %p, fp %p\n", " pc: %p (%pF), lr %p (%pF), sp %p, fp %p\n",
frame->pc, frame->pc, frame->lr, frame->lr, frame->pc, frame->pc, frame->lr, frame->lr,
frame->sp, frame->fp); frame->sp, frame->fp);
sts->depth--; sts->depth--;
return 0; return 0;
} }
debug_printf(sts->state, " ...\n"); fiq_debugger_printf(sts->state, " ...\n");
return sts->depth == 0; return sts->depth == 0;
} }
@ -415,16 +432,17 @@ static struct frame_tail *user_backtrace(struct fiq_debugger_state *state,
/* Also check accessibility of one struct frame_tail beyond */ /* Also check accessibility of one struct frame_tail beyond */
if (!access_ok(VERIFY_READ, tail, sizeof(buftail))) { if (!access_ok(VERIFY_READ, tail, sizeof(buftail))) {
debug_printf(state, " invalid frame pointer %p\n", tail); fiq_debugger_printf(state, " invalid frame pointer %p\n",
tail);
return NULL; return NULL;
} }
if (__copy_from_user_inatomic(buftail, tail, sizeof(buftail))) { if (__copy_from_user_inatomic(buftail, tail, sizeof(buftail))) {
debug_printf(state, fiq_debugger_printf(state,
" failed to copy frame pointer %p\n", tail); " failed to copy frame pointer %p\n", tail);
return NULL; return NULL;
} }
debug_printf(state, " %p\n", buftail[0].lr); fiq_debugger_printf(state, " %p\n", buftail[0].lr);
/* frame pointers should strictly progress back up the stack /* frame pointers should strictly progress back up the stack
* (towards higher addresses) */ * (towards higher addresses) */
@ -434,7 +452,7 @@ static struct frame_tail *user_backtrace(struct fiq_debugger_state *state,
return buftail[0].fp-1; return buftail[0].fp-1;
} }
void dump_stacktrace(struct fiq_debugger_state *state, void fiq_debugger_dump_stacktrace(struct fiq_debugger_state *state,
struct pt_regs * const regs, unsigned int depth, void *ssp) struct pt_regs * const regs, unsigned int depth, void *ssp)
{ {
struct frame_tail *tail; struct frame_tail *tail;
@ -446,11 +464,11 @@ void dump_stacktrace(struct fiq_debugger_state *state,
*current_thread_info() = *real_thread_info; *current_thread_info() = *real_thread_info;
if (!current) if (!current)
debug_printf(state, "current NULL\n"); fiq_debugger_printf(state, "current NULL\n");
else else
debug_printf(state, "pid: %d comm: %s\n", fiq_debugger_printf(state, "pid: %d comm: %s\n",
current->pid, current->comm); current->pid, current->comm);
dump_regs(state, (unsigned *)regs); fiq_debugger_dump_regs(state, (unsigned *)regs);
if (!user_mode(regs)) { if (!user_mode(regs)) {
struct stackframe frame; struct stackframe frame;
@ -458,7 +476,7 @@ void dump_stacktrace(struct fiq_debugger_state *state,
frame.sp = regs->ARM_sp; frame.sp = regs->ARM_sp;
frame.lr = regs->ARM_lr; frame.lr = regs->ARM_lr;
frame.pc = regs->ARM_pc; frame.pc = regs->ARM_pc;
debug_printf(state, fiq_debugger_printf(state,
" pc: %p (%pF), lr %p (%pF), sp %p, fp %p\n", " pc: %p (%pF), lr %p (%pF), sp %p, fp %p\n",
regs->ARM_pc, regs->ARM_pc, regs->ARM_lr, regs->ARM_lr, regs->ARM_pc, regs->ARM_pc, regs->ARM_lr, regs->ARM_lr,
regs->ARM_sp, regs->ARM_fp); regs->ARM_sp, regs->ARM_fp);
@ -471,84 +489,86 @@ void dump_stacktrace(struct fiq_debugger_state *state,
tail = user_backtrace(state, tail); tail = user_backtrace(state, tail);
} }
static void do_ps(struct fiq_debugger_state *state) static void fiq_debugger_do_ps(struct fiq_debugger_state *state)
{ {
struct task_struct *g; struct task_struct *g;
struct task_struct *p; struct task_struct *p;
unsigned task_state; unsigned task_state;
static const char stat_nam[] = "RSDTtZX"; static const char stat_nam[] = "RSDTtZX";
debug_printf(state, "pid ppid prio task pc\n"); fiq_debugger_printf(state, "pid ppid prio task pc\n");
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
do_each_thread(g, p) { do_each_thread(g, p) {
task_state = p->state ? __ffs(p->state) + 1 : 0; task_state = p->state ? __ffs(p->state) + 1 : 0;
debug_printf(state, fiq_debugger_printf(state,
"%5d %5d %4d ", p->pid, p->parent->pid, p->prio); "%5d %5d %4d ", p->pid, p->parent->pid, p->prio);
debug_printf(state, "%-13.13s %c", p->comm, fiq_debugger_printf(state, "%-13.13s %c", p->comm,
task_state >= sizeof(stat_nam) ? '?' : stat_nam[task_state]); task_state >= sizeof(stat_nam) ? '?' : stat_nam[task_state]);
if (task_state == TASK_RUNNING) if (task_state == TASK_RUNNING)
debug_printf(state, " running\n"); fiq_debugger_printf(state, " running\n");
else else
debug_printf(state, " %08lx\n", thread_saved_pc(p)); fiq_debugger_printf(state, " %08lx\n",
thread_saved_pc(p));
} while_each_thread(g, p); } while_each_thread(g, p);
read_unlock(&tasklist_lock); read_unlock(&tasklist_lock);
} }
#ifdef CONFIG_FIQ_DEBUGGER_CONSOLE #ifdef CONFIG_FIQ_DEBUGGER_CONSOLE
static void begin_syslog_dump(struct fiq_debugger_state *state) static void fiq_debugger_begin_syslog_dump(struct fiq_debugger_state *state)
{ {
state->syslog_dumping = true; state->syslog_dumping = true;
} }
static void end_syslog_dump(struct fiq_debugger_state *state) static void fiq_debugger_end_syslog_dump(struct fiq_debugger_state *state)
{ {
state->syslog_dumping = false; state->syslog_dumping = false;
} }
#else #else
extern int do_syslog(int type, char __user *bug, int count); extern int do_syslog(int type, char __user *bug, int count);
static void begin_syslog_dump(struct fiq_debugger_state *state) static void fiq_debugger_begin_syslog_dump(struct fiq_debugger_state *state)
{ {
do_syslog(5 /* clear */, NULL, 0); do_syslog(5 /* clear */, NULL, 0);
} }
static void end_syslog_dump(struct fiq_debugger_state *state) static void fiq_debugger_end_syslog_dump(struct fiq_debugger_state *state)
{ {
dump_kernel_log(state); fiq_debugger_dump_kernel_log(state);
} }
#endif #endif
static void do_sysrq(struct fiq_debugger_state *state, char rq) static void fiq_debugger_do_sysrq(struct fiq_debugger_state *state, char rq)
{ {
if ((rq == 'g' || rq == 'G') && !fiq_kgdb_enable) { if ((rq == 'g' || rq == 'G') && !fiq_kgdb_enable) {
debug_printf(state, "sysrq-g blocked\n"); fiq_debugger_printf(state, "sysrq-g blocked\n");
return; return;
} }
begin_syslog_dump(state); fiq_debugger_begin_syslog_dump(state);
handle_sysrq(rq); handle_sysrq(rq);
end_syslog_dump(state); fiq_debugger_end_syslog_dump(state);
} }
#ifdef CONFIG_KGDB #ifdef CONFIG_KGDB
static void do_kgdb(struct fiq_debugger_state *state) static void fiq_debugger_do_kgdb(struct fiq_debugger_state *state)
{ {
if (!fiq_kgdb_enable) { if (!fiq_kgdb_enable) {
debug_printf(state, "kgdb through fiq debugger not enabled\n"); fiq_debugger_printf(state, "kgdb through fiq debugger not enabled\n");
return; return;
} }
debug_printf(state, "enabling console and triggering kgdb\n"); fiq_debugger_printf(state, "enabling console and triggering kgdb\n");
state->console_enable = true; state->console_enable = true;
handle_sysrq('g'); handle_sysrq('g');
} }
#endif #endif
static void debug_schedule_work(struct fiq_debugger_state *state, char *cmd) static void fiq_debugger_schedule_work(struct fiq_debugger_state *state,
char *cmd)
{ {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&state->work_lock, flags); spin_lock_irqsave(&state->work_lock, flags);
if (state->work_cmd[0] != '\0') { if (state->work_cmd[0] != '\0') {
debug_printf(state, "work command processor busy\n"); fiq_debugger_printf(state, "work command processor busy\n");
spin_unlock_irqrestore(&state->work_lock, flags); spin_unlock_irqrestore(&state->work_lock, flags);
return; return;
} }
@ -559,7 +579,7 @@ static void debug_schedule_work(struct fiq_debugger_state *state, char *cmd)
schedule_work(&state->work); schedule_work(&state->work);
} }
static void debug_work(struct work_struct *work) static void fiq_debugger_work(struct work_struct *work)
{ {
struct fiq_debugger_state *state; struct fiq_debugger_state *state;
char work_cmd[DEBUG_MAX]; char work_cmd[DEBUG_MAX];
@ -585,30 +605,32 @@ static void debug_work(struct work_struct *work)
else else
kernel_restart(NULL); kernel_restart(NULL);
} else { } else {
debug_printf(state, "unknown work command '%s'\n", work_cmd); fiq_debugger_printf(state, "unknown work command '%s'\n",
work_cmd);
} }
} }
/* This function CANNOT be called in FIQ context */ /* This function CANNOT be called in FIQ context */
static void debug_irq_exec(struct fiq_debugger_state *state, char *cmd) static void fiq_debugger_irq_exec(struct fiq_debugger_state *state, char *cmd)
{ {
if (!strcmp(cmd, "ps")) if (!strcmp(cmd, "ps"))
do_ps(state); fiq_debugger_do_ps(state);
if (!strcmp(cmd, "sysrq")) if (!strcmp(cmd, "sysrq"))
do_sysrq(state, 'h'); fiq_debugger_do_sysrq(state, 'h');
if (!strncmp(cmd, "sysrq ", 6)) if (!strncmp(cmd, "sysrq ", 6))
do_sysrq(state, cmd[6]); fiq_debugger_do_sysrq(state, cmd[6]);
#ifdef CONFIG_KGDB #ifdef CONFIG_KGDB
if (!strcmp(cmd, "kgdb")) if (!strcmp(cmd, "kgdb"))
do_kgdb(state); fiq_debugger_do_kgdb(state);
#endif #endif
if (!strncmp(cmd, "reboot", 6)) if (!strncmp(cmd, "reboot", 6))
debug_schedule_work(state, cmd); fiq_debugger_schedule_work(state, cmd);
} }
static void debug_help(struct fiq_debugger_state *state) static void fiq_debugger_help(struct fiq_debugger_state *state)
{ {
debug_printf(state, "FIQ Debugger commands:\n" fiq_debugger_printf(state,
"FIQ Debugger commands:\n"
" pc PC status\n" " pc PC status\n"
" regs Register dump\n" " regs Register dump\n"
" allregs Extended Register dump\n" " allregs Extended Register dump\n"
@ -618,20 +640,23 @@ static void debug_help(struct fiq_debugger_state *state)
" irqs Interupt status\n" " irqs Interupt status\n"
" kmsg Kernel log\n" " kmsg Kernel log\n"
" version Kernel version\n"); " version Kernel version\n");
debug_printf(state, " sleep Allow sleep while in FIQ\n" fiq_debugger_printf(state,
" sleep Allow sleep while in FIQ\n"
" nosleep Disable sleep while in FIQ\n" " nosleep Disable sleep while in FIQ\n"
" console Switch terminal to console\n" " console Switch terminal to console\n"
" cpu Current CPU\n" " cpu Current CPU\n"
" cpu <number> Switch to CPU<number>\n"); " cpu <number> Switch to CPU<number>\n");
debug_printf(state, " ps Process list\n" fiq_debugger_printf(state,
" ps Process list\n"
" sysrq sysrq options\n" " sysrq sysrq options\n"
" sysrq <param> Execute sysrq with <param>\n"); " sysrq <param> Execute sysrq with <param>\n");
#ifdef CONFIG_KGDB #ifdef CONFIG_KGDB
debug_printf(state, " kgdb Enter kernel debugger\n"); fiq_debugger_printf(state,
" kgdb Enter kernel debugger\n");
#endif #endif
} }
static void take_affinity(void *info) static void fiq_debugger_take_affinity(void *info)
{ {
struct fiq_debugger_state *state = info; struct fiq_debugger_state *state = info;
struct cpumask cpumask; struct cpumask cpumask;
@ -642,29 +667,31 @@ static void take_affinity(void *info)
irq_set_affinity(state->uart_irq, &cpumask); irq_set_affinity(state->uart_irq, &cpumask);
} }
static void switch_cpu(struct fiq_debugger_state *state, int cpu) static void fiq_debugger_switch_cpu(struct fiq_debugger_state *state, int cpu)
{ {
if (!debug_have_fiq(state)) if (!fiq_debugger_have_fiq(state))
smp_call_function_single(cpu, take_affinity, state, false); smp_call_function_single(cpu, fiq_debugger_take_affinity, state,
false);
state->current_cpu = cpu; state->current_cpu = cpu;
} }
static bool debug_fiq_exec(struct fiq_debugger_state *state, static bool fiq_debugger_fiq_exec(struct fiq_debugger_state *state,
const char *cmd, unsigned *regs, void *svc_sp) const char *cmd, unsigned *regs, void *svc_sp)
{ {
bool signal_helper = false; bool signal_helper = false;
if (!strcmp(cmd, "help") || !strcmp(cmd, "?")) { if (!strcmp(cmd, "help") || !strcmp(cmd, "?")) {
debug_help(state); fiq_debugger_help(state);
} else if (!strcmp(cmd, "pc")) { } else if (!strcmp(cmd, "pc")) {
debug_printf(state, " pc %08x cpsr %08x mode %s\n", fiq_debugger_printf(state, " pc %08x cpsr %08x mode %s\n",
regs[15], regs[16], mode_name(regs[16])); regs[15], regs[16], mode_name(regs[16]));
} else if (!strcmp(cmd, "regs")) { } else if (!strcmp(cmd, "regs")) {
dump_regs(state, regs); fiq_debugger_dump_regs(state, regs);
} else if (!strcmp(cmd, "allregs")) { } else if (!strcmp(cmd, "allregs")) {
dump_allregs(state, regs); fiq_debugger_dump_allregs(state, regs);
} else if (!strcmp(cmd, "bt")) { } else if (!strcmp(cmd, "bt")) {
dump_stacktrace(state, (struct pt_regs *)regs, 100, svc_sp); fiq_debugger_dump_stacktrace(state, (struct pt_regs *)regs, 100,
svc_sp);
} else if (!strncmp(cmd, "reset", 5)) { } else if (!strncmp(cmd, "reset", 5)) {
cmd += 5; cmd += 5;
while (*cmd == ' ') while (*cmd == ' ')
@ -677,33 +704,33 @@ static bool debug_fiq_exec(struct fiq_debugger_state *state,
machine_restart(NULL); machine_restart(NULL);
} }
} else if (!strcmp(cmd, "irqs")) { } else if (!strcmp(cmd, "irqs")) {
dump_irqs(state); fiq_debugger_dump_irqs(state);
} else if (!strcmp(cmd, "kmsg")) { } else if (!strcmp(cmd, "kmsg")) {
dump_kernel_log(state); fiq_debugger_dump_kernel_log(state);
} else if (!strcmp(cmd, "version")) { } else if (!strcmp(cmd, "version")) {
debug_printf(state, "%s\n", linux_banner); fiq_debugger_printf(state, "%s\n", linux_banner);
} else if (!strcmp(cmd, "sleep")) { } else if (!strcmp(cmd, "sleep")) {
state->no_sleep = false; state->no_sleep = false;
debug_printf(state, "enabling sleep\n"); fiq_debugger_printf(state, "enabling sleep\n");
} else if (!strcmp(cmd, "nosleep")) { } else if (!strcmp(cmd, "nosleep")) {
state->no_sleep = true; state->no_sleep = true;
debug_printf(state, "disabling sleep\n"); fiq_debugger_printf(state, "disabling sleep\n");
} else if (!strcmp(cmd, "console")) { } else if (!strcmp(cmd, "console")) {
debug_printf(state, "console mode\n"); fiq_debugger_printf(state, "console mode\n");
debug_uart_flush(state); fiq_debugger_uart_flush(state);
state->console_enable = true; state->console_enable = true;
} else if (!strcmp(cmd, "cpu")) { } else if (!strcmp(cmd, "cpu")) {
debug_printf(state, "cpu %d\n", state->current_cpu); fiq_debugger_printf(state, "cpu %d\n", state->current_cpu);
} else if (!strncmp(cmd, "cpu ", 4)) { } else if (!strncmp(cmd, "cpu ", 4)) {
unsigned long cpu = 0; unsigned long cpu = 0;
if (strict_strtoul(cmd + 4, 10, &cpu) == 0) if (strict_strtoul(cmd + 4, 10, &cpu) == 0)
switch_cpu(state, cpu); fiq_debugger_switch_cpu(state, cpu);
else else
debug_printf(state, "invalid cpu\n"); fiq_debugger_printf(state, "invalid cpu\n");
debug_printf(state, "cpu %d\n", state->current_cpu); fiq_debugger_printf(state, "cpu %d\n", state->current_cpu);
} else { } else {
if (state->debug_busy) { if (state->debug_busy) {
debug_printf(state, fiq_debugger_printf(state,
"command processor busy. trying to abort.\n"); "command processor busy. trying to abort.\n");
state->debug_abort = -1; state->debug_abort = -1;
} else { } else {
@ -714,12 +741,12 @@ static bool debug_fiq_exec(struct fiq_debugger_state *state,
return true; return true;
} }
if (!state->console_enable) if (!state->console_enable)
debug_prompt(state); fiq_debugger_prompt(state);
return signal_helper; return signal_helper;
} }
static void sleep_timer_expired(unsigned long data) static void fiq_debugger_sleep_timer_expired(unsigned long data)
{ {
struct fiq_debugger_state *state = (struct fiq_debugger_state *)data; struct fiq_debugger_state *state = (struct fiq_debugger_state *)data;
unsigned long flags; unsigned long flags;
@ -728,18 +755,19 @@ static void sleep_timer_expired(unsigned long data)
if (state->uart_enabled && !state->no_sleep) { if (state->uart_enabled && !state->no_sleep) {
if (state->debug_enable && !state->console_enable) { if (state->debug_enable && !state->console_enable) {
state->debug_enable = false; state->debug_enable = false;
debug_printf_nfiq(state, "suspending fiq debugger\n"); fiq_debugger_printf_nfiq(state,
"suspending fiq debugger\n");
} }
state->ignore_next_wakeup_irq = true; state->ignore_next_wakeup_irq = true;
debug_uart_disable(state); fiq_debugger_uart_disable(state);
state->uart_enabled = false; state->uart_enabled = false;
enable_wakeup_irq(state); fiq_debugger_enable_wakeup_irq(state);
} }
wake_unlock(&state->debugger_wake_lock); wake_unlock(&state->debugger_wake_lock);
spin_unlock_irqrestore(&state->sleep_timer_lock, flags); spin_unlock_irqrestore(&state->sleep_timer_lock, flags);
} }
static void handle_wakeup(struct fiq_debugger_state *state) static void fiq_debugger_handle_wakeup(struct fiq_debugger_state *state)
{ {
unsigned long flags; unsigned long flags;
@ -748,26 +776,27 @@ static void handle_wakeup(struct fiq_debugger_state *state)
state->ignore_next_wakeup_irq = false; state->ignore_next_wakeup_irq = false;
} else if (!state->uart_enabled) { } else if (!state->uart_enabled) {
wake_lock(&state->debugger_wake_lock); wake_lock(&state->debugger_wake_lock);
debug_uart_enable(state); fiq_debugger_uart_enable(state);
state->uart_enabled = true; state->uart_enabled = true;
disable_wakeup_irq(state); fiq_debugger_disable_wakeup_irq(state);
mod_timer(&state->sleep_timer, jiffies + HZ / 2); mod_timer(&state->sleep_timer, jiffies + HZ / 2);
} }
spin_unlock_irqrestore(&state->sleep_timer_lock, flags); spin_unlock_irqrestore(&state->sleep_timer_lock, flags);
} }
static irqreturn_t wakeup_irq_handler(int irq, void *dev) static irqreturn_t fiq_debugger_wakeup_irq_handler(int irq, void *dev)
{ {
struct fiq_debugger_state *state = dev; struct fiq_debugger_state *state = dev;
if (!state->no_sleep) if (!state->no_sleep)
debug_puts(state, "WAKEUP\n"); fiq_debugger_puts(state, "WAKEUP\n");
handle_wakeup(state); fiq_debugger_handle_wakeup(state);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static void debug_handle_console_irq_context(struct fiq_debugger_state *state) static
void fiq_debugger_handle_console_irq_context(struct fiq_debugger_state *state)
{ {
#if defined(CONFIG_FIQ_DEBUGGER_CONSOLE) #if defined(CONFIG_FIQ_DEBUGGER_CONSOLE)
if (state->tty_port.ops) { if (state->tty_port.ops) {
@ -784,7 +813,7 @@ static void debug_handle_console_irq_context(struct fiq_debugger_state *state)
#endif #endif
} }
static void debug_handle_irq_context(struct fiq_debugger_state *state) static void fiq_debugger_handle_irq_context(struct fiq_debugger_state *state)
{ {
if (!state->no_sleep) { if (!state->no_sleep) {
unsigned long flags; unsigned long flags;
@ -794,22 +823,22 @@ static void debug_handle_irq_context(struct fiq_debugger_state *state)
mod_timer(&state->sleep_timer, jiffies + HZ * 5); mod_timer(&state->sleep_timer, jiffies + HZ * 5);
spin_unlock_irqrestore(&state->sleep_timer_lock, flags); spin_unlock_irqrestore(&state->sleep_timer_lock, flags);
} }
debug_handle_console_irq_context(state); fiq_debugger_handle_console_irq_context(state);
if (state->debug_busy) { if (state->debug_busy) {
debug_irq_exec(state, state->debug_cmd); fiq_debugger_irq_exec(state, state->debug_cmd);
if (!state->console_enable) if (!state->console_enable)
debug_prompt(state); fiq_debugger_prompt(state);
state->debug_busy = 0; state->debug_busy = 0;
} }
} }
static int debug_getc(struct fiq_debugger_state *state) static int fiq_debugger_getc(struct fiq_debugger_state *state)
{ {
return state->pdata->uart_getc(state->pdev); return state->pdata->uart_getc(state->pdev);
} }
static bool debug_handle_uart_interrupt(struct fiq_debugger_state *state, static bool fiq_debugger_handle_uart_interrupt(struct fiq_debugger_state *state,
int this_cpu, void *regs, void *svc_sp) int this_cpu, struct pt_regs *regs, void *svc_sp)
{ {
int c; int c;
static int last_c; static int last_c;
@ -824,30 +853,31 @@ static bool debug_handle_uart_interrupt(struct fiq_debugger_state *state,
MAX_UNHANDLED_FIQ_COUNT) MAX_UNHANDLED_FIQ_COUNT)
return false; return false;
debug_printf(state, "fiq_debugger: cpu %d not responding, " fiq_debugger_printf(state,
"fiq_debugger: cpu %d not responding, "
"reverting to cpu %d\n", state->current_cpu, "reverting to cpu %d\n", state->current_cpu,
this_cpu); this_cpu);
atomic_set(&state->unhandled_fiq_count, 0); atomic_set(&state->unhandled_fiq_count, 0);
switch_cpu(state, this_cpu); fiq_debugger_switch_cpu(state, this_cpu);
return false; return false;
} }
state->in_fiq = true; state->in_fiq = true;
while ((c = debug_getc(state)) != FIQ_DEBUGGER_NO_CHAR) { while ((c = fiq_debugger_getc(state)) != FIQ_DEBUGGER_NO_CHAR) {
count++; count++;
if (!state->debug_enable) { if (!state->debug_enable) {
if ((c == 13) || (c == 10)) { if ((c == 13) || (c == 10)) {
state->debug_enable = true; state->debug_enable = true;
state->debug_count = 0; state->debug_count = 0;
debug_prompt(state); fiq_debugger_prompt(state);
} }
} else if (c == FIQ_DEBUGGER_BREAK) { } else if (c == FIQ_DEBUGGER_BREAK) {
state->console_enable = false; state->console_enable = false;
debug_puts(state, "fiq debugger mode\n"); fiq_debugger_puts(state, "fiq debugger mode\n");
state->debug_count = 0; state->debug_count = 0;
debug_prompt(state); fiq_debugger_prompt(state);
#ifdef CONFIG_FIQ_DEBUGGER_CONSOLE #ifdef CONFIG_FIQ_DEBUGGER_CONSOLE
} else if (state->console_enable && state->tty_rbuf) { } else if (state->console_enable && state->tty_rbuf) {
fiq_debugger_ringbuf_push(state->tty_rbuf, c); fiq_debugger_ringbuf_push(state->tty_rbuf, c);
@ -856,34 +886,35 @@ static bool debug_handle_uart_interrupt(struct fiq_debugger_state *state,
} else if ((c >= ' ') && (c < 127)) { } else if ((c >= ' ') && (c < 127)) {
if (state->debug_count < (DEBUG_MAX - 1)) { if (state->debug_count < (DEBUG_MAX - 1)) {
state->debug_buf[state->debug_count++] = c; state->debug_buf[state->debug_count++] = c;
debug_putc(state, c); fiq_debugger_putc(state, c);
} }
} else if ((c == 8) || (c == 127)) { } else if ((c == 8) || (c == 127)) {
if (state->debug_count > 0) { if (state->debug_count > 0) {
state->debug_count--; state->debug_count--;
debug_putc(state, 8); fiq_debugger_putc(state, 8);
debug_putc(state, ' '); fiq_debugger_putc(state, ' ');
debug_putc(state, 8); fiq_debugger_putc(state, 8);
} }
} else if ((c == 13) || (c == 10)) { } else if ((c == 13) || (c == 10)) {
if (c == '\r' || (c == '\n' && last_c != '\r')) { if (c == '\r' || (c == '\n' && last_c != '\r')) {
debug_putc(state, '\r'); fiq_debugger_putc(state, '\r');
debug_putc(state, '\n'); fiq_debugger_putc(state, '\n');
} }
if (state->debug_count) { if (state->debug_count) {
state->debug_buf[state->debug_count] = 0; state->debug_buf[state->debug_count] = 0;
state->debug_count = 0; state->debug_count = 0;
signal_helper |= signal_helper |=
debug_fiq_exec(state, state->debug_buf, fiq_debugger_fiq_exec(state,
regs, svc_sp); state->debug_buf,
regs, svc_sp);
} else { } else {
debug_prompt(state); fiq_debugger_prompt(state);
} }
} }
last_c = c; last_c = c;
} }
if (!state->console_enable) if (!state->console_enable)
debug_uart_flush(state); fiq_debugger_uart_flush(state);
if (state->pdata->fiq_ack) if (state->pdata->fiq_ack)
state->pdata->fiq_ack(state->pdev, state->fiq); state->pdata->fiq_ack(state->pdev, state->fiq);
@ -897,16 +928,18 @@ static bool debug_handle_uart_interrupt(struct fiq_debugger_state *state,
return signal_helper; return signal_helper;
} }
static void debug_fiq(struct fiq_glue_handler *h, void *regs, void *svc_sp) static void fiq_debugger_fiq(struct fiq_glue_handler *h, void *regs,
void *svc_sp)
{ {
struct fiq_debugger_state *state = struct fiq_debugger_state *state =
container_of(h, struct fiq_debugger_state, handler); container_of(h, struct fiq_debugger_state, handler);
unsigned int this_cpu = THREAD_INFO(svc_sp)->cpu; unsigned int this_cpu = THREAD_INFO(svc_sp)->cpu;
bool need_irq; bool need_irq;
need_irq = debug_handle_uart_interrupt(state, this_cpu, regs, svc_sp); need_irq = fiq_debugger_handle_uart_interrupt(state, this_cpu, regs,
svc_sp);
if (need_irq) if (need_irq)
debug_force_irq(state); fiq_debugger_force_irq(state);
} }
/* /*
@ -914,19 +947,19 @@ static void debug_fiq(struct fiq_glue_handler *h, void *regs, void *svc_sp)
* This just effectively takes over the UART interrupt and does all the work * This just effectively takes over the UART interrupt and does all the work
* in this context. * in this context.
*/ */
static irqreturn_t debug_uart_irq(int irq, void *dev) static irqreturn_t fiq_debugger_uart_irq(int irq, void *dev)
{ {
struct fiq_debugger_state *state = dev; struct fiq_debugger_state *state = dev;
bool not_done; bool not_done;
handle_wakeup(state); fiq_debugger_handle_wakeup(state);
/* handle the debugger irq in regular context */ /* handle the debugger irq in regular context */
not_done = debug_handle_uart_interrupt(state, smp_processor_id(), not_done = fiq_debugger_handle_uart_interrupt(state, smp_processor_id(),
get_irq_regs(), get_irq_regs(),
current_thread_info()); current_thread_info());
if (not_done) if (not_done)
debug_handle_irq_context(state); fiq_debugger_handle_irq_context(state);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
@ -936,19 +969,19 @@ static irqreturn_t debug_uart_irq(int irq, void *dev)
* FIQ handler does what it can and then signals this interrupt to finish the * FIQ handler does what it can and then signals this interrupt to finish the
* job in irq context. * job in irq context.
*/ */
static irqreturn_t debug_signal_irq(int irq, void *dev) static irqreturn_t fiq_debugger_signal_irq(int irq, void *dev)
{ {
struct fiq_debugger_state *state = dev; struct fiq_debugger_state *state = dev;
if (state->pdata->force_irq_ack) if (state->pdata->force_irq_ack)
state->pdata->force_irq_ack(state->pdev, state->signal_irq); state->pdata->force_irq_ack(state->pdev, state->signal_irq);
debug_handle_irq_context(state); fiq_debugger_handle_irq_context(state);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static void debug_resume(struct fiq_glue_handler *h) static void fiq_debugger_resume(struct fiq_glue_handler *h)
{ {
struct fiq_debugger_state *state = struct fiq_debugger_state *state =
container_of(h, struct fiq_debugger_state, handler); container_of(h, struct fiq_debugger_state, handler);
@ -957,13 +990,13 @@ static void debug_resume(struct fiq_glue_handler *h)
} }
#if defined(CONFIG_FIQ_DEBUGGER_CONSOLE) #if defined(CONFIG_FIQ_DEBUGGER_CONSOLE)
struct tty_driver *debug_console_device(struct console *co, int *index) struct tty_driver *fiq_debugger_console_device(struct console *co, int *index)
{ {
*index = co->index; *index = co->index;
return fiq_tty_driver; return fiq_tty_driver;
} }
static void debug_console_write(struct console *co, static void fiq_debugger_console_write(struct console *co,
const char *s, unsigned int count) const char *s, unsigned int count)
{ {
struct fiq_debugger_state *state; struct fiq_debugger_state *state;
@ -974,22 +1007,22 @@ static void debug_console_write(struct console *co,
if (!state->console_enable && !state->syslog_dumping) if (!state->console_enable && !state->syslog_dumping)
return; return;
debug_uart_enable(state); fiq_debugger_uart_enable(state);
spin_lock_irqsave(&state->console_lock, flags); spin_lock_irqsave(&state->console_lock, flags);
while (count--) { while (count--) {
if (*s == '\n') if (*s == '\n')
debug_putc(state, '\r'); fiq_debugger_putc(state, '\r');
debug_putc(state, *s++); fiq_debugger_putc(state, *s++);
} }
debug_uart_flush(state); fiq_debugger_uart_flush(state);
spin_unlock_irqrestore(&state->console_lock, flags); spin_unlock_irqrestore(&state->console_lock, flags);
debug_uart_disable(state); fiq_debugger_uart_disable(state);
} }
static struct console fiq_debugger_console = { static struct console fiq_debugger_console = {
.name = "ttyFIQ", .name = "ttyFIQ",
.device = debug_console_device, .device = fiq_debugger_console_device,
.write = debug_console_write, .write = fiq_debugger_console_write,
.flags = CON_PRINTBUFFER | CON_ANYTIME | CON_ENABLED, .flags = CON_PRINTBUFFER | CON_ANYTIME | CON_ENABLED,
}; };
@ -1017,12 +1050,12 @@ int fiq_tty_write(struct tty_struct *tty, const unsigned char *buf, int count)
if (!state->console_enable) if (!state->console_enable)
return count; return count;
debug_uart_enable(state); fiq_debugger_uart_enable(state);
spin_lock_irq(&state->console_lock); spin_lock_irq(&state->console_lock);
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
debug_putc(state, *buf++); fiq_debugger_putc(state, *buf++);
spin_unlock_irq(&state->console_lock); spin_unlock_irq(&state->console_lock);
debug_uart_disable(state); fiq_debugger_uart_disable(state);
return count; return count;
} }
@ -1044,19 +1077,19 @@ static int fiq_tty_poll_get_char(struct tty_driver *driver, int line)
struct fiq_debugger_state *state = states[line]; struct fiq_debugger_state *state = states[line];
int c = NO_POLL_CHAR; int c = NO_POLL_CHAR;
debug_uart_enable(state); fiq_debugger_uart_enable(state);
if (debug_have_fiq(state)) { if (fiq_debugger_have_fiq(state)) {
int count = fiq_debugger_ringbuf_level(state->tty_rbuf); int count = fiq_debugger_ringbuf_level(state->tty_rbuf);
if (count > 0) { if (count > 0) {
c = fiq_debugger_ringbuf_peek(state->tty_rbuf, 0); c = fiq_debugger_ringbuf_peek(state->tty_rbuf, 0);
fiq_debugger_ringbuf_consume(state->tty_rbuf, 1); fiq_debugger_ringbuf_consume(state->tty_rbuf, 1);
} }
} else { } else {
c = debug_getc(state); c = fiq_debugger_getc(state);
if (c == FIQ_DEBUGGER_NO_CHAR) if (c == FIQ_DEBUGGER_NO_CHAR)
c = NO_POLL_CHAR; c = NO_POLL_CHAR;
} }
debug_uart_disable(state); fiq_debugger_uart_disable(state);
return c; return c;
} }
@ -1065,9 +1098,9 @@ static void fiq_tty_poll_put_char(struct tty_driver *driver, int line, char ch)
{ {
struct fiq_debugger_state **states = driver->driver_state; struct fiq_debugger_state **states = driver->driver_state;
struct fiq_debugger_state *state = states[line]; struct fiq_debugger_state *state = states[line];
debug_uart_enable(state); fiq_debugger_uart_enable(state);
debug_putc(state, ch); fiq_debugger_putc(state, ch);
debug_uart_disable(state); fiq_debugger_uart_disable(state);
} }
#endif #endif
@ -1224,7 +1257,7 @@ static int fiq_debugger_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
state = kzalloc(sizeof(*state), GFP_KERNEL); state = kzalloc(sizeof(*state), GFP_KERNEL);
setup_timer(&state->sleep_timer, sleep_timer_expired, setup_timer(&state->sleep_timer, fiq_debugger_sleep_timer_expired,
(unsigned long)state); (unsigned long)state);
state->pdata = pdata; state->pdata = pdata;
state->pdev = pdev; state->pdev = pdev;
@ -1237,14 +1270,14 @@ static int fiq_debugger_probe(struct platform_device *pdev)
state->signal_irq = platform_get_irq_byname(pdev, "signal"); state->signal_irq = platform_get_irq_byname(pdev, "signal");
state->wakeup_irq = platform_get_irq_byname(pdev, "wakeup"); state->wakeup_irq = platform_get_irq_byname(pdev, "wakeup");
INIT_WORK(&state->work, debug_work); INIT_WORK(&state->work, fiq_debugger_work);
spin_lock_init(&state->work_lock); spin_lock_init(&state->work_lock);
platform_set_drvdata(pdev, state); platform_set_drvdata(pdev, state);
spin_lock_init(&state->sleep_timer_lock); spin_lock_init(&state->sleep_timer_lock);
if (state->wakeup_irq < 0 && debug_have_fiq(state)) if (state->wakeup_irq < 0 && fiq_debugger_have_fiq(state))
state->no_sleep = true; state->no_sleep = true;
state->ignore_next_wakeup_irq = !state->no_sleep; state->ignore_next_wakeup_irq = !state->no_sleep;
@ -1268,12 +1301,13 @@ static int fiq_debugger_probe(struct platform_device *pdev)
goto err_uart_init; goto err_uart_init;
} }
debug_printf_nfiq(state, "<hit enter %sto activate fiq debugger>\n", fiq_debugger_printf_nfiq(state,
"<hit enter %sto activate fiq debugger>\n",
state->no_sleep ? "" : "twice "); state->no_sleep ? "" : "twice ");
if (debug_have_fiq(state)) { if (fiq_debugger_have_fiq(state)) {
state->handler.fiq = debug_fiq; state->handler.fiq = fiq_debugger_fiq;
state->handler.resume = debug_resume; state->handler.resume = fiq_debugger_resume;
ret = fiq_glue_register_handler(&state->handler); ret = fiq_glue_register_handler(&state->handler);
if (ret) { if (ret) {
pr_err("%s: could not install fiq handler\n", __func__); pr_err("%s: could not install fiq handler\n", __func__);
@ -1282,7 +1316,7 @@ static int fiq_debugger_probe(struct platform_device *pdev)
pdata->fiq_enable(pdev, state->fiq, 1); pdata->fiq_enable(pdev, state->fiq, 1);
} else { } else {
ret = request_irq(state->uart_irq, debug_uart_irq, ret = request_irq(state->uart_irq, fiq_debugger_uart_irq,
IRQF_NO_SUSPEND, "debug", state); IRQF_NO_SUSPEND, "debug", state);
if (ret) { if (ret) {
pr_err("%s: could not install irq handler\n", __func__); pr_err("%s: could not install irq handler\n", __func__);
@ -1299,14 +1333,15 @@ static int fiq_debugger_probe(struct platform_device *pdev)
clk_disable(state->clk); clk_disable(state->clk);
if (state->signal_irq >= 0) { if (state->signal_irq >= 0) {
ret = request_irq(state->signal_irq, debug_signal_irq, ret = request_irq(state->signal_irq, fiq_debugger_signal_irq,
IRQF_TRIGGER_RISING, "debug-signal", state); IRQF_TRIGGER_RISING, "debug-signal", state);
if (ret) if (ret)
pr_err("serial_debugger: could not install signal_irq"); pr_err("serial_debugger: could not install signal_irq");
} }
if (state->wakeup_irq >= 0) { if (state->wakeup_irq >= 0) {
ret = request_irq(state->wakeup_irq, wakeup_irq_handler, ret = request_irq(state->wakeup_irq,
fiq_debugger_wakeup_irq_handler,
IRQF_TRIGGER_FALLING | IRQF_DISABLED, IRQF_TRIGGER_FALLING | IRQF_DISABLED,
"debug-wakeup", state); "debug-wakeup", state);
if (ret) { if (ret) {
@ -1323,7 +1358,7 @@ static int fiq_debugger_probe(struct platform_device *pdev)
} }
} }
if (state->no_sleep) if (state->no_sleep)
handle_wakeup(state); fiq_debugger_handle_wakeup(state);
#if defined(CONFIG_FIQ_DEBUGGER_CONSOLE) #if defined(CONFIG_FIQ_DEBUGGER_CONSOLE)
spin_lock_init(&state->console_lock); spin_lock_init(&state->console_lock);