diff options
Diffstat (limited to 'drivers/acpi/processor_idle.c')
| -rw-r--r-- | drivers/acpi/processor_idle.c | 93 | 
1 files changed, 18 insertions, 75 deletions
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index f98dd00b51a..3dca36d4ad2 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -35,6 +35,7 @@  #include <linux/clockchips.h>  #include <linux/cpuidle.h>  #include <linux/syscore_ops.h> +#include <acpi/processor.h>  /*   * Include the apic definitions for x86 to have the APIC timer related defines @@ -46,9 +47,6 @@  #include <asm/apic.h>  #endif -#include <acpi/acpi_bus.h> -#include <acpi/processor.h> -  #define PREFIX "ACPI: "  #define ACPI_PROCESSOR_CLASS            "processor" @@ -119,17 +117,10 @@ static struct dmi_system_id processor_power_dmi_table[] = {   */  static void acpi_safe_halt(void)  { -	current_thread_info()->status &= ~TS_POLLING; -	/* -	 * TS_POLLING-cleared state must be visible before we -	 * test NEED_RESCHED: -	 */ -	smp_mb(); -	if (!need_resched()) { +	if (!tif_need_resched()) {  		safe_halt();  		local_irq_disable();  	} -	current_thread_info()->status |= TS_POLLING;  }  #ifdef ARCH_APICTIMER_STOPS_ON_C3 @@ -220,7 +211,7 @@ static int acpi_processor_suspend(void)  static void acpi_processor_resume(void)  { -	u32 resumed_bm_rld; +	u32 resumed_bm_rld = 0;  	acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &resumed_bm_rld);  	if (resumed_bm_rld == saved_bm_rld) @@ -272,9 +263,6 @@ static void tsc_check_state(int state) { return; }  static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)  { -	if (!pr) -		return -EINVAL; -  	if (!pr->pblk)  		return -ENODEV; @@ -608,7 +596,7 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)  		case ACPI_STATE_C2:  			if (!cx->address)  				break; -			cx->valid = 1;  +			cx->valid = 1;  			break;  		case ACPI_STATE_C3: @@ -790,19 +778,12 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,  	if (unlikely(!pr))  		return -EINVAL; -	if (cx->entry_method != ACPI_CSTATE_FFH) { -		current_thread_info()->status &= ~TS_POLLING; -		/* -		 * TS_POLLING-cleared state must be visible before we test -		 * NEED_RESCHED: -		 */ -		smp_mb(); - -		if (unlikely(need_resched())) { -			current_thread_info()->status |= TS_POLLING; -			return -EINVAL; -		} -	} +#ifdef CONFIG_HOTPLUG_CPU +	if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && +	    !pr->flags.has_cst && +	    !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) +		return acpi_idle_enter_c1(dev, drv, CPUIDLE_DRIVER_STATE_START); +#endif  	/*  	 * Must be done before busmaster disable as we might need to @@ -819,9 +800,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,  	sched_clock_idle_wakeup_event(0); -	if (cx->entry_method != ACPI_CSTATE_FFH) -		current_thread_info()->status |= TS_POLLING; -  	lapic_timer_state_broadcast(pr, cx, 0);  	return index;  } @@ -848,6 +826,13 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,  	if (unlikely(!pr))  		return -EINVAL; +#ifdef CONFIG_HOTPLUG_CPU +	if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && +	    !pr->flags.has_cst && +	    !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) +		return acpi_idle_enter_c1(dev, drv, CPUIDLE_DRIVER_STATE_START); +#endif +  	if (!cx->bm_sts_skip && acpi_idle_bm_check()) {  		if (drv->safe_state_index >= 0) {  			return drv->states[drv->safe_state_index].enter(dev, @@ -858,20 +843,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,  		}  	} -	if (cx->entry_method != ACPI_CSTATE_FFH) { -		current_thread_info()->status &= ~TS_POLLING; -		/* -		 * TS_POLLING-cleared state must be visible before we test -		 * NEED_RESCHED: -		 */ -		smp_mb(); - -		if (unlikely(need_resched())) { -			current_thread_info()->status |= TS_POLLING; -			return -EINVAL; -		} -	} -  	acpi_unlazy_tlb(smp_processor_id());  	/* Tell the scheduler that we are going deep-idle: */ @@ -915,9 +886,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,  	sched_clock_idle_wakeup_event(0); -	if (cx->entry_method != ACPI_CSTATE_FFH) -		current_thread_info()->status |= TS_POLLING; -  	lapic_timer_state_broadcast(pr, cx, 0);  	return index;  } @@ -961,12 +929,6 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr,  		if (!cx->valid)  			continue; -#ifdef CONFIG_HOTPLUG_CPU -		if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && -		    !pr->flags.has_cst && -		    !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) -			continue; -#endif  		per_cpu(acpi_cstate[count], dev->cpu) = cx;  		count++; @@ -974,8 +936,6 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr,  			break;  	} -	dev->state_count = count; -  	if (!count)  		return -EINVAL; @@ -1016,13 +976,6 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)  		if (!cx->valid)  			continue; -#ifdef CONFIG_HOTPLUG_CPU -		if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && -		    !pr->flags.has_cst && -		    !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) -			continue; -#endif -  		state = &drv->states[count];  		snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i);  		strncpy(state->desc, cx->desc, CPUIDLE_DESC_LEN); @@ -1076,12 +1029,8 @@ int acpi_processor_hotplug(struct acpi_processor *pr)  	if (disabled_by_idle_boot_param())  		return 0; -	if (!pr) -		return -EINVAL; - -	if (nocst) { +	if (nocst)  		return -ENODEV; -	}  	if (!pr->flags.power_setup_done)  		return -ENODEV; @@ -1108,9 +1057,6 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)  	if (disabled_by_idle_boot_param())  		return 0; -	if (!pr) -		return -EINVAL; -  	if (nocst)  		return -ENODEV; @@ -1183,9 +1129,6 @@ int acpi_processor_power_init(struct acpi_processor *pr)  		first_run++;  	} -	if (!pr) -		return -EINVAL; -  	if (acpi_gbl_FADT.cst_control && !nocst) {  		status =  		    acpi_os_write_port(acpi_gbl_FADT.smi_command, acpi_gbl_FADT.cst_control, 8);  | 
