Ejemplo n.º 1
0
int share_region_handle(void)
{
	if (!check_share_region()) {
		memset(share_region, 0x0, 0x1000);	
	}
	
	tmp = share_region->flags.kernel_flag;  //this can clear the flag
	memset(share_region, 0x0, 0x1000);
	share_region->flags.uboot_flag = tmp;

	return recovery_handle();
}
Ejemplo n.º 2
0
void share_region_handle(void)
{
   if (FLAG_RECOVER_MODE == share_region->flags) {
	gRebootRecovery = 1;
	printf("share_region->flags=%d\n", share_region->flags);	
  }
  if(!check_share_region())
  {
		//printf("Share region: CRC invalid.\n"); 
	memset(share_region, 0x0, sizeof(share_region_t));
  }
	save_share_region();
}
Ejemplo n.º 3
0
int __init share_region_init(void)
{
	unsigned int i;
	struct proc_dir_entry *dir;
	
	share_region = ioremap(SHARE_REGION_BASE, SHARE_REGION_SIZE);

	printk("share_region checksum = %lx, and flag = %x\n", share_region->checksum, share_region->flags.uboot_flag);
	if (!share_region)
		printk("++++++++++++++++++++++++++++++++++fail to reserve!\n");
#if 0
	for (i = 0; i < 10; i++) {
		printk("%d:[%0x] = %x\n", i, share_region + 4*i, *(unsigned int *)(share_region + 4*i));

	}
#endif 
	if (!check_share_region()) {
		printk("+++++++++++++++++++++++++++++++++++share_region invalid\n");
		clear_flags();
	}

	dir = proc_mkdir("share_region", NULL);
	if (!dir) {
		printk("could not create /proc/share_region\n");
	}
	
	for (i =0 ; i < (sizeof(flag_proc) / sizeof(*flag_proc)); i++) {
		struct proc_dir_entry *tmp;
		mode_t mode;

		mode = 0;
		if (flag_proc[i].flag_get) {
			mode |= S_IRUGO;
		}
		if (flag_proc[i].flag_set) {
			mode |= S_IWUGO;
		}
		
		tmp = create_proc_entry(flag_proc[i].path, mode, dir);
		if (tmp) {
			tmp->data = (void *)&flag_proc[i];
			tmp->read_proc = proc_flag_read;
			tmp->write_proc = proc_flag_write;
		}
		else {
			printk("could not create /proc/share_region/%s\n", flag_proc[i].path);
		}

	}
	return i;
}