static void smsm_state_cb_hdlr(void *data, uint32_t old_state, uint32_t new_state) { char *smem_reset_reason; char buffer[MAX_BUF_SIZE]; unsigned smem_reset_size; unsigned size; int i, rc; u8 val; riva_crash = true; pr_err("%s: smsm state changed\n", MODULE_NAME); for (i = 0; i < ARRAY_SIZE(pmic_reg_dump); i++) { val = 0; rc = pm8xxx_read_register(pmic_reg_dump[i].reg_addr, &val); if (rc) pr_err("PMIC READ: Failed to read addr = %d\n", pmic_reg_dump[i].reg_addr); else pr_err("PMIC READ: addr = %x, value = %x\n", pmic_reg_dump[i].reg_addr, val); } if (!(new_state & SMSM_RESET)) return; if (ss_restart_inprogress) { pr_err("%s: Ignoring smsm reset req, restart in progress\n", MODULE_NAME); return; } if (!enable_riva_ssr) panic(MODULE_NAME ": SMSM reset request received from Riva"); smem_reset_reason = smem_get_entry(SMEM_SSR_REASON_WCNSS0, &smem_reset_size); if (!smem_reset_reason || !smem_reset_size) { pr_err("%s: wcnss subsystem failure reason: %s\n", __func__, "(unknown, smem_get_entry failed)"); } else if (!smem_reset_reason[0]) { pr_err("%s: wcnss subsystem failure reason: %s\n", __func__, "(unknown, init string found)"); } else { size = smem_reset_size < MAX_BUF_SIZE ? smem_reset_size : (MAX_BUF_SIZE - 1); memcpy(buffer, smem_reset_reason, size); buffer[size] = '\0'; pr_err("%s: wcnss subsystem failure reason: %s\n", __func__, buffer); memset(smem_reset_reason, 0, smem_reset_size); wmb(); } ss_restart_inprogress = true; subsystem_restart_dev(riva_8960_dev); }
static void modem_fatal_fn(struct work_struct *work) { u32 modem_state; u32 panic_smsm_states = SMSM_RESET | SMSM_SYSTEM_DOWNLOAD; u32 reset_smsm_states = SMSM_SYSTEM_REBOOT_USR | SMSM_SYSTEM_PWRDWN_USR; struct modem_data *drv; drv = container_of(work, struct modem_data, fatal_work); pr_err("Watchdog bite received from modem!\n"); modem_state = smsm_get_state(SMSM_MODEM_STATE); pr_err("Modem SMSM state = 0x%x!\n", modem_state); if (modem_state == 0 || modem_state & panic_smsm_states) { subsystem_restart_dev(drv->subsys); enable_irq(drv->irq); } else if (modem_state & reset_smsm_states) { pr_err("User-invoked system reset/powerdown."); kernel_restart(NULL); } else { unsigned long timeout = msecs_to_jiffies(6000); pr_err("Modem AHB locked up. Trying to free up modem!\n"); writel_relaxed(0x3, drv->cbase + MSS_MODEM_RESET); /* * If we are still alive (allowing for the 5 second * delayed-panic-reboot), the modem is either still wedged or * SMSM didn't come through. Force panic in that case. */ schedule_delayed_work(&drv->unlock_work, timeout); } }
static int modem_debug_set(void *data, u64 val) { if (val == 1) subsystem_restart_dev(modem_8960_dev); return 0; }
void cnss_device_crashed(void) { if (penv && penv->subsys) { subsys_set_crash_status(penv->subsys, true); subsystem_restart_dev(penv->subsys); } }
static void q6_fatal_fn(struct work_struct *work) { struct q6v3_data *drv = container_of(work, struct q6v3_data, fatal_wrk); pr_err("Watchdog bite received from Q6!\n"); subsystem_restart_dev(drv->subsys); }
static irqreturn_t riva_wdog_bite_irq_hdlr(int irq, void *dev_id) { riva_crash = true; if (ss_restart_inprogress) { pr_err("%s: Ignoring riva bite irq, restart in progress\n", MODULE_NAME); return IRQ_HANDLED; } if (!enable_riva_ssr) { if((inactive == system_flag) || (normalreboot == system_flag) || (adloadmode == system_flag) ||(poweroff == system_flag)) system_flag = rivafatal; #ifdef CONFIG_CCI_KLOG *powerpt = (POWERONOFFRECORD + system_flag); *unknowflag = 0; *backupcrashflag = 0; set_warmboot(); #ifdef CCI_KLOG_ALLOW_FORCE_PANIC __raw_writel(CONFIG_WARMBOOT_CRASH, restart_reason); #else __raw_writel(CONFIG_WARMBOOT_NORMAL, restart_reason); *backupcrashflag = CONFIG_WARMBOOT_CRASH; #endif #endif mb(); panic(MODULE_NAME ": Watchdog bite received from Riva"); } ss_restart_inprogress = true; subsystem_restart_dev(riva_8960_dev); return IRQ_HANDLED; }
static irqreturn_t mdm_errfatal(int irq, void *dev_id) { pr_debug("%s: mdm got errfatal interrupt\n", __func__); if (mdm_drv->mdm_ready && (gpio_get_value(mdm_drv->mdm2ap_status_gpio) == 1)) { pr_info("%s: Reseting the mdm due to an errfatal\n", __func__); mdm_drv->mdm_ready = 0; subsystem_restart_dev(mdm_subsys_dev); } return IRQ_HANDLED; }
static void restart_modem(struct modem_data *drv) { #ifdef FEATURE_LGE_MODEM_DEBUG_INFO modem_debug.modem_ssr_level = subsys_get_restart_level(drv->subsys); #endif log_modem_sfr(); drv->ignore_errors = true; subsystem_restart_dev(drv->subsys); }
static void smsm_state_cb_hdlr(void *data, uint32_t old_state, uint32_t new_state) { char *smem_reset_reason; char buffer[MAX_BUF_SIZE]; unsigned smem_reset_size; unsigned size; riva_crash = true; pr_err("%s: smsm state changed\n", MODULE_NAME); wcnss_riva_dump_pmic_regs(); if (!(new_state & SMSM_RESET)) return; if (ss_restart_inprogress) { pr_err("%s: Ignoring smsm reset req, restart in progress\n", MODULE_NAME); return; } if (!enable_riva_ssr){ #if defined(CONFIG_LGE_HANDLE_PANIC) lge_set_magic_for_subsystem("riva"); msm_set_restart_mode(0x6d632130); #endif panic(MODULE_NAME ": SMSM reset request received from Riva"); } smem_reset_reason = smem_get_entry(SMEM_SSR_REASON_WCNSS0, &smem_reset_size); if (!smem_reset_reason || !smem_reset_size) { pr_err("%s: wcnss subsystem failure reason: %s\n", __func__, "(unknown, smem_get_entry failed)"); } else if (!smem_reset_reason[0]) { pr_err("%s: wcnss subsystem failure reason: %s\n", __func__, "(unknown, init string found)"); } else { size = smem_reset_size < MAX_BUF_SIZE ? smem_reset_size : (MAX_BUF_SIZE - 1); memcpy(buffer, smem_reset_reason, size); buffer[size] = '\0'; pr_err("%s: wcnss subsystem failure reason: %s\n", __func__, buffer); memset(smem_reset_reason, 0, smem_reset_size); wmb(); } ss_restart_inprogress = true; subsystem_restart_dev(riva_8960_dev); }
static void dsps_restart_handler(struct dsps_data *drv) { pr_debug("%s: Restart lvl %d\n", __func__, get_restart_level()); if (atomic_add_return(1, &drv->crash_in_progress) > 1) { pr_err("%s: DSPS already resetting. Count %d\n", __func__, atomic_read(&drv->crash_in_progress)); } else { subsystem_restart_dev(drv->subsys); } }
static void smsm_state_cb_hdlr(void *data, uint32_t old_state, uint32_t new_state) { char *smem_reset_reason; char buffer[MAX_BUF_SIZE]; unsigned smem_reset_size; unsigned size; riva_crash = true; pr_err("%s: smsm state changed\n", MODULE_NAME); if (!(new_state & SMSM_RESET)) return; if (ss_restart_inprogress) { pr_err("%s: Ignoring smsm reset req, restart in progress\n", MODULE_NAME); return; } if (!enable_riva_ssr) panic(MODULE_NAME ": SMSM reset request received from Riva"); smem_reset_reason = smem_get_entry(SMEM_SSR_REASON_WCNSS0, &smem_reset_size); if (!smem_reset_reason || !smem_reset_size) { pr_err("%s: wcnss subsystem failure reason: %s\n", __func__, "(unknown, smem_get_entry failed)"); } else if (!smem_reset_reason[0]) { pr_err("%s: wcnss subsystem failure reason: %s\n", __func__, "(unknown, init string found)"); } else { size = smem_reset_size < MAX_BUF_SIZE ? smem_reset_size : (MAX_BUF_SIZE - 1); memcpy(buffer, smem_reset_reason, size); buffer[size] = '\0'; pr_err("%s: wcnss subsystem failure reason: %s\n", __func__, buffer); #ifdef CONFIG_RAMDUMP_TAGS rdtags_add_tag("ssr_reason", buffer, strnlen(buffer, MAX_BUF_SIZE - 1) + 1); #endif memset(smem_reset_reason, 0, smem_reset_size); wmb(); } ss_restart_inprogress = true; subsystem_restart_dev(riva_8960_dev); }
static int modem_notif_handler(struct notifier_block *nb, unsigned long code, void *p) { struct modem_data *drv = container_of(nb, struct modem_data, notifier); if (code == MODEM_NOTIFIER_START_RESET) { if (drv->ignore_smsm_ack) { drv->ignore_smsm_ack = 0; } else { pr_err("Modem error fatal'ed."); subsystem_restart_dev(drv->subsys); } } return NOTIFY_DONE; }
static void modem_unlock_timeout(struct work_struct *work) { struct modem_data *drv; struct delayed_work *dwork = to_delayed_work(work); pr_crit("Timeout waiting for modem to unlock.\n"); drv = container_of(dwork, struct modem_data, unlock_work); /* The unlock didn't work, clear the reset */ writel_relaxed(0x0, drv->cbase + MSS_MODEM_RESET); mb(); subsystem_restart_dev(drv->subsys); enable_irq(drv->irq); }
static irqreturn_t mdm_errfatal(int irq, void *dev_id) { pr_debug("%s: mdm got errfatal interrupt\n", __func__); if (mdm_drv->mdm_ready && (gpio_get_value(mdm_drv->mdm2ap_status_gpio) == 1)) { pr_info("%s: Reseting the mdm due to an errfatal\n", __func__); mdm_drv->mdm_ready = 0; #ifndef CONFIG_PANTECH_USER_BUILD //12/11/08 p10919 : mdm remotefs hello fail fix and debug code add by case 01013984 test_hsic_phy(); #endif subsystem_restart_dev(mdm_subsys_dev); } return IRQ_HANDLED; }
static void mdm2ap_status_check(struct work_struct *work) { /* * If the mdm modem did not pull the MDM2AP_STATUS gpio * high then call subsystem_restart. */ if (!mdm_drv->disable_status_check) { if (gpio_get_value(mdm_drv->mdm2ap_status_gpio) == 0) { pr_err("%s: MDM2AP_STATUS gpio did not go high\n", __func__); mdm_drv->mdm_ready = 0; subsystem_restart_dev(mdm_subsys_dev); } } }
static irqreturn_t subsys_err_fatal_intr_handler (int irq, void *dev_id) { struct pil_tz_data *d = subsys_to_data(dev_id); pr_err("Fatal error on %s!\n", d->subsys_desc.name); if (subsys_get_crash_status(d->subsys)) { pr_err("%s: Ignoring error fatal, restart in progress\n", d->subsys_desc.name); return IRQ_HANDLED; } subsys_set_crash_status(d->subsys, true); log_failure_reason(d); subsystem_restart_dev(d->subsys); return IRQ_HANDLED; }
static irqreturn_t subsys_wdog_bite_irq_handler(int irq, void *dev_id) { struct pil_tz_data *d = subsys_to_data(dev_id); pr_err("Watchdog bite received from %s!\n", d->subsys_desc.name); if (subsys_get_crash_status(d->subsys)) { pr_err("%s: Ignoring wdog bite IRQ, restart in progress\n", d->subsys_desc.name); return IRQ_HANDLED; } subsys_set_crash_status(d->subsys, true); log_failure_reason(d); subsystem_restart_dev(d->subsys); return IRQ_HANDLED; }
static irqreturn_t riva_wdog_bite_irq_hdlr(int irq, void *dev_id) { riva_crash = true; if (ss_restart_inprogress) { pr_err("%s: Ignoring riva bite irq, restart in progress\n", MODULE_NAME); return IRQ_HANDLED; } if (!enable_riva_ssr) panic(MODULE_NAME ": Watchdog bite received from Riva"); ss_restart_inprogress = true; subsystem_restart_dev(riva_8960_dev); return IRQ_HANDLED; }
static irqreturn_t riva_wdog_bite_irq_hdlr(int irq, void *dev_id) { struct riva_data *drv = dev_id; drv->crash = true; if (drv->rst_in_progress) { pr_err("Ignoring riva bite irq, restart in progress\n"); return IRQ_HANDLED; } if (!enable_riva_ssr) panic("Watchdog bite received from Riva"); drv->rst_in_progress = 1; wcnss_riva_log_debug_regs(); subsystem_restart_dev(drv->subsys); return IRQ_HANDLED; }
static void smsm_state_cb_hdlr(void *data, uint32_t old_state, uint32_t new_state) { struct riva_data *drv = data; char *smem_reset_reason; char buffer[81]; unsigned smem_reset_size; unsigned size; drv->crash = true; if (!(new_state & SMSM_RESET)) return; if (drv->rst_in_progress) { pr_err("riva: Ignoring smsm reset req, restart in progress\n"); return; } pr_err("riva: smsm state changed to smsm reset\n"); wcnss_riva_dump_pmic_regs(); smem_reset_reason = smem_get_entry(SMEM_SSR_REASON_WCNSS0, &smem_reset_size); if (!smem_reset_reason || !smem_reset_size) { pr_err("wcnss subsystem failure reason:\n" "(unknown, smem_get_entry failed)"); } else if (!smem_reset_reason[0]) { pr_err("wcnss subsystem failure reason:\n" "(unknown, init string found)"); } else { size = smem_reset_size < sizeof(buffer) ? smem_reset_size : (sizeof(buffer) - 1); memcpy(buffer, smem_reset_reason, size); buffer[size] = '\0'; pr_err("wcnss subsystem failure reason: %s\n", buffer); memset(smem_reset_reason, 0, smem_reset_size); wmb(); } drv->rst_in_progress = 1; subsystem_restart_dev(drv->subsys); }
static irqreturn_t riva_wdog_bite_irq_hdlr(int irq, void *dev_id) { riva_crash = true; if (ss_restart_inprogress) { pr_err("%s: Ignoring riva bite irq, restart in progress\n", MODULE_NAME); return IRQ_HANDLED; } if (!enable_riva_ssr) { #if defined(CONFIG_LGE_HANDLE_PANIC) lge_set_magic_for_subsystem("wcnss"); msm_set_restart_mode(0x6d632130); #endif panic(MODULE_NAME ": Watchdog bite received from Riva"); } ss_restart_inprogress = true; subsystem_restart_dev(riva_8960_dev); return IRQ_HANDLED; }
static void restart_modem(void) { log_modem_sfr(); subsystem_restart_dev(modem_8960_dev); }
static void restart_modem(struct modem_data *drv) { log_modem_sfr(); drv->ignore_errors = true; subsystem_restart_dev(drv->subsys); }
static void smsm_state_cb_hdlr(void *data, uint32_t old_state, uint32_t new_state) { char *smem_reset_reason; char buffer[MAX_BUF_SIZE]; unsigned smem_reset_size; unsigned size; #ifdef CCI_KLOG_CRASH_SIZE #if CCI_KLOG_CRASH_SIZE set_fault_state(0x5, -1, "riva"); #endif // #if CCI_KLOG_CRASH_SIZE #endif // #ifdef CCI_KLOG_CRASH_SIZE riva_crash = true; pr_err("%s: smsm state changed\n", MODULE_NAME); wcnss_riva_dump_pmic_regs(); if (!(new_state & SMSM_RESET)) return; if (ss_restart_inprogress) { pr_err("%s: Ignoring smsm reset req, restart in progress\n", MODULE_NAME); return; } if (!enable_riva_ssr) { if((inactive == system_flag) || (normalreboot == system_flag) || (adloadmode == system_flag) ||(poweroff == system_flag)) system_flag = rivafatal; #ifdef CONFIG_CCI_KLOG *powerpt = (POWERONOFFRECORD + system_flag); *unknowflag = 0; *backupcrashflag = 0; #endif set_warmboot(); #ifdef CONFIG_CCI_KLOG #ifdef CCI_KLOG_ALLOW_FORCE_PANIC __raw_writel(CONFIG_WARMBOOT_CRASH, restart_reason); #else __raw_writel(CONFIG_WARMBOOT_NORMAL, restart_reason); *backupcrashflag = CONFIG_WARMBOOT_CRASH; #endif #endif mb(); panic(MODULE_NAME ": SMSM reset request received from Riva"); } smem_reset_reason = smem_get_entry(SMEM_SSR_REASON_WCNSS0, &smem_reset_size); if (!smem_reset_reason || !smem_reset_size) { pr_err("%s: wcnss subsystem failure reason: %s\n", __func__, "(unknown, smem_get_entry failed)"); } else if (!smem_reset_reason[0]) { pr_err("%s: wcnss subsystem failure reason: %s\n", __func__, "(unknown, init string found)"); } else { size = smem_reset_size < MAX_BUF_SIZE ? smem_reset_size : (MAX_BUF_SIZE - 1); memcpy(buffer, smem_reset_reason, size); buffer[size] = '\0'; pr_err("%s: wcnss subsystem failure reason: %s\n", __func__, buffer); memset(smem_reset_reason, 0, smem_reset_size); wmb(); } ss_restart_inprogress = true; subsystem_restart_dev(riva_8960_dev); }
static void restart_gss(void) { log_gss_sfr(); subsystem_restart_dev(gss_8064_dev); }
static void restart_adsp(struct lpass_data *drv) { adsp_log_failure_reason(); subsystem_restart_dev(drv->subsys); }
static void restart_wcnss(struct pronto_data *drv) { log_wcnss_sfr(); subsystem_restart_dev(drv->subsys); }
static void restart_modem(struct q6v4_modem *drv) { log_modem_sfr(); subsystem_restart_dev(drv->subsys); }