aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel/common/block/cpu/cpulib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/intel/common/block/cpu/cpulib.c')
-rw-r--r--src/soc/intel/common/block/cpu/cpulib.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/cpu/cpulib.c b/src/soc/intel/common/block/cpu/cpulib.c
index 325e1bb857..5920512cd4 100644
--- a/src/soc/intel/common/block/cpu/cpulib.c
+++ b/src/soc/intel/common/block/cpu/cpulib.c
@@ -226,3 +226,17 @@ void cpu_enable_untrusted_mode(void)
msr.lo |= ENABLE_IA_UNTRUSTED;
wrmsr(MSR_POWER_MISC, msr);
}
+
+/*
+ * This function fills in the number of Cores(physical) and Threads(virtual)
+ * of the CPU in the function arguments. It also returns if the number of cores
+ * and number of threads are equal.
+ */
+int cpu_read_topology(unsigned int *num_phys, unsigned int *num_virt)
+{
+ msr_t msr;
+ msr = rdmsr(MSR_CORE_THREAD_COUNT);
+ *num_virt = (msr.lo >> 0) & 0xffff;
+ *num_phys = (msr.lo >> 16) & 0xffff;
+ return (*num_virt == *num_phys);
+}