Пример #1
0
static int param_init(void)
{
	int ret;
        printk("%s start\n", __func__);
	ret = load_param_value();

	if (ret < 0) {
		printk(KERN_ERR "%s -> relocated to default value!\n", __FUNCTION__);

		memset(&param_status, 0, sizeof(param_status_t));

		param_status.param_magic = PARAM_MAGIC;
		param_status.param_version = PARAM_VERSION;
		param_status.param_list[0].ident = __SERIAL_SPEED;
		param_status.param_list[0].value = SERIAL_SPEED;
		param_status.param_list[1].ident = __LOAD_RAMDISK;
		param_status.param_list[1].value = LOAD_RAMDISK;
		param_status.param_list[2].ident = __BOOT_DELAY;
		param_status.param_list[2].value = BOOT_DELAY;
		param_status.param_list[3].ident = __LCD_LEVEL;
		param_status.param_list[3].value = LCD_LEVEL;
		param_status.param_list[4].ident = __SWITCH_SEL;
		param_status.param_list[4].value = SWITCH_SEL;
		param_status.param_list[5].ident = __PHONE_DEBUG_ON;
		param_status.param_list[5].value = PHONE_DEBUG_ON;
		param_status.param_list[6].ident = __LCD_DIM_LEVEL;
		param_status.param_list[6].value = LCD_DIM_LEVEL;
		param_status.param_list[7].ident = __MELODY_MODE;
		param_status.param_list[7].value = MELODY_MODE;
		param_status.param_list[8].ident = __REBOOT_MODE;
		param_status.param_list[8].value = REBOOT_MODE;
		param_status.param_list[9].ident = __NATION_SEL;
		param_status.param_list[9].value = NATION_SEL;
		param_status.param_list[10].ident = __SET_DEFAULT_PARAM;
		param_status.param_list[10].value = SET_DEFAULT_PARAM;
		param_status.param_str_list[0].ident = __VERSION;
		strlcpy(param_status.param_str_list[0].value,
			VERSION_LINE, PARAM_STRING_SIZE);
		param_status.param_str_list[1].ident = __CMDLINE;
		strlcpy(param_status.param_str_list[1].value,
			COMMAND_LINE, PARAM_STRING_SIZE);

	}

	sec_set_param_value = set_param_value;
	sec_get_param_value = get_param_value;

        printk("%s end\n", __func__);
	return 0;
}
Пример #2
0
static int param_init(void)
{
	int ret;

	ret = load_param_value();
	if (ret < 0) {
		printk(KERN_ERR "%s -> relocated to default value!\n", __FUNCTION__);

		memset(&param_status, 0, sizeof(status_t));

		param_status.param_magic = PARAM_MAGIC;
		param_status.param_version = PARAM_VERSION;
		param_status.param_list[0].ident = __SERIAL_SPEED;
		param_status.param_list[0].value = SERIAL_SPEED;
		param_status.param_list[1].ident = __LOAD_RAMDISK;
		param_status.param_list[1].value = LOAD_RAMDISK;
		param_status.param_list[2].ident = __BOOT_DELAY;
		param_status.param_list[2].value = BOOT_DELAY;
		param_status.param_list[3].ident = __LCD_LEVEL;
		param_status.param_list[3].value = LCD_LEVEL;
		param_status.param_list[4].ident = __SWITCH_SEL;
		param_status.param_list[4].value = SWITCH_SEL;
		param_status.param_list[5].ident = __PHONE_DEBUG_ON;
		param_status.param_list[5].value = PHONE_DEBUG_ON;
		param_status.param_list[6].ident = __LCD_DIM_LEVEL;
		param_status.param_list[6].value = LCD_DIM_LEVEL;
		param_status.param_list[7].ident = __MELODY_MODE;
		param_status.param_list[7].value = MELODY_MODE;
		param_status.param_list[8].ident = __REBOOT_MODE;
		param_status.param_list[8].value = REBOOT_MODE;
		param_status.param_list[9].ident = __NATION_SEL;
		param_status.param_list[9].value = NATION_SEL;
		param_status.param_list[10].ident = __SET_DEFAULT_PARAM;
		param_status.param_list[10].value = SET_DEFAULT_PARAM;
#ifdef CONFIG_MACH_CYGNUS
		param_status.param_list[11].ident = __TSP_FACTORY_CAL_DONE;
		param_status.param_list[11].value = SET_TSP_FACTORY_CAL;
#endif
#ifdef CONFIG_MACH_SATURN
		param_status.param_list[12].ident = __AUTO_RAMDUMP_MODE;
		param_status.param_list[12].value = AUTO_RAMDUMP_MODE;
#endif
		param_status.param_str_list[0].ident = __VERSION;
		strlcpy(param_status.param_str_list[0].value,
			VERSION_LINE, PARAM_STRING_SIZE);
		param_status.param_str_list[1].ident = __CMDLINE;
		strlcpy(param_status.param_str_list[1].value,
			COMMAND_LINE, PARAM_STRING_SIZE);

#ifdef CONFIG_MACH_CYGNUS
		// For Store Cygnus TSP Factory Cal Data
		param_status.param_str_list[2].ident = __TSP_FACTORY_CAL;
		strlcpy(param_status.param_str_list[2].value,
			FACTORY_TSP_CAL, PARAM_STRING_SIZE);
#endif
	}

	sec_set_param_value = set_param_value;
	sec_get_param_value = get_param_value;

	return 0;
}
Пример #3
0
static int param_init(void)
{
	int ret;

#ifdef PARAM_USE_INIT_BUFFER
	param_buf = kmalloc(PARAM_LEN, GFP_KERNEL);
	if (!param_buf) {
		kloge("Unable to alloc param_buf!");
		return -ENOMEM;
	}

	image_buf = kmalloc(IMAGE_LEN, GFP_KERNEL);
	if (!image_buf) {
		kloge("Unable to alloc image_buf!");
		kfree(param_buf);
		return -ENOMEM;
	}
#endif

#ifdef PARAM_PROCFS_DEBUG
	struct proc_dir_entry *ent;

	/* Creats '/proc/param' directory */
	param_dir = proc_mkdir("param", NULL);
	if (param_dir == NULL) {
		kloge("Unable to create /proc/param directory\n");
		return -ENOMEM;
	}

	/* Creats RW '/proc/param/sleep/debug' entry */
	ent = create_proc_entry("debug", 0, param_dir);
	if (ent == NULL) {
		kloge("Unable to create /proc/param/debug entry");
		ret = -ENOMEM;
		goto fail;
	}
	ent->read_proc = param_read_proc_debug;
	ent->write_proc = param_write_proc_debug;
#endif

	klogi("param_init");

#if 0
	ret = load_param_value();
#else
	ret = load_lfs_param_value();
#endif
	if (ret < 0) {
		kloge("Loading parameters failed. Parameters have been initialized as default.");
		param_set_default();
	}

	sec_set_param_value = set_param_value;
	sec_get_param_value = get_param_value;

	return 0;

#ifdef PARAM_PROCFS_DEBUG
fail:
	remove_proc_entry("param", 0);

#ifdef PARAM_USE_INIT_BUFFER
	kfree(param_buf);
	kfree(image_buf);
#endif
	
	return ret;
#endif
}