haswell: Properly Guard Engergy Policy by CPUID

The IA32_ENERGY_PERFORMANCE_BIAS MSR can only be read or written
to if the CPU supports it. The support is indicated by ECX[3] for
cpuid(6). Without this guard, some Haswell parts would GP# fault
in this routine.

No more GP# while running on haswell CRBs.

Change-Id: If41e1e133e5faebb3ed578cba60743ce7e1c196f
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/2639
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martin.roth@se-eng.com>
This commit is contained in:
Aaron Durbin 2012-12-11 17:15:13 -06:00 committed by Ronald G. Minnich
parent c1989c494e
commit dc278f8fd0
1 changed files with 6 additions and 0 deletions

View File

@ -404,6 +404,12 @@ static void set_max_ratio(void)
static void set_energy_perf_bias(u8 policy) static void set_energy_perf_bias(u8 policy)
{ {
msr_t msr; msr_t msr;
int ecx;
/* Determine if energy efficient policy is supported. */
ecx = cpuid_ecx(0x6);
if (!(ecx & (1 << 3)))
return;
/* Energy Policy is bits 3:0 */ /* Energy Policy is bits 3:0 */
msr = rdmsr(IA32_ENERGY_PERFORMANCE_BIAS); msr = rdmsr(IA32_ENERGY_PERFORMANCE_BIAS);