]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/acpi/processor_idle.c
[ACPI] merge 3549 4320 4485 4588 4980 5483 5651 acpica asus fops pnpacpi branches...
[karo-tx-linux.git] / drivers / acpi / processor_idle.c
index 40c9f9ca5965c789096eedbde292e7f55af73739..be2dae52f6fa47a6b74dbca63c47a553236cfd27 100644 (file)
@@ -95,22 +95,57 @@ static int set_max_cstate(struct dmi_system_id *id)
 }
 
 static struct dmi_system_id __initdata processor_power_dmi_table[] = {
-       {set_max_cstate, "IBM ThinkPad R40e", {
-                                              DMI_MATCH(DMI_BIOS_VENDOR,
-                                                        "IBM"),
-                                              DMI_MATCH(DMI_BIOS_VERSION,
-                                                        "1SET60WW")},
-        (void *)1},
-       {set_max_cstate, "Medion 41700", {
-                                         DMI_MATCH(DMI_BIOS_VENDOR,
-                                                   "Phoenix Technologies LTD"),
-                                         DMI_MATCH(DMI_BIOS_VERSION,
-                                                   "R01-A1J")}, (void *)1},
-       {set_max_cstate, "Clevo 5600D", {
-                                        DMI_MATCH(DMI_BIOS_VENDOR,
-                                                  "Phoenix Technologies LTD"),
-                                        DMI_MATCH(DMI_BIOS_VERSION,
-                                                  "SHE845M0.86C.0013.D.0302131307")},
+       { set_max_cstate, "IBM ThinkPad R40e", {
+         DMI_MATCH(DMI_BIOS_VENDOR,"IBM"),
+         DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW")}, (void *)1},
+       { set_max_cstate, "IBM ThinkPad R40e", {
+         DMI_MATCH(DMI_BIOS_VENDOR,"IBM"),
+         DMI_MATCH(DMI_BIOS_VERSION,"1SET43WW") }, (void*)1},
+       { set_max_cstate, "IBM ThinkPad R40e", {
+         DMI_MATCH(DMI_BIOS_VENDOR,"IBM"),
+         DMI_MATCH(DMI_BIOS_VERSION,"1SET45WW") }, (void*)1},
+       { set_max_cstate, "IBM ThinkPad R40e", {
+         DMI_MATCH(DMI_BIOS_VENDOR,"IBM"),
+         DMI_MATCH(DMI_BIOS_VERSION,"1SET47WW") }, (void*)1},
+       { set_max_cstate, "IBM ThinkPad R40e", {
+         DMI_MATCH(DMI_BIOS_VENDOR,"IBM"),
+         DMI_MATCH(DMI_BIOS_VERSION,"1SET50WW") }, (void*)1},
+       { set_max_cstate, "IBM ThinkPad R40e", {
+         DMI_MATCH(DMI_BIOS_VENDOR,"IBM"),
+         DMI_MATCH(DMI_BIOS_VERSION,"1SET52WW") }, (void*)1},
+       { set_max_cstate, "IBM ThinkPad R40e", {
+         DMI_MATCH(DMI_BIOS_VENDOR,"IBM"),
+         DMI_MATCH(DMI_BIOS_VERSION,"1SET55WW") }, (void*)1},
+       { set_max_cstate, "IBM ThinkPad R40e", {
+         DMI_MATCH(DMI_BIOS_VENDOR,"IBM"),
+         DMI_MATCH(DMI_BIOS_VERSION,"1SET56WW") }, (void*)1},
+       { set_max_cstate, "IBM ThinkPad R40e", {
+         DMI_MATCH(DMI_BIOS_VENDOR,"IBM"),
+         DMI_MATCH(DMI_BIOS_VERSION,"1SET59WW") }, (void*)1},
+       { set_max_cstate, "IBM ThinkPad R40e", {
+         DMI_MATCH(DMI_BIOS_VENDOR,"IBM"),
+         DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }, (void*)1},
+       { set_max_cstate, "IBM ThinkPad R40e", {
+         DMI_MATCH(DMI_BIOS_VENDOR,"IBM"),
+         DMI_MATCH(DMI_BIOS_VERSION,"1SET61WW") }, (void*)1},
+       { set_max_cstate, "IBM ThinkPad R40e", {
+         DMI_MATCH(DMI_BIOS_VENDOR,"IBM"),
+         DMI_MATCH(DMI_BIOS_VERSION,"1SET62WW") }, (void*)1},
+       { set_max_cstate, "IBM ThinkPad R40e", {
+         DMI_MATCH(DMI_BIOS_VENDOR,"IBM"),
+         DMI_MATCH(DMI_BIOS_VERSION,"1SET64WW") }, (void*)1},
+       { set_max_cstate, "IBM ThinkPad R40e", {
+         DMI_MATCH(DMI_BIOS_VENDOR,"IBM"),
+         DMI_MATCH(DMI_BIOS_VERSION,"1SET65WW") }, (void*)1},
+       { set_max_cstate, "IBM ThinkPad R40e", {
+         DMI_MATCH(DMI_BIOS_VENDOR,"IBM"),
+         DMI_MATCH(DMI_BIOS_VERSION,"1SET68WW") }, (void*)1},
+       { set_max_cstate, "Medion 41700", {
+         DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"),
+         DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J")}, (void *)1},
+       { set_max_cstate, "Clevo 5600D", {
+         DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"),
+         DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307")},
         (void *)2},
        {},
 };
@@ -169,15 +204,11 @@ acpi_processor_power_activate(struct acpi_processor *pr,
 
 static void acpi_safe_halt(void)
 {
-       int polling = test_thread_flag(TIF_POLLING_NRFLAG);
-       if (polling) {
-               clear_thread_flag(TIF_POLLING_NRFLAG);
-               smp_mb__after_clear_bit();
-       }
+       clear_thread_flag(TIF_POLLING_NRFLAG);
+       smp_mb__after_clear_bit();
        if (!need_resched())
                safe_halt();
-       if (polling)
-               set_thread_flag(TIF_POLLING_NRFLAG);
+       set_thread_flag(TIF_POLLING_NRFLAG);
 }
 
 static atomic_t c3_cpu_count;
@@ -278,8 +309,6 @@ static void acpi_processor_idle(void)
                }
        }
 
-       cx->usage++;
-
 #ifdef CONFIG_HOTPLUG_CPU
        /*
         * Check for P_LVL2_UP flag before entering C2 and above on
@@ -287,14 +316,27 @@ static void acpi_processor_idle(void)
         * detection phase, to work cleanly with logical CPU hotplug.
         */
        if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && 
-           !pr->flags.has_cst && acpi_fadt.plvl2_up)
-               cx->type = ACPI_STATE_C1;
+           !pr->flags.has_cst && !acpi_fadt.plvl2_up)
+               cx = &pr->power.states[ACPI_STATE_C1];
 #endif
+
+       cx->usage++;
+
        /*
         * Sleep:
         * ------
         * Invoke the current Cx state to put the processor to sleep.
         */
+       if (cx->type == ACPI_STATE_C2 || cx->type == ACPI_STATE_C3) {
+               clear_thread_flag(TIF_POLLING_NRFLAG);
+               smp_mb__after_clear_bit();
+               if (need_resched()) {
+                       set_thread_flag(TIF_POLLING_NRFLAG);
+                       local_irq_enable();
+                       return;
+               }
+       }
+
        switch (cx->type) {
 
        case ACPI_STATE_C1:
@@ -327,6 +369,7 @@ static void acpi_processor_idle(void)
                t2 = inl(acpi_fadt.xpm_tmr_blk.address);
                /* Re-enable interrupts */
                local_irq_enable();
+               set_thread_flag(TIF_POLLING_NRFLAG);
                /* Compute time (ticks) that we were actually asleep */
                sleep_ticks =
                    ticks_elapsed(t1, t2) - cx->latency_ticks - C2_OVERHEAD;
@@ -366,6 +409,7 @@ static void acpi_processor_idle(void)
 
                /* Re-enable interrupts */
                local_irq_enable();
+               set_thread_flag(TIF_POLLING_NRFLAG);
                /* Compute time (ticks) that we were actually asleep */
                sleep_ticks =
                    ticks_elapsed(t1, t2) - cx->latency_ticks - C3_OVERHEAD;
@@ -378,6 +422,15 @@ static void acpi_processor_idle(void)
 
        next_state = pr->power.state;
 
+#ifdef CONFIG_HOTPLUG_CPU
+       /* Don't do promotion/demotion */
+       if ((cx->type == ACPI_STATE_C1) && (num_online_cpus() > 1) &&
+           !pr->flags.has_cst && !acpi_fadt.plvl2_up) {
+               next_state = cx;
+               goto end;
+       }
+#endif
+
        /*
         * Promotion?
         * ----------
@@ -541,7 +594,7 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
         * Check for P_LVL2_UP flag before entering C2 and above on
         * an SMP system. 
         */
-       if ((num_online_cpus() > 1) && acpi_fadt.plvl2_up)
+       if ((num_online_cpus() > 1) && !acpi_fadt.plvl2_up)
                return_VALUE(-ENODEV);
 #endif
 
@@ -822,6 +875,15 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
        unsigned int i;
        unsigned int working = 0;
 
+#ifdef ARCH_APICTIMER_STOPS_ON_C3
+       struct cpuinfo_x86 *c = cpu_data + pr->id;
+       cpumask_t mask = cpumask_of_cpu(pr->id);
+
+       if (c->x86_vendor == X86_VENDOR_INTEL) {
+               on_each_cpu(switch_ipi_to_APIC_timer, &mask, 1, 1);
+       }
+#endif
+
        for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
                struct acpi_processor_cx *cx = &pr->power.states[i];
 
@@ -836,6 +898,12 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
 
                case ACPI_STATE_C3:
                        acpi_processor_power_verify_c3(pr, cx);
+#ifdef ARCH_APICTIMER_STOPS_ON_C3
+                       if (c->x86_vendor == X86_VENDOR_INTEL) {
+                               on_each_cpu(switch_APIC_timer_to_ipi,
+                                               &mask, 1, 1);
+                       }
+#endif
                        break;
                }
 
@@ -1031,8 +1099,6 @@ int acpi_processor_power_init(struct acpi_processor *pr,
                }
        }
 
-       acpi_processor_power_init_pdc(&(pr->power), pr->id);
-       acpi_processor_set_pdc(pr, pr->power.pdc);
        acpi_processor_get_power_info(pr);
 
        /*