예제 #1
0
static void set_debug_level()
{
	switch(kernel_sec_get_debug_level_from_param())
	{
		case KERNEL_SEC_DEBUG_LEVEL_LOW:
			kernel_sec_set_debug_level(KERNEL_SEC_DEBUG_LEVEL_MID);
			break;
		case KERNEL_SEC_DEBUG_LEVEL_MID:
			kernel_sec_set_debug_level(KERNEL_SEC_DEBUG_LEVEL_HIGH);
			break;
		case KERNEL_SEC_DEBUG_LEVEL_HIGH:
			kernel_sec_set_debug_level(KERNEL_SEC_DEBUG_LEVEL_LOW);
			break;
		default:
			break;
	}
}
예제 #2
0
static ssize_t store_control(struct device *d,
		struct device_attribute *attr, const char *buf, size_t count)
{
	int sec_debug_level = convert_debug_level_str(buf);

	if (sec_debug_level == 0)
		return -EINVAL;
	
	kernel_sec_set_debug_level(sec_debug_level); 

	return count;
}
static ssize_t debug_level_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t size)
{
	int sec_debug_level = convert_debug_level_str(buf);

	if (sec_debug_level == 0)
		return -EINVAL;

	kernel_sec_set_debug_level(sec_debug_level);

	return size;

}
예제 #4
0
static ssize_t debug_level_store(struct device *dev,
                                 struct device_attribute *attr, const char *buf, size_t size)
{
    int sec_debug_level = convert_debug_level_str(buf);

    if (sec_debug_level == 0)
        return -EINVAL;

#if defined(CONFIG_SEC_DEBUG)
    kernel_sec_set_debug_level(sec_debug_level);
#endif

    return size;

}
예제 #5
0
static int write_bootloader_message(char *cmd, int mode)
{
	struct file *filp;
	mm_segment_t oldfs;
	int ret = 0;
	loff_t pos = 2048L;  /* bootloader message offset in MISC.*/
#ifdef CONFIG_KERNEL_DEBUG_SEC
	int state;
#endif

	struct bootloader_message  bootmsg;

	memset(&bootmsg, 0, sizeof(struct bootloader_message));

	if (mode == REBOOT_MODE_RECOVERY) {
		strcpy(bootmsg.command, "boot-recovery");
#ifdef CONFIG_KERNEL_DEBUG_SEC
		reboot_mode = REBOOT_MODE_RECOVERY;
		kernel_sec_set_debug_level(KERNEL_SEC_DEBUG_LEVEL_LOW);
		state = 1;	/* Set USB path to AP */
		sec_set_param(param_index_usbsel, &state);
#endif
	} else if (mode == REBOOT_MODE_FASTBOOT)
		strcpy(bootmsg.command, "boot-fastboot");
	else if (mode == REBOOT_MODE_NORMAL)
		strcpy(bootmsg.command, "boot-reboot");
	else if (mode == REBOOT_MODE_FOTA)
		strcpy(bootmsg.command, "boot-fota");
	else if (mode == REBOOT_MODE_NONE)
		strcpy(bootmsg.command, "boot-normal");
	else
		strcpy(bootmsg.command, cmd);

	bootmsg.status[0] = (char) mode;


	filp = filp_open(MISC_DEVICE, O_WRONLY, 0);

	if (IS_ERR(filp)) {
		pr_info("failed to open MISC : '%s'.\n", MISC_DEVICE);
		return 0;
	}

	oldfs = get_fs();
	set_fs(KERNEL_DS);

	ret = vfs_write(filp, (const char *)&bootmsg,
			sizeof(struct bootloader_message), &pos);

	set_fs(oldfs);

	if (ret < 0)
		pr_info("failed to write on MISC\n");
	else
		pr_info("command : %s written on MISC\n", bootmsg.command);

	fput(filp);
	filp_close(filp, NULL);

	return ret;
}