int LGE_ErrorHandler_Main( int crash_side, char * message) { char * kmem_buf; LG_ErrorHandler_enable = 1; raw_local_irq_enable(); kmem_buf = kmalloc(LGE_ERROR_MAX_ROW*LGE_ERROR_MAX_COLUMN, GFP_ATOMIC); memcpy(kmem_buf, message, LGE_ERROR_MAX_ROW*LGE_ERROR_MAX_COLUMN); switch(crash_side) { case MODEM_CRASH: display_info_LCD(crash_side, message); break; case APPL_CRASH: display_info_LCD(crash_side, message); break; } kfree(kmem_buf); raw_local_irq_disable(); preempt_disable(); mdelay(100); while(1) { // 1. Check Volume UP Key gpio_direction_output(34,1); gpio_direction_output(37,0); //volume down gpio_direction_output(38,1); //volume up gpio_direction_input(34); if(gpio_get_value(34)==0){ printk("volup\n"); return SMSM_SYSTEM_REBOOT; //volume up key is pressed } mdelay(100); // 2. Check Volume DOWN Key gpio_direction_output(34,1); gpio_direction_output(37,1); //volume down gpio_direction_output(38,0); gpio_direction_input(34); if(gpio_get_value(34)==0){ printk("voldown\n"); return SMSM_SYSTEM_REBOOT; //volume down key is pressed } mdelay(100); } }
static int rcu_debugfs_show(struct seq_file *m, void *unused) { int cpu, q, s[2], msecs; raw_local_irq_disable(); msecs = div_s64(sched_clock() - rcu_timestamp, NSEC_PER_MSEC); raw_local_irq_enable(); seq_printf(m, "%14u: #batches seen\n", rcu_stats.nbatches); seq_printf(m, "%14u: #barriers seen\n", atomic_read(&rcu_stats.nbarriers)); seq_printf(m, "%14llu: #callbacks invoked\n", rcu_stats.ninvoked); seq_printf(m, "%14u: #callbacks left to invoke\n", atomic_read(&rcu_stats.nleft)); seq_printf(m, "%14u: #msecs since last end-of-batch\n", msecs); seq_printf(m, "%14u: #passes forced (0 is best)\n", rcu_stats.nforced); seq_printf(m, "\n"); for_each_online_cpu(cpu) seq_printf(m, "%4d ", cpu); seq_printf(m, " CPU\n"); s[1] = s[0] = 0; for_each_online_cpu(cpu) { struct rcu_data *rd = &rcu_data[cpu]; int w = ACCESS_ONCE(rd->which) & 1; seq_printf(m, "%c%c%c%d ", '-', idle_cpu(cpu) ? 'I' : '-', rd->wait ? 'W' : '-', w); s[w]++; } seq_printf(m, " FLAGS\n"); for (q = 0; q < 2; q++) { for_each_online_cpu(cpu) { struct rcu_data *rd = &rcu_data[cpu]; struct rcu_list *l = &rd->cblist[q]; seq_printf(m, "%4d ", l->count); } seq_printf(m, " Q%d%c\n", q, " *"[s[q] > s[q^1]]); } seq_printf(m, "\nFLAGS:\n"); seq_printf(m, " I - cpu idle, 0|1 - Q0 or Q1 is current Q, other is previous Q,\n"); seq_printf(m, " W - cpu does not permit current batch to end (waiting),\n"); seq_printf(m, " * - marks the Q that is current for most CPUs.\n"); return 0; }
static void gpr_reset(char *c) { /* switch System-LED to orange (red# and green# on) */ alchemy_gpio_direction_output(4, 0); alchemy_gpio_direction_output(5, 0); /* trigger watchdog to reset board in 200ms */ printk(KERN_EMERG "Triggering watchdog soft reset...\n"); raw_local_irq_disable(); alchemy_gpio_direction_output(1, 0); udelay(1); alchemy_gpio_set_value(1, 1); while (1) cpu_wait(); }
void _soft_restart(unsigned long addr, bool disable_l2) { u64 *stack = soft_restart_stack + ARRAY_SIZE(soft_restart_stack); /* Disable interrupts first */ raw_local_irq_disable(); local_fiq_disable(); /* Disable the L2 if we're the last man standing. */ if (disable_l2) outer_disable(); /* Change to the new stack and continue with the reset. */ call_with_stack(__soft_restart, (void *)addr, (void *)stack); /* Should never get here. */ BUG(); }
int LGE_ErrorHandler_Main( int crash_side, char * message) { char * kmem_buf; LG_ErrorHandler_enable = 1; raw_local_irq_enable(); /* [email protected] 10.11.04 S * 0010515: temporary disable CONFIG_FRAMEBUFFER_CONSOLE because of current consumption */ #if 0 kmem_buf = kmalloc(LGE_ERROR_MAX_ROW*LGE_ERROR_MAX_COLUMN, GFP_ATOMIC); memcpy(kmem_buf, message, LGE_ERROR_MAX_ROW*LGE_ERROR_MAX_COLUMN); switch(crash_side) { case MODEM_CRASH: display_info_LCD(crash_side, message); break; case APPL_CRASH: display_info_LCD(crash_side, message); break; } kfree(kmem_buf); #endif /* [email protected] 10.11.04 E */ raw_local_irq_disable(); preempt_disable(); /* BEGIN: 0006765 [email protected] 2010-06-03 */ /* MODIFY 0006765: Fix : The kernel panic screen is disappeared just after linux kernel gets system panic */ mdelay(100); while(1) { // 1. Check Volume Key /* [email protected] 10.11.03 S 0010460: add HW revision feature to vol key gpio in kernel panic */ #if CONFIG_MACH_LGE_BRYCE #if defined (LG_HW_REV2) gpio_direction_output(19,1); gpio_direction_output(56,0); //volume down gpio_direction_output(20,1); //volume up gpio_direction_input(19); if(gpio_get_value(19)==0){ printk("### vol down key pressed \n"); mdelay(100); /* [email protected] 10.11.03 S 0010472: each volup/voldown key mapped separately to reboot/download mode. */ return SMSM_SYSTEM_DOWNLOAD; /* [email protected] 10.11.03 E */ } mdelay(100); gpio_direction_output(19,1); gpio_direction_output(20,0); gpio_direction_output(56,1); gpio_direction_input(19); if(gpio_get_value(19)==0){ printk("### vol up key pressed\n"); mdelay(100); return SMSM_SYSTEM_REBOOT; } mdelay(100); #endif #if defined (LG_HW_REV3) || defined(LG_HW_REV4) || defined(LG_HW_REV5) || defined(LG_HW_REV6) || defined(LG_HW_REV7) gpio_direction_output(20,1); gpio_direction_output(56,0); //volume down gpio_direction_output(19,1); //volume up gpio_direction_input(20); if(gpio_get_value(20)==0){ printk("### vol down key pressed \n"); mdelay(100); /* [email protected] 10.11.03 S 0010472: each volup/voldown key mapped separately to reboot/download mode. */ return SMSM_SYSTEM_DOWNLOAD; /* [email protected] 10.11.03 E */ } mdelay(100); gpio_direction_output(20,1); gpio_direction_output(19,0); gpio_direction_output(56,1); gpio_direction_input(20); if(gpio_get_value(20)==0){ printk("### vol up key pressed\n"); mdelay(100); return SMSM_SYSTEM_REBOOT; } mdelay(100); #endif #endif /* [email protected] 10.11.03 E */ } /* END: 0006765 [email protected] 2010-06-03 */ }
static int set_crash(const char *buf, struct kernel_param *kp) { printk(KERN_DEBUG"%s: +-\r\n", __func__); if(!strncmp(buf, "point_null",strlen(buf)-1)) { my_data->memblk = NULL; *my_data->memblk =0xEF; }else if(!strncmp(buf, "overwrite",strlen(buf)-1)) { my_data->memblk = kmalloc(MEMBLK_LEN,GFP_KERNEL); memset(my_data->memblk,0,MEMBLK_LEN<<1); }else if(!strncmp(buf, "call_panic",strlen(buf)-1)) { panic("yulong panic!"); } else if(!strncmp(buf, "schedule_in_atomic",strlen(buf)-1)) { setup_timer(&my_data->timer, sleep_timer_fn, (unsigned long)my_data); mod_timer(&my_data->timer, jiffies + 5 * HZ); } else if(!strncmp(buf, "interrupt_before_initialize",strlen(buf)-1)) { /* As I don't know what IRQ we support, I choose timer for simulation */ setup_timer(&my_data->timer, irq_simulate, (unsigned long)my_data); mod_timer(&my_data->timer, jiffies); /* do something else * interrupt may happen before data is full initialized * */ msleep(10); init_completion(&my_data->done); } else if(!strncmp(buf, "uninit-lock",strlen(buf)-1)) { printk(KERN_ERR "uninit-lock %s\n", buf); wake_lock(&my_data->mwake_lock); } else if (!strncmp(buf, "wdog", 4)) { pr_emerg("Generating a wdog bark!\n"); raw_local_irq_disable(); while (1) ; } else if (!strncmp(buf, "dabort", 6)) { pr_emerg("Generating a data abort exception!\n"); *(unsigned int *)0x0 = 0x0; } else if (!strncmp(buf, "pabort", 6)) { pr_emerg("Generating a prefetch abort exception!\n"); ((void (*)(void))0x0)(); } else if (!strncmp(buf, "undef", 5)) { pr_emerg("Generating a undefined instruction exception!\n"); BUG(); } else if (!strncmp(buf, "bushang", 7)) { void __iomem *p; pr_emerg("Generating Bus Hang!\n"); p = ioremap_nocache(0xFC4E0810, 32); // *(unsigned int *)p = *(unsigned int *)p; mb(); pr_info("*p = %x\n", *(unsigned int *)p); pr_emerg("Clk may be enabled.Try again if it reaches here!\n"); } else if (!strncmp(buf, "dblfree", 7)) { void *p = kmalloc(sizeof(int), GFP_KERNEL); kfree(p); msleep(1000); kfree(p); } else if (!strncmp(buf, "danglingref", 11)) { unsigned int *p = kmalloc(sizeof(int), GFP_KERNEL); kfree(p); *p = 0x1234; } else if (!strncmp(buf, "lowmem", 6)) { int i = 0; pr_emerg("Allocating memory until failure!\n"); while (kmalloc(128*1024, GFP_KERNEL)) i++; pr_emerg("Allocated %d KB!\n", i*128); } else if (!strncmp(buf, "memcorrupt", 10)) { int *ptr = kmalloc(sizeof(int), GFP_KERNEL); *ptr++ = 4; *ptr = 2; panic("MEMORY CORRUPTION"); } else { printk(KERN_ERR "unknown command %s\n", buf); return -EINVAL; } sprintf(crash_str, "%s", buf); return 0; }
int LGE_ErrorHandler_Main( int crash_side, char * message) { ram_console_setpanic(); if (hidden_reset_enable) { if (crash_side == MODEM_CRASH) { unsigned *temp; printk(KERN_INFO"%s: arm9 has crashed...\n",__func__); printk(KERN_INFO"%s\n", message); atomic_notifier_call_chain(&panic_notifier_list, 0, "arm9 has crashed...\n"); temp = lge_get_fb_copy_virt_addr(); *temp = 0x12345678; printk(KERN_INFO"%s: hidden magic %x\n",__func__, temp[0]); return SMSM_SYSTEM_REBOOT; } return 0; } if(BLUE_ERROR_HANDLER_LEVEL != 0) { if (get_suspend_state() != PM_SUSPEND_ON) { lcd_suspend = 0; } switch(crash_side) { case MODEM_CRASH: case APPL_CRASH: case ANDROID_CRASH: if(!LG_ErrorHandler_enable) { LG_ErrorHandler_enable = 1; raw_local_irq_enable(); if (message != NULL) display_info_LCD(crash_side, message); } break; case ANDROID_DISPLAY_INFO : if (message != NULL) display_info_LCD(crash_side, message); return 0; default : break; } } raw_local_irq_disable(); preempt_disable(); smsm_reset_modem(SMSM_APPS_SHUTDOWN); if(BLUE_ERROR_HANDLER_LEVEL == 0) { mdelay(100); return SMSM_SYSTEM_REBOOT; } while(1) { gpio_set_value(36,0); gpio_set_value(32,1); gpio_set_value(33,1); if(gpio_get_value(38)==0) { printk("Pressed Volume up key\n"); return SMSM_SYSTEM_DOWNLOAD; } else if(gpio_get_value(37) ==0 ) { printk("Pressed Volume down key\n"); return SMSM_SYSTEM_REBOOT; } mdelay(200); ; } }