/* Poll for a state change, checking for possible
 * modem crashes along the way (so we don't wait
 * forever while the ARM9 is blowing up).
 *
 * Return an error in the event of a modem crash and
 * restart so the msm_proc_comm() routine can restart
 * the operation from the beginning.
 */
static int proc_comm_wait_for(void __iomem *addr, unsigned value)
{
#ifdef CONFIG_PROC_COMM_TIMEOUT_RESET
	unsigned long timeout = TIMEOUT;
#endif

	for (;;) {
		if (readl(addr) == value)
			return 0;

		if (msm_check_for_modem_crash)
			if (msm_check_for_modem_crash())
				return -EAGAIN;
#ifdef CONFIG_PROC_COMM_TIMEOUT_RESET
		udelay(1);
		if (timeout-- == 0) {
			if (msm_hw_reset_hook) {
				pr_err("proc_comm: TIMEOUT. modem has probably "
						"crashed.\n");
				msm_pm_flush_console();
				msm_hw_reset_hook();
			} else {
				pr_err("proc_comm: TIMEOUT. modem has probably "
						"crashed. retrying.\n");
				msm_pm_flush_console();
			}
			timeout = TIMEOUT;
		}
#endif
	}
}
Example #2
0
static void debug_exec(const char *cmd, unsigned *regs)
{
	if (!strcmp(cmd, "pc")) {
		dprintf(" pc %08x cpsr %08x mode %s\n",
			regs[15], regs[16], mode_name(regs[16]));
	} else if (!strcmp(cmd, "regs")) {
		dprintf(" r0 %08x  r1 %08x  r2 %08x  r3 %08x\n",
			regs[0], regs[1], regs[2], regs[3]);
		dprintf(" r4 %08x  r5 %08x  r6 %08x  r7 %08x\n",
			regs[4], regs[5], regs[6], regs[7]);
		dprintf(" r8 %08x  r9 %08x r10 %08x r11 %08x  mode %s\n",
			regs[8], regs[9], regs[10], regs[11],
			mode_name(regs[16]));
		dprintf(" ip %08x  sp %08x  lr %08x  pc %08x  cpsr %08x\n",
			regs[10], regs[13], regs[14], regs[15], regs[16]);
	} else if (!strcmp(cmd, "reboot")) {
		if (msm_hw_reset_hook)
			msm_hw_reset_hook();
	} else if (!strcmp(cmd, "irqs")) {
		dump_irqs();
	} else if (!strcmp(cmd, "kmsg")) {
		dump_kernel_log();
	} else if (!strcmp(cmd, "version")) {
		dprintf("%s\n", linux_banner);
	} else {
		if (debug_busy) {
			dprintf("command processor busy. trying to abort.\n");
			debug_abort = -1;
		} else {
			strcpy(debug_cmd, cmd);
			debug_busy = 1;
		}
		msm_trigger_irq(debug_signal_irq);
		return;
	}
	debug_prompt();
}