示例#1
0
int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
{
	int ret;

	/*
	 * We need to tell the secondary core where to find its stack and the
	 * page tables.
	 */
	secondary_data.stack = task_stack_page(idle) + THREAD_START_SP;
	__flush_dcache_area(&secondary_data, sizeof(secondary_data));

	/*
	 * Now bring the CPU into our world.
	 */
	ret = boot_secondary(cpu, idle);
	if (ret == 0) {
		/*
		 * CPU was successfully started, wait for it to come online or
		 * time out.
		 */
		wait_for_completion_timeout(&cpu_running,
					    msecs_to_jiffies(1000));

		if (!cpu_online(cpu)) {
			pr_crit("CPU%u: failed to come online\n", cpu);
			ret = -EIO;
		}
	} else {
		pr_err("CPU%u: failed to boot: %d\n", cpu, ret);
	}

	secondary_data.stack = NULL;

	return ret;
}
示例#2
0
文件: smp.c 项目: AlexShiLucky/linux
int __cpu_up(unsigned int cpu, struct task_struct *idle)
{
	int ret = 0;

	if (cpu_asid_cache(cpu) == 0)
		cpu_asid_cache(cpu) = ASID_USER_FIRST;

	start_info.stack = (unsigned long)task_pt_regs(idle);
	wmb();

	pr_debug("%s: Calling wakeup_secondary(cpu:%d, idle:%p, sp: %08lx)\n",
			__func__, cpu, idle, start_info.stack);

	init_completion(&cpu_running);
	ret = boot_secondary(cpu, idle);
	if (ret == 0) {
		wait_for_completion_timeout(&cpu_running,
				msecs_to_jiffies(1000));
		if (!cpu_online(cpu))
			ret = -EIO;
	}

	if (ret)
		pr_err("CPU %u failed to boot\n", cpu);

	return ret;
}
示例#3
0
int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
{
	int ret,res;
	int i;
    struct wd_api * wd_api = NULL;
	/*
	 * We need to tell the secondary core where to find its stack and the
	 * page tables.
	 */
	secondary_data.stack = task_stack_page(idle) + THREAD_START_SP;
	__flush_dcache_area(&secondary_data, sizeof(secondary_data));

	/*
	 * Now bring the CPU into our world.
	 */
	ret = boot_secondary(cpu, idle);
	if (ret == 0) {
		/*
		 * CPU was successfully started, wait for it to come online or
		 * time out.
		 */
		wait_for_completion_timeout(&cpu_running,
					    msecs_to_jiffies(1000));

		if (!cpu_online(cpu)) {
			pr_crit("CPU%u: failed to come online\n", cpu);
            #if 1
	        pr_crit("Trigger WDT RESET\n");
            res = get_wd_api(&wd_api);
            if(res) 
            {
              pr_crit("get wd api error !!\n");
            }else {
              wd_api -> wd_sw_reset(3);  //=> this action will ask system to reboot
            }
            #endif
                        
            ret = -EIO;
	        }
	} else {
		pr_err("CPU%u: failed to boot: %d\n", cpu, ret);
	}

	secondary_data.stack = NULL;

	return ret;
}
示例#4
0
文件: smp.c 项目: qiqjiao/openrisc
int __cpu_up(unsigned int cpu, struct task_struct *idle)
{
	int ret;

	secondary_thread_info = task_thread_info(idle);
	current_pgd[cpu] = init_mm.pgd;

	ret = boot_secondary(cpu, idle);
	if (ret == 0) {
		wait_for_completion_timeout(&cpu_running,
					    msecs_to_jiffies(1000));
		if (!cpu_online(cpu))
			ret = -EIO;
	}

	return ret;
}
示例#5
0
int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
{
	int ret,res;
	int i;
  struct wd_api * wd_api = NULL;
	/*
	 * We need to tell the secondary core where to find its stack and the
	 * page tables.
	 */
	secondary_data.stack = task_stack_page(idle) + THREAD_START_SP;
	__flush_dcache_area(&secondary_data, sizeof(secondary_data));

	/*
	 * Now bring the CPU into our world.
	 */
	ret = boot_secondary(cpu, idle);
	if (ret == 0) {
		/*
		 * CPU was successfully started, wait for it to come online or
		 * time out.
		 */
		wait_for_completion_timeout(&cpu_running,
					    msecs_to_jiffies(1000));

		if (!cpu_online(cpu)) {
#if 0
			for(i=0x0;i<=4;i++)
			{
			   REG_WRITE(0x10200404 ,((REG_READ(0x10200404 )&0xffffff00)|i));
			   pr_crit("Cluster0: Set 8'h%x : 0x%x\n",i,REG_READ(0x10200408));
			}
			for(i=0x05;i<=0x15;i++)
			{
			   REG_WRITE(0x10200404 ,((REG_READ(0x10200404 )&0xffffff00)|i));
			   pr_crit("Cluster0: Set 8'h%x : 0x%x\n",i,REG_READ(0x10200408));
			}
			for(i=0x20;i<=0x45;i++)
			{
			   REG_WRITE(0x10200404 ,((REG_READ(0x10200404 )&0xffffff00)|i));
			   pr_crit("Cluster0: Set 8'h%x : 0x%x\n",i,REG_READ(0x10200408));
			}
			
			for(i=0x0;i<=4;i++)
			{
			   REG_WRITE(0x10200504  ,((REG_READ(0x10200504 )&0xffffff00)|i));
			   pr_crit("Cluster0: Set 8'h%x : 0x%x\n",i,REG_READ(0x10200508 ));
			}
			for(i=0x05;i<=0x15;i++)
			{
			   REG_WRITE(0x10200504  ,((REG_READ(0x10200504 )&0xffffff00)|i));
			   pr_crit("Cluster0: Set 8'h%x : 0x%x\n",i,REG_READ(0x10200508 ));
			}
			for(i=0x20;i<=0x45;i++)
			{
			   REG_WRITE(0x10200504  ,((REG_READ(0x10200504 )&0xffffff00)|i));
			   pr_crit("Cluster0: Set 8'h%x : 0x%x\n",i,REG_READ(0x10200508 ));
			}
			
			pr_crit("MPx_AXI_CONFIG: REG 0x1020002c : 0x%x\n", REG_READ(0x1020002c));
			pr_crit("MPx_AXI_CONFIG: REG 0x1020022c : 0x%x\n", REG_READ(0x1020022c));
			pr_crit("ACLKEN_DIV: REG 0x10200640 : 0x%x\n", REG_READ(0x10200640));
			pr_crit("CCI: REG 0x10394000  : 0x%x\n", REG_READ(0x10394000));
			pr_crit("CCI: REG 0x10395000  : 0x%x\n", REG_READ(0x10395000));
#endif
			pr_crit("CPU%u: failed to come online\n", cpu);
                        #if 1
		        pr_crit("Trigger WDT RESET\n");
                        res = get_wd_api(&wd_api);
                        if(res) 
                        {
                          pr_crit("get wd api error !!\n");
                        }else {
                          wd_api -> wd_sw_reset(3);  //=> this action will ask system to reboot
                        }
                        #endif
                        #if 0
			pr_crit("Trigger PMIC full reset.\n");
                        if(check_pmic_wrap_init())
                        {
                          mt_pwrap_hal_init();
                        }
                        pmic_full_reset();
                        #endif
                   ret = -EIO;
	        }
	} else {
		pr_err("CPU%u: failed to boot: %d\n", cpu, ret);
	}

	secondary_data.stack = NULL;

	return ret;
}
示例#6
0
文件: smp.c 项目: bradbishop/linux
int __cpu_up(unsigned int cpu, struct task_struct *idle)
{
	int ret;
	long status;

	/*
	 * We need to tell the secondary core where to find its stack and the
	 * page tables.
	 */
	secondary_data.stack = task_stack_page(idle) + THREAD_START_SP;
	update_cpu_boot_status(CPU_MMU_OFF);
	__flush_dcache_area(&secondary_data, sizeof(secondary_data));

	/*
	 * Now bring the CPU into our world.
	 */
	ret = boot_secondary(cpu, idle);
	if (ret == 0) {
		/*
		 * CPU was successfully started, wait for it to come online or
		 * time out.
		 */
		wait_for_completion_timeout(&cpu_running,
					    msecs_to_jiffies(1000));

		if (!cpu_online(cpu)) {
			pr_crit("CPU%u: failed to come online\n", cpu);
			ret = -EIO;
		}
	} else {
		pr_err("CPU%u: failed to boot: %d\n", cpu, ret);
	}

	secondary_data.stack = NULL;
	status = READ_ONCE(secondary_data.status);
	if (ret && status) {

		if (status == CPU_MMU_OFF)
			status = READ_ONCE(__early_cpu_boot_status);

		switch (status) {
		default:
			pr_err("CPU%u: failed in unknown state : 0x%lx\n",
					cpu, status);
			break;
		case CPU_KILL_ME:
			if (!op_cpu_kill(cpu)) {
				pr_crit("CPU%u: died during early boot\n", cpu);
				break;
			}
			/* Fall through */
			pr_crit("CPU%u: may not have shut down cleanly\n", cpu);
		case CPU_STUCK_IN_KERNEL:
			pr_crit("CPU%u: is stuck in kernel\n", cpu);
			cpus_stuck_in_kernel++;
			break;
		case CPU_PANIC_KERNEL:
			panic("CPU%u detected unsupported configuration\n", cpu);
		}
	}

	return ret;
}