summaryrefslogtreecommitdiff
path: root/src/cpu/intel
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu/intel')
-rw-r--r--src/cpu/intel/fsp_model_206ax/model_206ax_init.c24
-rw-r--r--src/cpu/intel/model_206ax/model_206ax_init.c24
2 files changed, 30 insertions, 18 deletions
diff --git a/src/cpu/intel/fsp_model_206ax/model_206ax_init.c b/src/cpu/intel/fsp_model_206ax/model_206ax_init.c
index bcff1e842d..9b76c22aa2 100644
--- a/src/cpu/intel/fsp_model_206ax/model_206ax_init.c
+++ b/src/cpu/intel/fsp_model_206ax/model_206ax_init.c
@@ -36,8 +36,6 @@
#include "chip.h"
#include <cpu/intel/smm/gen1/smi.h>
-#define CORE_THREAD_COUNT_MSR 0x35
-
static void enable_vmx(void)
{
struct cpuid_result regs;
@@ -291,16 +289,24 @@ static void configure_mca(void)
int cpu_get_apic_id_map(int *apic_id_map)
{
- msr_t msr;
- int num_cpus, i;
+ struct cpuid_result result;
+ unsigned threads_per_package, threads_per_core, i, shift = 0;
+
+ /* Logical processors (threads) per core */
+ result = cpuid_ext(0xb, 0);
+ threads_per_core = result.ebx & 0xffff;
+
+ /* Logical processors (threads) per package */
+ result = cpuid_ext(0xb, 1);
+ threads_per_package = result.ebx & 0xffff;
- msr = rdmsr(CORE_THREAD_COUNT_MSR);
- num_cpus = msr.lo & 0xffff;
+ if (threads_per_core == 1)
+ shift++;
- for (i = 0; i < num_cpus && i < CONFIG_MAX_CPUS; i++)
- apic_id_map[i] = i;
+ for (i = 0; i < threads_per_package && i < CONFIG_MAX_CPUS; i++)
+ apic_id_map[i] = i << shift;
- return num_cpus;
+ return threads_per_package;
}
/*
diff --git a/src/cpu/intel/model_206ax/model_206ax_init.c b/src/cpu/intel/model_206ax/model_206ax_init.c
index 2028af0196..922eb49538 100644
--- a/src/cpu/intel/model_206ax/model_206ax_init.c
+++ b/src/cpu/intel/model_206ax/model_206ax_init.c
@@ -37,8 +37,6 @@
#include "chip.h"
#include <cpu/intel/smm/gen1/smi.h>
-#define CORE_THREAD_COUNT_MSR 0x35
-
/*
* List of supported C-states in this processor
*
@@ -478,16 +476,24 @@ static void configure_mca(void)
int cpu_get_apic_id_map(int *apic_id_map)
{
- msr_t msr;
- int num_cpus, i;
+ struct cpuid_result result;
+ unsigned threads_per_package, threads_per_core, i, shift = 0;
+
+ /* Logical processors (threads) per core */
+ result = cpuid_ext(0xb, 0);
+ threads_per_core = result.ebx & 0xffff;
+
+ /* Logical processors (threads) per package */
+ result = cpuid_ext(0xb, 1);
+ threads_per_package = result.ebx & 0xffff;
- msr = rdmsr(CORE_THREAD_COUNT_MSR);
- num_cpus = msr.lo & 0xffff;
+ if (threads_per_core == 1)
+ shift++;
- for (i = 0; i < num_cpus && i < CONFIG_MAX_CPUS; i++)
- apic_id_map[i] = i;
+ for (i = 0; i < threads_per_package && i < CONFIG_MAX_CPUS; i++)
+ apic_id_map[i] = i << shift;
- return num_cpus;
+ return threads_per_package;
}
/*