summaryrefslogtreecommitdiff
path: root/usr/src/uts/i86pc/os/cpupm.c
diff options
context:
space:
mode:
authorMark Haywood <Mark.Haywood@Sun.COM>2008-08-13 12:28:54 -0400
committerMark Haywood <Mark.Haywood@Sun.COM>2008-08-13 12:28:54 -0400
commit7f606acec863be28b51fb0f694ca86b41ca76e6d (patch)
tree533d1e3ec55bea148c9f85328f932d93685b87d4 /usr/src/uts/i86pc/os/cpupm.c
parentd3a1459128b677cee1a84512ca49eef4bffd392d (diff)
downloadillumos-joyent-7f606acec863be28b51fb0f694ca86b41ca76e6d.tar.gz
6715149 T-State support for intel based processors
--HG-- rename : usr/src/uts/i86pc/io/cpu_acpi.c => usr/src/uts/i86pc/io/cpudrv/cpu_acpi.c rename : usr/src/uts/i86pc/io/cpudrv_plat.c => usr/src/uts/i86pc/io/cpudrv/cpudrv_mach.c rename : usr/src/uts/i86pc/io/pwrnow.c => usr/src/uts/i86pc/io/cpudrv/pwrnow.c rename : usr/src/uts/i86pc/io/speedstep.c => usr/src/uts/i86pc/io/cpudrv/speedstep.c rename : usr/src/uts/i86pc/sys/cpudrv_plat.h => usr/src/uts/i86pc/sys/cpudrv_mach.h rename : usr/src/uts/sun4u/io/cpudrv_plat.c => usr/src/uts/sun4u/io/cpudrv_mach.c rename : usr/src/uts/sun4u/sys/cpudrv_plat.h => usr/src/uts/sun4u/sys/cpudrv_mach.h
Diffstat (limited to 'usr/src/uts/i86pc/os/cpupm.c')
-rw-r--r--usr/src/uts/i86pc/os/cpupm.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/usr/src/uts/i86pc/os/cpupm.c b/usr/src/uts/i86pc/os/cpupm.c
index 9a5112d9d7..6aad26948a 100644
--- a/usr/src/uts/i86pc/os/cpupm.c
+++ b/usr/src/uts/i86pc/os/cpupm.c
@@ -19,12 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/cpupm.h>
/*
@@ -82,7 +80,7 @@ static boolean_t cpupm_dependencies_valid = B_TRUE;
/*
* If any CPU fails to attach, then cpupm is disabled for all CPUs.
*/
-static boolean_t cpupm_enabled = B_TRUE;
+static uint32_t cpupm_enabled = CPUPM_P_STATES | CPUPM_T_STATES;
/*
* Until all CPUs have succesfully attached, we do not allow
@@ -197,7 +195,7 @@ boolean_t
cpupm_is_ready()
{
#ifndef __xpv
- if (!cpupm_enabled)
+ if (cpupm_enabled == CPUPM_NO_STATES)
return (B_FALSE);
return (cpupm_ready);
#else
@@ -205,16 +203,22 @@ cpupm_is_ready()
#endif
}
+boolean_t
+cpupm_is_enabled(uint32_t state)
+{
+ return ((cpupm_enabled & state) == state);
+}
+
/*
- * By default, cpupm is enabled. But if there are any errors attaching
- * any of the CPU devices, then it is disabled.
+ * By default, all states are enabled. But if there are any errors attaching
+ * any of the CPU devices, then they are disabled.
*/
void
-cpupm_enable(boolean_t enable)
+cpupm_disable(uint32_t state)
{
- if (!enable)
+ cpupm_enabled &= ~state;
+ if (state & CPUPM_P_STATES)
cpupm_free_cpu_dependencies();
- cpupm_enabled = enable;
}
/*
@@ -234,17 +238,10 @@ cpupm_post_startup()
(*cpupm_rebuild_cpu_domains)();
/*
- * If CPU power management was disabled, then there
- * is nothing to do.
+ * Only initialize the topspeed if P-states are enabled.
*/
- if (!cpupm_enabled)
- return;
-
- cpupm_ready = B_TRUE;
-
- if (cpupm_init_topspeed != NULL)
+ if (cpupm_enabled & CPUPM_P_STATES && cpupm_init_topspeed != NULL)
(*cpupm_init_topspeed)();
-#else
- cpupm_ready = B_TRUE;
#endif
+ cpupm_ready = B_TRUE;
}