Example #1
0
static void mdm_fatal_fn(struct work_struct *work)
{
	
	int i;
	int value = gpio_get_value(mdm_drv->mdm2ap_errfatal_gpio);

	if (value == 1) {
		for (i = HTC_MDM_ERROR_CONFIRM_TIME_MS; i > 0; i--) {
			msleep(1);
			if (gpio_get_value(mdm_drv->mdm2ap_errfatal_gpio) == 0) {
				pr_info("%s: mdm fatal high %d(ms) confirm failed... Abort!\n", __func__, HTC_MDM_ERROR_CONFIRM_TIME_MS);
				return;
			}
		}
	} else if (value == 0) {
		pr_info("%s: mdm fatal high is a false alarm!\n", __func__);
		return;
	}

	dump_mdm_related_gpio();

	
	pr_info("### Show Blocked State in ###\n");
	show_state_filter(TASK_UNINTERRUPTIBLE);
	if (get_restart_level() == RESET_SOC)
		msm_rtb_disable();

	if (get_restart_level() == RESET_SOC)
		set_mdm2ap_errfatal_restart_flag(1);
	

	pr_info("%s: Reseting the mdm due to an errfatal\n", __func__);

	subsystem_restart(EXTERNAL_MODEM);
}
Example #2
0
static void mdm_crash_dump_dbg_info(void)
{
	dump_mdm_related_gpio();

	
	printk(KERN_INFO "=== Show qcks stack ===\n");
	show_thread_group_state_filter("qcks", 0);
	printk(KERN_INFO "\n");

	printk(KERN_INFO "=== Show efsks stack ===\n");
	show_thread_group_state_filter("efsks", 0);
	printk(KERN_INFO "\n");

	printk(KERN_INFO "=== Show ks stack ===\n");
	show_thread_group_state_filter("ks", 0);
	printk(KERN_INFO "\n");

	pr_info("### Show Blocked State in ###\n");
	show_state_filter(TASK_UNINTERRUPTIBLE);
	if (get_restart_level() == RESET_SOC)
		msm_rtb_disable();

	if (get_restart_level() == RESET_SOC)
		set_mdm2ap_errfatal_restart_flag(1);
}
/*add power status error judge,avoid red screen*/
void lcd_dcm_pwr_status_handler(unsigned long data)
{
	/*Not in factory mode will report this dsm log*/
	if( !is_runmode_factory() ) {
	/*optimize 20110 report strategy for device monitor.*/
		if((lcd_pwr_status.lcd_dcm_pwr_status != LCD_PWR_STAT_GOOD)&&(lcd_pwr_status.lcd_dcm_pwr_status != LCD_PWR_STAT_IS_GOOD))
		{
			dsm_client_record(lcd_dclient, "lcd power status wrong, value :%x\n",lcd_pwr_status.lcd_dcm_pwr_status);
			
			dsm_client_record(lcd_dclient, "lcd power status :bit 0  do unblank\n");
			dsm_client_record(lcd_dclient, "lcd power status :bit 1  lcd on\n");
			dsm_client_record(lcd_dclient, "lcd power status :bit 2  set frame\n");
			dsm_client_record(lcd_dclient, "lcd power status :bit 3  set backlgiht\n");
			
			dsm_client_record(lcd_dclient, "lcd power status :if did the operation the bit will be set to 1 or the bit is 0\n");
			dsm_client_record(lcd_dclient,"unblank at [%d-%d-%d]%d:%d:%d:%d\n",lcd_pwr_status.tm_unblank.tm_year + 1900,lcd_pwr_status.tm_unblank.tm_mon+1,
							lcd_pwr_status.tm_unblank.tm_mday,lcd_pwr_status.tm_unblank.tm_hour,lcd_pwr_status.tm_unblank.tm_min,lcd_pwr_status.tm_unblank.tm_sec,lcd_pwr_status.tvl_unblank.tv_usec%1000);
			dsm_client_record(lcd_dclient,"lcd on at [%d-%d-%d]%d:%d:%d:%d\n",lcd_pwr_status.tm_lcd_on.tm_year + 1900,lcd_pwr_status.tm_lcd_on.tm_mon+1,
							lcd_pwr_status.tm_lcd_on.tm_mday,lcd_pwr_status.tm_lcd_on.tm_hour,lcd_pwr_status.tm_lcd_on.tm_min,lcd_pwr_status.tm_lcd_on.tm_sec,lcd_pwr_status.tvl_lcd_on.tv_usec%1000);
			dsm_client_record(lcd_dclient,"set frame at [%d-%d-%d]%d:%d:%d:%d\n",lcd_pwr_status.tm_set_frame.tm_year + 1900,lcd_pwr_status.tm_set_frame.tm_mon+1,
							lcd_pwr_status.tm_set_frame.tm_mday,lcd_pwr_status.tm_set_frame.tm_hour,lcd_pwr_status.tm_set_frame.tm_min,lcd_pwr_status.tm_set_frame.tm_sec,lcd_pwr_status.tvl_set_frame.tv_usec%1000);
			dsm_client_record(lcd_dclient,"set backlight at [%d-%d-%d]%d:%d:%d:%d\n",lcd_pwr_status.tm_backlight.tm_year + 1900,lcd_pwr_status.tm_backlight.tm_mon+1,
							lcd_pwr_status.tm_backlight.tm_mday,lcd_pwr_status.tm_backlight.tm_hour,lcd_pwr_status.tm_backlight.tm_min,lcd_pwr_status.tm_backlight.tm_sec,lcd_pwr_status.tvl_backlight.tv_usec%1000);
			
			dsm_client_notify(lcd_dclient, DSM_LCD_POWER_STATUS_ERROR_NO);

			show_state_filter(TASK_UNINTERRUPTIBLE);
		}
	} else {
		/*in factory mode do not report this dsm log,just print a log for locate*/
		LCD_LOG_INFO("[%s] in factory mode ignore log of 20110\n",__func__);
	}
	lcd_pwr_status.lcd_dcm_pwr_status = 0;
}
static void print_other_cpu_stall(struct rcu_state *rsp)
{
	int cpu;
	long delta;
	unsigned long flags;
	struct rcu_node *rnp = rcu_get_root(rsp);
	struct rcu_node *rnp_cur = rsp->level[NUM_RCU_LVLS - 1];
	struct rcu_node *rnp_end = &rsp->node[NUM_RCU_NODES];

	/* Only let one CPU complain about others per time interval. */

	spin_lock_irqsave(&rnp->lock, flags);
	delta = jiffies - rsp->jiffies_stall;
	if (delta < RCU_STALL_RAT_DELAY || rsp->gpnum == rsp->completed) {
		spin_unlock_irqrestore(&rnp->lock, flags);
		return;
	}
	rsp->jiffies_stall = jiffies + RCU_SECONDS_TILL_STALL_RECHECK;
	spin_unlock_irqrestore(&rnp->lock, flags);

	/* OK, time to rat on our buddy... */

	printk(KERN_ERR "INFO: RCU detected CPU stalls:");
	for (; rnp_cur < rnp_end; rnp_cur++) {
		if (rnp_cur->qsmask == 0)
			continue;
		for (cpu = 0; cpu <= rnp_cur->grphi - rnp_cur->grplo; cpu++)
			if (rnp_cur->qsmask & (1UL << cpu))
				printk(" %d", rnp_cur->grplo + cpu);
	}
	printk(" (detected by %d, t=%ld jiffies)\n",
	       smp_processor_id(), (long)(jiffies - rsp->gp_start));
	force_quiescent_state(rsp, 0);  /* Kick them all. */
	show_state_filter(0);
}
void htc_debug_watchdog_check_pet(unsigned long long timestamp)
{
	if (!htc_debug_watchdog_enabled() || !htc_debug_watchdog_last_pet)
		return;

	if (timestamp - htc_debug_watchdog_last_pet > (unsigned long long)NSEC_PER_THRESHOLD) {
		if (timestamp - last_pet_check > (unsigned long long)NSEC_PER_SEC) {
			last_pet_check = timestamp;
			/* FIXME:
			 * the value of pet_check_counter is not necessary 'seconds'
			 * also, we could avoid using the variable pet_check_counter
			 */
			pr_info("\n%s: MSM watchdog was blocked for more than %d seconds!\n",
				__func__, pet_check_counter++);
			pr_info("%s: Prepare to dump stack...\n",
				__func__);
			dump_stack();
#if defined(CONFIG_HTC_DEBUG_WORKQUEUE)
			pr_info("%s: Prepare to dump pending works on global workqueue...\n",
				__func__);
			htc_debug_workqueue_show_pending_work_on_gcwq();
#endif /* CONFIG_HTC_DEBUG_WORKQUEUE */
			pr_info("\n ### Show Blocked State ###\n");
			show_state_filter(TASK_UNINTERRUPTIBLE);
		}
	}
}
Example #6
0
static void mdm_status_fn(struct work_struct *work)
{
	int i;
	int value = gpio_get_value(mdm_drv->mdm2ap_status_gpio);

	if (!mdm_drv->mdm_ready)
		return;

	
	if (value == 0) {
		for (i = HTC_MDM_ERROR_CONFIRM_TIME_MS; i > 0; i--) {
			msleep(1);
			if (gpio_get_value(mdm_drv->mdm2ap_status_gpio) == 1) {
				pr_info("%s: mdm status low %d(ms) confirm failed... Abort!\n", __func__, HTC_MDM_ERROR_CONFIRM_TIME_MS);
				return;
			}
		}
	}
	

	if ( ( get_radio_flag() & RADIO_FLAG_USB_UPLOAD ) ) {
		if ( value == 0 ) {
			int val_gpio = 0;
			msleep(40);
			val_gpio = gpio_get_value(mdm_drv->mdm2ap_hsic_ready_gpio);
			pr_info("%s:mdm2ap_hsic_ready_gpio=[%d]\n", __func__, val_gpio);
		}
	}

	
	mdm_status_change_notified = true;
	
	mdm_drv->ops->status_cb(mdm_drv, value);

	pr_debug("%s: status:%d\n", __func__, value);

	if (value == 0) {
		pr_info("%s: unexpected reset external modem\n", __func__);

		
		dump_mdm_related_gpio();

		
		pr_info("### Show Blocked State in ###\n");
		show_state_filter(TASK_UNINTERRUPTIBLE);
		if (get_restart_level() == RESET_SOC)
			msm_rtb_disable();

		if (get_restart_level() == RESET_SOC)
			set_mdm2ap_errfatal_restart_flag(1);
		

		subsystem_restart(EXTERNAL_MODEM);
	} else if (value == 1) {
		pr_info("%s: status = 1: mdm is now ready\n", __func__);
	}
}
Example #7
0
static void do_restart(struct work_struct *unused)
{
#if defined(CONFIG_POWER_KEY_CLR_RESET)
	clear_hw_reset();
#endif
	sys_sync();
	KEY_LOGI("[PWR] Show Blocked State -- long press power key\n");
	show_state_filter(TASK_UNINTERRUPTIBLE);
	machine_restart("power-key-force-hard");
}
Example #8
0
static void sync_timeout_handler(unsigned long data)
{
    if (sys_sync_done == 0) {
        pr_info("================  show possible blocking tasks  ================");
        check_all_hung_task();
        pr_info("================  show all blocking tasks  ================");
        pr_info("sys_sync time is too long(more than 3 seconds)");
        show_state_filter(TASK_UNINTERRUPTIBLE);
    }
}
Example #9
0
static void sysrq_handle_showstate_blocked(int key)
{
	unsigned long flags;

	local_save_flags(flags);
	local_irq_enable();

	show_state_filter(TASK_UNINTERRUPTIBLE);

	local_irq_restore(flags);
}
Example #10
0
static int wdog_fire_set(const char *val, struct kernel_param *kp)
{
	if (smp_processor_id() != 0) {
		printk("disable other cpus first\n");
		return 0;
	}

	local_irq_disable();
	show_state_filter(0);
	while (1)
		;
}
Example #11
0
static void power_key_led_on_work_func(struct work_struct *dummy)
{
	KEY_LOGI("[PWR] %s in (%x)\n", __func__, power_key_led_requested);
	if (power_key_led_requested == 1) {
		pre_power_key_led_status = 1;
		KEY_LOGI("[PWR] change power key led on\n");
		pm8xxx_led_current_set_for_key(1);
		set_hw_reason(HW_RESET_REASON);
		KEY_LOGI("[PWR] Show Blocked State -- long press power key\n");
		show_state_filter(TASK_UNINTERRUPTIBLE);
	}
}
static void vfs_write_timeout(unsigned long data)
{
	struct task_struct* tsk = (struct task_struct*) data;
	pr_warn("%s: vfs_write timed out after %d seconds! dump call stack:\n",
		__func__, WRITE_TIMEOUT_VALUE);
	show_stack(tsk, NULL);
	pr_warn("### Show Blocked State ###\n");
	show_state_filter(TASK_UNINTERRUPTIBLE);
	pr_warn("### Show System Server State ###\n");
	show_thread_group_state_filter("system_server", 0);
	pr_info("### Show bugreport State ###\n");
	show_thread_group_state_filter("bugreport", 0);
	pr_info("### Show adbd State ###\n");
	show_thread_group_state_filter("adbd", 0);
}
Example #13
0
void msm_watchdog_check_pet(unsigned long long timestamp)
{
	if (!enable || !msm_tmr0_base || !check_WDT_EN_footprint())
		return;

	if (timestamp - last_pet > (unsigned long long)NSEC_PER_THRESHOLD) {
		if (timestamp - last_pet_check > (unsigned long long)NSEC_PER_SEC) {
			last_pet_check = timestamp;
			pr_info("\n%s: MSM watchdog was blocked for more than %d seconds!\n",
				__func__, pet_check_counter++);
			pr_info("%s: Prepare to dump stack...\n",
				__func__);
			dump_stack();
			pr_info("%s: Prepare to dump pending works on global workqueue...\n",
				__func__);
//			show_pending_work_on_gcwq();
			pr_info("\n ### Show Blocked State ###\n");
			show_state_filter(TASK_UNINTERRUPTIBLE);
		}
	}
}
Example #14
0
static void sysrq_handle_showstate_blocked(int key)
{
	show_state_filter(TASK_UNINTERRUPTIBLE);
}
Example #15
0
static void sysrq_handle_showstate_blocked(int key)
{
	show_state_filter(TASK_UNINTERRUPTIBLE);
	pr_info("### Show All Tasks in System Server ###\n");
	show_thread_group_state_filter("system_server", 0);
}
static void apanic_mmc_logbuf_dump(void)
{
	struct apanic_data *ctx = &drv_ctx;
	struct panic_header *hdr = (struct panic_header *) ctx->bounce;
	int console_offset = 0;
	int console_len = 0;
	int threads_offset = 0;
	int threads_len = 0;
	int app_threads_offset = 0;
	int app_threads_len =0;
	int rc;
	struct timespec now;
	struct timespec uptime;
	struct rtc_time rtc_timestamp;
	struct console *con;

	if (!ctx->mmchd || !ctx->mmc_panic_ops ||
			!ctx->mmc_panic_ops->panic_probe)
		return;
	if (ctx->mmc_panic_ops->panic_probe(ctx->mmchd,
			ctx->mmc_panic_ops->type)) {
		printk(KERN_ERR "apanic: choose to use mmc, "
			"but eMMC card not detected\n");
		return;
	}
	console_offset = 1024;

	if (ctx->curr.magic) {
		printk(KERN_EMERG "Crash partition in use!\n");
		return;
	}

	/*
	 * Add timestamp to displays current UTC time and uptime (in seconds).
	 */
	now = current_kernel_time();
	rtc_time_to_tm((unsigned long)now.tv_sec, &rtc_timestamp);
	do_posix_clock_monotonic_gettime(&uptime);
	bust_spinlocks(1);
	printk(KERN_EMERG "Timestamp = %lu.%03lu\n",
			(unsigned long)now.tv_sec,
			(unsigned long)(now.tv_nsec / 1000000));
	printk(KERN_EMERG "Current Time = "
			"%02d-%02d %02d:%02d:%lu.%03lu UTC, "
			"Uptime = %lu.%03lu seconds\n",
			rtc_timestamp.tm_mon + 1, rtc_timestamp.tm_mday,
			rtc_timestamp.tm_hour, rtc_timestamp.tm_min,
			(unsigned long)rtc_timestamp.tm_sec,
			(unsigned long)(now.tv_nsec / 1000000),
			(unsigned long)uptime.tv_sec,
			(unsigned long)(uptime.tv_nsec/USEC_PER_SEC));
	bust_spinlocks(0);


	/*
	 * Write out the console
	 */
	console_len = apanic_write_console_mmc(console_offset);
	if (console_len < 0) {
		printk(KERN_EMERG "Error writing console to panic log! (%d)\n",
		       console_len);
		console_len = 0;
	}

	/*
	 * Write out all threads
	 */
	app_threads_offset = (ALIGN(console_offset + console_len,
		1024) == 0) ? 1024 :
		ALIGN(console_offset + console_len, 1024);

	log_buf_clear();

	for (con = console_drivers; con; con = con->next)
		con->flags &= ~CON_ENABLED;

	ctx->buf_offset = app_threads_offset;
	ctx->written = app_threads_offset;
	start_apanic_threads = 1;
	ftrace_dump(1);
	show_state_filter(0, SHOW_APP_THREADS);
	ctx->buf_offset = ALIGN(ctx->written, 512);
	start_apanic_threads = 0;
	ctx->written += apanic_write_console_mmc(ctx->buf_offset);
	app_threads_len = ctx->written - app_threads_offset;

	log_buf_clear();
	threads_offset = ALIGN(ctx->written, 512);
	ctx->buf_offset = threads_offset;
	ctx->written = threads_offset;
	start_apanic_threads = 1;
	show_state_filter(0, SHOW_KTHREADS);
	start_apanic_threads = 0;
	ctx->buf_offset = ALIGN(ctx->written, 512);
	ctx->written += apanic_write_console_mmc(ctx->buf_offset);
	threads_len = ctx->written - threads_offset + 512;

	for (con = console_drivers; con; con = con->next)
		con->flags |= CON_ENABLED;

	/*
	 * Finally write the panic header
	 */
	memset(ctx->bounce, 0, PAGE_SIZE);
	hdr->magic = PANIC_MAGIC;
	hdr->version = PHDR_VERSION;

	hdr->console_offset = console_offset;
	hdr->console_length = console_len;

	hdr->app_threads_offset = app_threads_offset;
	hdr->app_threads_length = app_threads_len;

	hdr->threads_offset = threads_offset;
	hdr->threads_length = threads_len;

	rc = ctx->mmc_panic_ops->panic_write(ctx->mmchd, ctx->bounce, 0,
		console_offset);
	if (rc <= 0) {
		printk(KERN_EMERG "apanic: Header write failed (%d)\n",
		       rc);
		return;
	}

	printk(KERN_EMERG "apanic: Panic dump successfully written\n");
}
static void power_key_restart_work_func(struct work_struct *dummy)
{
#ifndef CONFIG_POWER_VOLUP_RESET
	int pocket_mode = (board_mfg_mode() == MFG_MODE_NORMAL) ? power_key_check_in_pocket() : 0;
	KEY_LOGI( "%s: power_key_check_in_pocket = %d\n", __func__, pocket_mode);

	if (!pocket_mode && pre_power_key_led_status == 1 && !is_rrm1_mode()) {
#else
	uint8_t gpio_val = 0, i, idx_pwr = 9, idx_vup = 9;
	struct gpio_event_input_info *local = gis;
	for (i = 0; i < local->keymap_size; i++) {
		if (local->keymap[i].code == KEY_POWER) {
			idx_pwr = i;
			continue;
		}
		if (local->keymap[i].code == KEY_VOLUMEUP)
			idx_vup = i;
	}
	gpio_val = !(gpio_get_value(local->keymap[idx_pwr].gpio) |
		     gpio_get_value(local->keymap[idx_vup].gpio));

	if (gpio_val && pre_power_key_led_status == 1 && !is_rrm1_mode()) {
		KEY_LOGI("%s, (PWR+VOL_UP) reset", __func__);
#endif
		
		set_hw_reason(0);
#if defined(CONFIG_PM8921_BMS) && (CONFIG_HTC_BATT_8960)
		pm8921_store_hw_reset_reason(1);
#endif
		clear_hw_reset();
		set_restart_to_ramdump("Powerkey Hard Reset - SW");
		msm_restart(0, NULL);
	}
}

static DECLARE_DELAYED_WORK(power_key_restart_work, power_key_restart_work_func);
#endif

static void power_key_led_on_work_func(struct work_struct *dummy)
{
	KEY_LOGI("[PWR] %s in (%x)\n", __func__, power_key_led_requested);
	if (power_key_led_requested == 1) {
		pre_power_key_led_status = 1;
#ifdef CONFIG_POWER_KEY_CLR_RESET
		schedule_delayed_work(&power_key_restart_work, PWRKEYKP_DELAY);
#endif
		KEY_LOGI("[PWR] change power key led on\n");
#ifdef CONFIG_QPNP_PWM
#ifdef CONFIG_VK_LED
		qpnp_led_set_for_key(1);
#endif
#else
		pm8xxx_led_current_set_for_key(1);
#endif
#ifdef CONFIG_POWER_KEY_CLR_RESET
		if(!is_rrm1_mode())
#endif
			set_hw_reason(HW_RESET_REASON);
		KEY_LOGI("[PWR] Show Blocked State -- long press power key\n");
		show_state_filter(TASK_UNINTERRUPTIBLE);
	}
}