[ACPI] Add support for FADT P_LVL2_UP flag
authorVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Thu, 15 Sep 2005 16:20:00 +0000 (12:20 -0400)
committerLen Brown <len.brown@intel.com>
Wed, 30 Nov 2005 08:23:52 +0000 (03:23 -0500)
which tells us if C2 is valid for UP-only, or SMP.

As there is no separate bit for C3,  use P_LVL2_UP
bit to cover both C2 and C3.

http://bugzilla.kernel.org/show_bug.cgi?id=5165

Signed-off-by: Venkatesh Pallipadi<venkatesh.pallipadi@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
(cherry picked from 28b86b368af3944eb383078fc5797caf2dc8ce44 commit)

drivers/acpi/processor_idle.c

index 5b6a9865300e94fc27b01be32a508c7c384b0ec6..83fd1b6c10c41e7ddb62c271661523ef3affafc9 100644 (file)
@@ -280,6 +280,16 @@ static void acpi_processor_idle(void)
 
        cx->usage++;
 
+#ifdef CONFIG_HOTPLUG_CPU
+       /*
+        * Check for P_LVL2_UP flag before entering C2 and above on
+        * an SMP system. We do it here instead of doing it at _CST/P_LVL
+        * 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;
+#endif
        /*
         * Sleep:
         * ------
@@ -534,6 +544,15 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
        pr->power.states[ACPI_STATE_C0].valid = 1;
        pr->power.states[ACPI_STATE_C1].valid = 1;
 
+#ifndef CONFIG_HOTPLUG_CPU
+       /*
+        * Check for P_LVL2_UP flag before entering C2 and above on
+        * an SMP system. 
+        */
+       if ((num_online_cpus() > 1) && acpi_fadt.plvl2_up)
+               return_VALUE(-ENODEV);
+#endif
+
        /* determine C2 and C3 address from pblk */
        pr->power.states[ACPI_STATE_C2].address = pr->pblk + 4;
        pr->power.states[ACPI_STATE_C3].address = pr->pblk + 5;