int mtk_wdt_confirm_hwreboot(void) { //aee need confirm wd can hw reboot //printk("mtk_wdt_probe : Initialize to dual mode \n"); unsigned int tmp=0; aee_sram_fiq_log("mt6582 only hw reboot mode ++\n"); mtk_wdt_restart(WD_TYPE_NOLOCK);//restart spm wdt //set rgu 20s time out tmp = (unsigned int)(20 * ( 1 << 6) ); tmp = tmp << 5; *(volatile u32 *)(MTK_WDT_LENGTH)= (tmp | MTK_WDT_LENGTH_KEY); //restart rgu wdt *(volatile u32 *)( MTK_WDT_RESTART) =MTK_WDT_RESTART_KEY ; //use only hw reboot mode and enable rgu wdt tmp = DRV_Reg32(MTK_WDT_MODE); tmp |=MTK_WDT_MODE_KEY ; tmp &=(~(MTK_WDT_MODE_IRQ | MTK_WDT_MODE_DUAL_MODE)); tmp |=MTK_WDT_MODE_ENABLE ; *(volatile u32 *)(MTK_WDT_MODE)=tmp; aee_sram_fiq_log("mt6582 only hw reboot mode --\n"); return 0; }
static inline void aee_print_ip_sym(unsigned long ip) { char buf[256]; snprintf(buf, sizeof(buf), "[<%p>] %pS\n", (void *)ip, (void *)ip); aee_sram_fiq_log(buf); }
static void print_error_msg(int len) { static char error_msg[][50] = { "Bottom unaligned", "Bottom out of kernel addr", "Top out of kernel addr", "Buf len not enough" }; int tmp = (-len) - 1; aee_sram_fiq_log(error_msg[tmp]); }
int aee_nested_printf(const char *fmt, ...) { va_list args; static int total_len; va_start(args, fmt); total_len += vsnprintf(nested_panic_buf, sizeof(nested_panic_buf), fmt, args); va_end(args); aee_sram_fiq_log(nested_panic_buf); return total_len; }
void mt_irq_dump(void) { int cpu_id; int count = 2; char str[128]; /* aee_wdt_printf("GICD_ISENABLER0 = 0x%x, GICD_ISPENDR0 = 0x%x, GICD_ISACTIVER0 = 0x%x\n", *(volatile u32 *)(GIC_DIST_BASE + 0x100), *(volatile u32 *)(GIC_DIST_BASE + 0x200), *(volatile u32 *)(GIC_DIST_BASE + 0x300)); */ aee_sram_fiq_log("dump other cpu pc\n"); while(count > 0) { for(cpu_id = 1; cpu_id < NR_CPUS; cpu_id++) { sprintf(str, "cpu-%d pc=0x%08x\n", cpu_id, mt_get_cpu_pc(cpu_id)); aee_sram_fiq_log(str); } count--; udelay(10); } }
void aee_dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) { struct stackframe frame; const register unsigned long current_sp asm("sp"); pr_debug("%s(regs = %p tsk = %p)\n", __func__, regs, tsk); if (!tsk) tsk = current; if (regs) { frame.fp = regs->regs[29]; frame.sp = regs->sp; frame.pc = regs->pc; } else if (tsk == current) { frame.fp = (unsigned long)__builtin_frame_address(0); frame.sp = current_sp; frame.pc = (unsigned long)aee_dump_backtrace; } else { /* * task blocked in __switch_to */ frame.fp = thread_saved_fp(tsk); frame.sp = thread_saved_sp(tsk); frame.pc = thread_saved_pc(tsk); } aee_sram_fiq_log("Call trace:\n"); while (1) { unsigned long where = frame.pc; int ret; ret = unwind_frame(&frame); if (ret < 0) break; dump_backtrace_entry(where, frame.sp); } }