if (subsys_get_crash_status(d->subsys)) return IRQ_HANDLED; pr_err("Watchdog bite received from %s!\n", d->subsys_desc.name);
if (d->subsys_desc.system_debug) panic("%s: System ramdump requested. Triggering device restart!\n", __func__); subsys_set_crash_status(d->subsys, CRASH_STATUS_WDOG_BITE); log_failure_reason(d); //tj: here subsystem_restart_dev(d->subsys);
return IRQ_HANDLED; }
staticvoidclear_wdog(struct pil_tz_data *d) { /* Check crash status to know if device is restarting*/ if (!subsys_get_crash_status(d->subsys)) { pr_err("wdog bite received from %s!\n", d->subsys_desc.name); __raw_writel(BIT(d->bits_arr[ERR_READY]), d->irq_clear); subsys_set_crash_status(d->subsys, CRASH_STATUS_WDOG_BITE); log_failure_reason(d); //tj:here subsystem_restart_dev(d->subsys); } }
if (!try_module_get(dev->owner)) { put_device(&dev->dev); return -ENODEV; }
name = dev->desc->name;
send_early_notifications(dev->early_notify);
/* * If a system reboot/shutdown is underway, ignore subsystem errors. * However, print a message so that we know that a subsystem behaved * unexpectedly here. */ if (system_state == SYSTEM_RESTART || system_state == SYSTEM_POWER_OFF) { pr_err("%s crashed during a system poweroff/shutdown.\n", name); return -EBUSY; //tj }
pr_info("Restart sequence requested for %s, restart_level = %s.\n", name, restart_levels[dev->restart_level]);
if (disable_restart_work == DISABLE_SSR) { pr_warn("subsys-restart: Ignoring restart request for %s\n", name); return0; }
switch (dev->restart_level) {
case RESET_SUBSYS_COUPLED: __subsystem_restart_dev(dev); break; case RESET_SOC: __pm_stay_awake(&dev->ssr_wlock); schedule_work(&dev->device_restart_work); return0; default: panic("subsys-restart: Unknown restart level!\n"); break; } module_put(dev->owner); put_device(&dev->dev);
track = subsys_get_track(dev); /* * Allow drivers to call subsystem_restart{_dev}() as many times as * they want up until the point where the subsystem is shutdown. */ spin_lock_irqsave(&track->s_lock, flags); if (track->p_state != SUBSYS_CRASHED && dev->track.state == SUBSYS_ONLINE) { if (track->p_state != SUBSYS_RESTARTING) { track->p_state = SUBSYS_CRASHED; __pm_stay_awake(&dev->ssr_wlock); queue_work(ssr_wq, &dev->work); //tj } else { panic("Subsystem %s crashed during SSR!", name); } } else WARN(dev->track.state == SUBSYS_OFFLINE, "SSR aborted: %s subsystem not online\n", name); spin_unlock_irqrestore(&track->s_lock, flags); }