]> err.no Git - linux-2.6/blobdiff - drivers/acpi/processor_idle.c
Merge git://git.infradead.org/mtd-2.6
[linux-2.6] / drivers / acpi / processor_idle.c
index 556ee1585192e10c0f35d79630d6d3a934cbcf8d..b7f2963693a7b40fa2bc336dad5ae4cf0d9a8fbf 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/pm_qos_params.h>
 #include <linux/clockchips.h>
 #include <linux/cpuidle.h>
+#include <linux/cpuidle.h>
 
 /*
  * Include the apic definitions for x86 to have the APIC timer related defines
@@ -57,6 +58,7 @@
 
 #include <acpi/acpi_bus.h>
 #include <acpi/processor.h>
+#include <asm/processor.h>
 
 #define ACPI_PROCESSOR_COMPONENT        0x01000000
 #define ACPI_PROCESSOR_CLASS            "processor"
@@ -270,6 +272,8 @@ static atomic_t c3_cpu_count;
 /* Common C-state entry for C2, C3, .. */
 static void acpi_cstate_enter(struct acpi_processor_cx *cstate)
 {
+       /* Don't trace irqs off for idle */
+       stop_critical_timings();
        if (cstate->entry_method == ACPI_CSTATE_FFH) {
                /* Call into architectural FFH based C-state */
                acpi_processor_ffh_cstate_enter(cstate);
@@ -282,6 +286,7 @@ static void acpi_cstate_enter(struct acpi_processor_cx *cstate)
                   gets asserted in time to freeze execution properly. */
                unused = inl(acpi_gbl_FADT.xpm_timer_block.address);
        }
+       start_critical_timings();
 }
 #endif /* !CONFIG_CPU_IDLE */
 
@@ -401,7 +406,7 @@ static void acpi_processor_idle(void)
         */
        local_irq_disable();
 
-       pr = processors[smp_processor_id()];
+       pr = __get_cpu_var(processors);
        if (!pr) {
                local_irq_enable();
                return;
@@ -955,6 +960,21 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr)
                        } else {
                                continue;
                        }
+                       if (cx.type == ACPI_STATE_C1 &&
+                                       (idle_halt || idle_nomwait)) {
+                               /*
+                                * In most cases the C1 space_id obtained from
+                                * _CST object is FIXED_HARDWARE access mode.
+                                * But when the option of idle=halt is added,
+                                * the entry_method type should be changed from
+                                * CSTATE_FFH to CSTATE_HALT.
+                                * When the option of idle=nomwait is added,
+                                * the C1 entry_method type should be
+                                * CSTATE_HALT.
+                                */
+                               cx.entry_method = ACPI_CSTATE_HALT;
+                               snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI HLT");
+                       }
                } else {
                        snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI IOPORT 0x%x",
                                 cx.address);
@@ -1339,7 +1359,7 @@ static void smp_callback(void *v)
 static int acpi_processor_latency_notify(struct notifier_block *b,
                unsigned long l, void *v)
 {
-       smp_call_function(smp_callback, NULL, 0, 1);
+       smp_call_function(smp_callback, NULL, 1);
        return NOTIFY_OK;
 }
 
@@ -1401,6 +1421,8 @@ static inline void acpi_idle_update_bm_rld(struct acpi_processor *pr,
  */
 static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)
 {
+       /* Don't trace irqs off for idle */
+       stop_critical_timings();
        if (cx->entry_method == ACPI_CSTATE_FFH) {
                /* Call into architectural FFH based C-state */
                acpi_processor_ffh_cstate_enter(cx);
@@ -1415,6 +1437,7 @@ static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)
                   gets asserted in time to freeze execution properly. */
                unused = inl(acpi_gbl_FADT.xpm_timer_block.address);
        }
+       start_critical_timings();
 }
 
 /**
@@ -1431,7 +1454,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
        struct acpi_processor *pr;
        struct acpi_processor_cx *cx = cpuidle_get_statedata(state);
 
-       pr = processors[smp_processor_id()];
+       pr = __get_cpu_var(processors);
 
        if (unlikely(!pr))
                return 0;
@@ -1471,7 +1494,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
        u32 t1, t2;
        int sleep_ticks = 0;
 
-       pr = processors[smp_processor_id()];
+       pr = __get_cpu_var(processors);
 
        if (unlikely(!pr))
                return 0;
@@ -1549,7 +1572,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
        u32 t1, t2;
        int sleep_ticks = 0;
 
-       pr = processors[smp_processor_id()];
+       pr = __get_cpu_var(processors);
 
        if (unlikely(!pr))
                return 0;
@@ -1780,6 +1803,15 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
                return 0;
 
        if (!first_run) {
+               if (idle_halt) {
+                       /*
+                        * When the boot option of "idle=halt" is added, halt
+                        * is used for CPU IDLE.
+                        * In such case C2/C3 is meaningless. So the max_cstate
+                        * is set to one.
+                        */
+                       max_cstate = 1;
+               }
                dmi_check_system(processor_power_dmi_table);
                max_cstate = acpi_processor_cstate_check(max_cstate);
                if (max_cstate < ACPI_C_STATES_MAX)