コード例 #1
0
ファイル: octeon-irq.c プロジェクト: CSCLOG/beaglebone
static int octeon_cpu_for_coreid(int coreid)
{
#ifdef CONFIG_SMP
	return cpu_number_map(coreid);
#else
	return smp_processor_id();
#endif
}
コード例 #2
0
ファイル: smp.c プロジェクト: abdullahvelioglu/linux
void play_dead(void)
{
	int cpu = cpu_number_map(cvmx_get_core_num());

	idle_task_exit();
	octeon_processor_boot = 0xff;
	per_cpu(cpu_state, cpu) = CPU_DEAD;

	mb();

	while (1)	/* core will be reset here */
		;
}
コード例 #3
0
ファイル: smp.c プロジェクト: iPodLinux/linux-2.6.7-ipod
/* Code goes along with:
**    entry.s:        ENTRY_NAME(sys_cpus)   / * 215, for cpu stat * /
*/
int sys_cpus(int argc, char **argv)
{
	int i,j=0;
	extern int current_pid(int cpu);

	if( argc > 2 ) {
		printk("sys_cpus:Only one argument supported\n");
		return (-1);
	}
	if ( argc == 1 ){
	
#ifdef DUMP_MORE_STATE
		for(i=0; i<NR_CPUS; i++) {
			int cpus_per_line = 4;
			if(cpu_online(i)) {
				if (j++ % cpus_per_line)
					printk(" %3d",i);
				else
					printk("\n %3d",i);
			}
		}
		printk("\n"); 
#else
	    	printk("\n 0\n"); 
#endif
	} else if((argc==2) && !(strcmp(argv[1],"-l"))) {
		printk("\nCPUSTATE  TASK CPUNUM CPUID HARDCPU(HPA)\n");
#ifdef DUMP_MORE_STATE
		for(i=0;i<NR_CPUS;i++) {
			if (!cpu_online(i))
				continue;
			if (cpu_data[i].cpuid != NO_PROC_ID) {
				switch(cpu_data[i].state) {
					case STATE_RENDEZVOUS:
						printk("RENDEZVS ");
						break;
					case STATE_RUNNING:
						printk((current_pid(i)!=0) ? "RUNNING  " : "IDLING   ");
						break;
					case STATE_STOPPED:
						printk("STOPPED  ");
						break;
					case STATE_HALTED:
						printk("HALTED   ");
						break;
					default:
						printk("%08x?", cpu_data[i].state);
						break;
				}
				if(cpu_online(i)) {
					printk(" %4d",current_pid(i));
				}	
				printk(" %6d",cpu_number_map(i));
				printk(" %5d",i);
				printk(" 0x%lx\n",cpu_data[i].hpa);
			}	
		}
#else
		printk("\n%s  %4d      0     0 --------",
			(current->pid)?"RUNNING ": "IDLING  ",current->pid); 
#endif
	} else if ((argc==2) && !(strcmp(argv[1],"-s"))) { 
#ifdef DUMP_MORE_STATE
     		printk("\nCPUSTATE   CPUID\n");
		for (i=0;i<NR_CPUS;i++) {
			if (!cpu_online(i))
				continue;
			if (cpu_data[i].cpuid != NO_PROC_ID) {
				switch(cpu_data[i].state) {
					case STATE_RENDEZVOUS:
						printk("RENDEZVS");break;
					case STATE_RUNNING:
						printk((current_pid(i)!=0) ? "RUNNING " : "IDLING");
						break;
					case STATE_STOPPED:
						printk("STOPPED ");break;
					case STATE_HALTED:
						printk("HALTED  ");break;
					default:
				}
				printk("  %5d\n",i);
			}	
		}
#else
		printk("\n%s    CPU0",(current->pid==0)?"RUNNING ":"IDLING  "); 
#endif
	} else {
コード例 #4
0
void nlm_common_oprofile_int_handler(int irq, void * dev_id,
	struct pt_regs *regs)
{
	uint32_t counter1, counter2;
	uint32_t control1, control2;
	int i;
	int cpu_id = netlogic_cpu_id() * 4; /* 0, 4, 8 ... 28 */
	int h_id = hard_smp_processor_id();/* 0, 1, 2, 3, 4, .....31 */
	int ret, lcpu;
	int sample1_taken=0;
	int sample2_taken=0;
	extern struct plat_smp_ops *mp_ops;

	if(g_stop_pmc[h_id])
		return;

	if(((ret = nlm_common_pmc_owner_nolock()) == 0)) {
		/* if any counter overflow occured on this core.... */
		if(nlm_common_pc_of_mask1[h_id]) {
			oprofile_add_sample(regs, 0);
		}
		if(nlm_common_pc_of_mask2[h_id]) {
			oprofile_add_sample(regs, 1);
		}
		return;
	}

	control1 = __read_32bit_c0_register ($25, 0);
	control2 = __read_32bit_c0_register ($25, 2);


	counter1 = __read_32bit_c0_register ($25, 1);
	counter2 = __read_32bit_c0_register ($25, 3);

	if (((int)counter1) < 0) {
		__write_32bit_c0_register($25, 0, 0);
		oprofile_add_sample(regs, 0);
		counter1 = reg.reset_counter[0];
		sample1_taken = 1;

		for(i=0; i < 4; i++)
			nlm_common_pc_of_mask1[cpu_id + i] = 1;
		wmb();
		for(i=1; i < 4; i++) {
			lcpu = cpu_number_map(cpu_id+i);
			if(lcpu && cpu_isset(lcpu, cpu_online_map)) {
				mp_ops->send_ipi_single(lcpu, SMP_OPROFILE_IPI);
			}
		}
	}
	if (((int)counter2) < 0) {
		__write_32bit_c0_register($25, 2, 0);
		oprofile_add_sample(regs, 1);
		counter2 = reg.reset_counter[1];
		sample2_taken = 1;

		for(i=0; i < 4; i++)
			nlm_common_pc_of_mask2[cpu_id + i] = 1;
		wmb();
		for(i=1; i < 4; i++) {
			lcpu = cpu_number_map(cpu_id+i);
			if(lcpu && cpu_isset(lcpu, cpu_online_map)) {
				mp_ops->send_ipi_single(lcpu, SMP_OPROFILE_IPI);
			}
		}
	}

	if(sample1_taken) {
		__write_32bit_c0_register($25, 1, counter1);
		__write_32bit_c0_register($25, 0, reg.control[0]);
	}
	if(sample2_taken) {
		__write_32bit_c0_register($25, 3, counter2);
		__write_32bit_c0_register($25, 2, reg.control[1]);
	}

	return ;
}