aboutsummaryrefslogtreecommitdiff
path: root/src/cpu/intel/common
diff options
context:
space:
mode:
authorSubrata Banik <subrata.banik@intel.com>2018-12-10 14:11:35 +0530
committerSubrata Banik <subrata.banik@intel.com>2018-12-13 04:32:57 +0000
commit53b08c347f54970cf5f6ce35b8e1a1fe5f8a11f9 (patch)
treeb4eed19fbf1b9f35dfbdddcc43fc84469176ec59 /src/cpu/intel/common
parente3110b862071ae0797afb0688495315a7dd47739 (diff)
cpuid: Add helper function for cpuid(1) functions
This patch introduces 3 helper function for cpuid(1) : 1. cpu_get_cpuid() -> to get processor id (from cpuid.eax) 2. cpu_get_feature_flags_ecx -> to get processor feature flag (from cpuid.ecx) 3. cpu_get_feature_flags_edx -> to get processor feature flag (from cpuid.edx) Above 3 helper functions are targeted to replace majority of cpuid(1) references. Change-Id: Ib96a7c79dadb1feff0b8d58aa408b355fbb3bc50 Signed-off-by: Subrata Banik <subrata.banik@intel.com> Reviewed-on: https://review.coreboot.org/c/30123 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/cpu/intel/common')
-rw-r--r--src/cpu/intel/common/common_init.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/cpu/intel/common/common_init.c b/src/cpu/intel/common/common_init.c
index 02eb0e201e..7dbbfda2e8 100644
--- a/src/cpu/intel/common/common_init.c
+++ b/src/cpu/intel/common/common_init.c
@@ -16,20 +16,21 @@
*/
#include <arch/acpigen.h>
+#include <arch/cpu.h>
#include <console/console.h>
#include <cpu/x86/msr.h>
#include "common.h"
void set_vmx(void)
{
- struct cpuid_result regs;
msr_t msr;
+ uint32_t feature_flag;
int enable = IS_ENABLED(CONFIG_ENABLE_VMX);
int lock = IS_ENABLED(CONFIG_SET_VMX_LOCK_BIT);
- regs = cpuid(1);
+ feature_flag = cpu_get_feature_flags_ecx();
/* Check that the VMX is supported before reading or writing the MSR. */
- if (!((regs.ecx & CPUID_VMX) || (regs.ecx & CPUID_SMX))) {
+ if (!((feature_flag & CPUID_VMX) || (feature_flag & CPUID_SMX))) {
printk(BIOS_DEBUG, "CPU doesn't support VMX; exiting\n");
return;
}
@@ -52,7 +53,7 @@ void set_vmx(void)
if (enable) {
msr.lo |= (1 << 2);
- if (regs.ecx & CPUID_SMX)
+ if (feature_flag & CPUID_SMX)
msr.lo |= (1 << 1);
}