static int level_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { unsigned int val; switch (cmd) { case LEVEL_DEV_UNSET_UPLOAD: kernel_sec_clear_upload_magic_number(); return 0; case LEVEL_DEV_SET_AUTOTEST: kernel_sec_set_autotest(); return 0; case LEVEL_DEV_SET_DEBUGLEVEL: set_debug_level(); return 0; case LEVEL_DEV_GET_DEBUGLEVEL: { val = get_debug_level(); return copy_to_user((unsigned int *)arg, &val, sizeof(val)); } default: printk("Unknown Cmd: %x\n", cmd); break; } return -ENOTSUPP; }
static void lpm_mode_check(struct battery_data *battery) { extern int charging_mode_from_boot; pr_info("%s : charging_mode_from_boot(%d), ta_connected(%d)\n", __func__, charging_mode_from_boot, check_ta_conn(battery)); if (!charging_mode_from_boot) return; if (check_ta_conn(battery)) { battery->charging_mode_booting = 1; lpm_mode_flag = 1; pr_info("%s : charging_mode_booting(%d)\n", __func__, battery->charging_mode_booting); } else { pr_info("%s: ta no longer connected, powering off\n", __func__); if (pm_power_off) { #ifdef CONFIG_KERNEL_DEBUG_SEC kernel_sec_upload_cause_type upload_cause = kernel_sec_get_upload_cause(); if (upload_cause == UPLOAD_CAUSE_INIT) /* Clear the magic number because it's normal reboot */ kernel_sec_clear_upload_magic_number(); #endif pm_power_off(); } } }
static ssize_t store_control(struct device *d, struct device_attribute *attr, const char *buf, size_t count) { if(!strncmp(buf, "clear", 5)) { // clear upload magic number kernel_sec_clear_upload_magic_number(); return count; } if(!strncmp(buf, "autotest", 8)) { // set auto test kernel_sec_set_autotest(); return count; } if(!strncmp(buf, "set", 3)) { // set debug level set_debug_level(); return count; } return count; }
void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) { unsigned long flags; /* * Forced upload mode key string (tkhwang) */ #ifdef CONFIG_KERNEL_DEBUG_SEC static int first=0, second=0; if(strcmp(dev->name,"s3c-keypad")==0) { if(value) { if(code==KERNEL_SEC_FORCED_UPLOAD_1ST_KEY) { first =1; } if(first==1 && code==KERNEL_SEC_FORCED_UPLOAD_2ND_KEY) { printk(KERN_ERR"level %d reg %x \n",kernel_sec_get_debug_level(), kernel_sec_viraddr_wdt_reset_reg); if ( (KERNEL_SEC_DEBUG_LEVEL_MID == kernel_sec_get_debug_level()) || KERNEL_SEC_DEBUG_LEVEL_HIGH == kernel_sec_get_debug_level() ) { printk(KERN_ERR" USER Press volume key + Power key ==> Force RAM DUMP \n"); kernel_sec_set_upload_magic_number_final(); //suik_Check #if 0 // Display the working callstack for the debugging. dump_stack(); if (kernel_sec_viraddr_wdt_reset_reg) { kernel_sec_set_cp_upload(); kernel_sec_save_final_context(); // Save theh final context. kernel_sec_set_upload_cause(UPLOAD_CAUSE_FORCED_UPLOAD); kernel_sec_hw_reset(false); // Reboot. } #endif } } if(code==KERNEL_SEC_FORCED_UPLOAD_2ND_KEY) { second =1; } if(second==1 && code==KERNEL_SEC_FORCED_UPLOAD_1ST_KEY) { if ( (KERNEL_SEC_DEBUG_LEVEL_MID == kernel_sec_get_debug_level()) || KERNEL_SEC_DEBUG_LEVEL_HIGH == kernel_sec_get_debug_level() ) { printk(KERN_ERR" USER Press Power key + volume key ==> Force RAM DUMP \n"); kernel_sec_set_upload_magic_number_final(); //suik_Check #if 0 // Display the working callstack for the debugging. dump_stack(); if (kernel_sec_viraddr_wdt_reset_reg) { kernel_sec_set_cp_upload(); kernel_sec_save_final_context(); // Save theh final context. kernel_sec_set_upload_cause(UPLOAD_CAUSE_FORCED_UPLOAD); kernel_sec_hw_reset(false); // Reboot. } #endif } } } else { if(code==KERNEL_SEC_FORCED_UPLOAD_1ST_KEY) { first = 0; } if(code==KERNEL_SEC_FORCED_UPLOAD_2ND_KEY) { second = 0; } kernel_sec_clear_upload_magic_number(); //suik_Check } } #endif // CONFIG_KERNEL_DEBUG_SEC if (is_event_supported(type, dev->evbit, EV_MAX)) { spin_lock_irqsave(&dev->event_lock, flags); add_input_randomness(type, code, value); input_handle_event(dev, type, code, value); spin_unlock_irqrestore(&dev->event_lock, flags); } }