Example #1
0
bool mcidle_can_enter(int cpu)
{
    int reason = NR_REASONS;

#if 0//core0 not pd
    if (cpu == 0) {
        reason = BY_OTH;
        goto mcidle_out;
    }
#endif

    /*if hotplug-ing, can't enter mcdi avoid bootslave corrupt*/
    if (atomic_read(&is_in_hotplug) >= 1) {
        reason = BY_CPU;
        goto mcidle_out;
    }    

    if (atomic_read(&hotplug_cpu_count) == 1) {
        reason = BY_CPU;
        goto mcidle_out;
    }
    
    if(spm_mcdi_can_enter()==0)
    {
        reason = BY_OTH;
        goto mcidle_out;
        
    }    
    
    mcidle_timer_left[cpu] = localtimer_get_counter();
    if (mcidle_timer_left[cpu] < mcidle_time_critera || 
            ((int)mcidle_timer_left[cpu]) < 0) {
        reason = BY_TMR;
        goto mcidle_out;
    }


mcidle_out:
    if (reason < NR_REASONS) {
        mcidle_block_cnt[cpu][reason]++;
        return false;
    } else {
        return true;
    }
}
bool mcidle_can_enter(int cpu)
{
    int reason = NR_REASONS;

    if(cpu==0){
        reason = BY_VTG;
        goto mcidle_out;
    }

    if(idle_spm_lock){
        reason = BY_VTG;
        goto mcidle_out;
    }

    if (atomic_read(&hotplug_cpu_count) == 1) {
        reason = BY_CPU;
        goto mcidle_out;
    }

    if(spm_mcdi_can_enter()==0)
    {
        reason = BY_OTH;
        goto mcidle_out;

    }

    mcidle_timer_left[cpu] = localtimer_get_counter();
    if (mcidle_timer_left[cpu] < mcidle_time_critera ||
            ((int)mcidle_timer_left[cpu]) < 0) {
        reason = BY_TMR;
        goto mcidle_out;
    }


mcidle_out:
    if (reason < NR_REASONS) {
        mcidle_block_cnt[cpu][reason]++;
        return false;
    } else {
        return true;
    }
}