Aaron Durbin (adurbin@google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5047
-gerrit
commit bca56efcc60ee18133d39f662d703868edfdc856 Author: Aaron Durbin adurbin@chromium.org Date: Tue Jan 14 17:28:33 2014 -0600
cpu/intel: allow non-packaged scoped turbo setting
In the past the turbo disable setting (bit 38) of the IA32_MISC_ENABLES msr has been package scoped. That means knocking the turbo disable bit down enabled turbo for the entire package. Sadly, that's no longer true on all Intel processors. Therefore, allow non-packaged scoped turbo setting by introducing the CPU_INTEL_TURBO_NOT_PACKAGE_SCOPED Kconfig option. It defaults to false which was the original assumption.
BUG=chrome-os-partner:25014 BRANCH=baytrail TEST=Built and ran both ways successfully.
Change-Id: I71a31e76ff47878023081fc47da643187517b597 Signed-off-by: Aaron Durbin adurbin@chromium.org Reviewed-on: https://chromium-review.googlesource.com/182405 Reviewed-by: Duncan Laurie dlaurie@chromium.org --- src/cpu/intel/Kconfig | 1 + src/cpu/intel/turbo/Kconfig | 6 ++++++ src/cpu/intel/turbo/turbo.c | 27 +++++++++++++++++++++++++-- 3 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/src/cpu/intel/Kconfig b/src/cpu/intel/Kconfig index 6f4f561..af03619 100644 --- a/src/cpu/intel/Kconfig +++ b/src/cpu/intel/Kconfig @@ -37,3 +37,4 @@ source src/cpu/intel/socket_LGA775/Kconfig source src/cpu/intel/socket_rPGA989/Kconfig # Architecture specific features source src/cpu/intel/fit/Kconfig +source src/cpu/intel/turbo/Kconfig diff --git a/src/cpu/intel/turbo/Kconfig b/src/cpu/intel/turbo/Kconfig new file mode 100644 index 0000000..5432c28 --- /dev/null +++ b/src/cpu/intel/turbo/Kconfig @@ -0,0 +1,6 @@ + +config CPU_INTEL_TURBO_NOT_PACKAGE_SCOPED + def_bool n + help + This option indicates that the turbo mode setting is not package + scoped. i.e. enable_turbo() needs to be called on not just the bsp diff --git a/src/cpu/intel/turbo/turbo.c b/src/cpu/intel/turbo/turbo.c index 779550e..7599ff1 100644 --- a/src/cpu/intel/turbo/turbo.c +++ b/src/cpu/intel/turbo/turbo.c @@ -24,7 +24,28 @@ #include <cpu/x86/msr.h> #include <arch/cpu.h>
-static int turbo_state = TURBO_UNKNOWN; +#if CONFIG_CPU_INTEL_TURBO_NOT_PACKAGE_SCOPED +static inline int get_global_turbo_state(void) +{ + return TURBO_UNKNOWN; +} + +static inline void set_global_turbo_state(int state) +{ +} +#else +static int g_turbo_state = TURBO_UNKNOWN; + +static inline int get_global_turbo_state(void) +{ + return g_turbo_state; +} + +static inline void set_global_turbo_state(int state) +{ + g_turbo_state = state; +} +#endif
static const char *turbo_state_desc[] = { [TURBO_UNKNOWN] = "unknown", @@ -43,6 +64,7 @@ int get_turbo_state(void) struct cpuid_result cpuid_regs; int turbo_en, turbo_cap; msr_t msr; + int turbo_state = get_global_turbo_state();
/* Return cached state if available */ if (turbo_state != TURBO_UNKNOWN) @@ -65,6 +87,7 @@ int get_turbo_state(void) turbo_state = TURBO_ENABLED; }
+ set_global_turbo_state(turbo_state); printk(BIOS_INFO, "Turbo is %s\n", turbo_state_desc[turbo_state]); return turbo_state; } @@ -84,7 +107,7 @@ void enable_turbo(void) wrmsr(MSR_IA32_MISC_ENABLES, msr);
/* Update cached turbo state */ - turbo_state = TURBO_ENABLED; + set_global_turbo_state(TURBO_ENABLED); printk(BIOS_INFO, "Turbo has been enabled\n"); } }