From efc01f0d22dc72c9c156740cf334ee8ac2cfe6cd Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Mon, 8 Jun 2015 20:06:48 +0200 Subject: model_206ax: Fix APIC map when HT is disabled. Change-Id: Idd05a16bd9bd31438437ef229aa87f55da8489fb Signed-off-by: Vladimir Serbinenko Reviewed-on: http://review.coreboot.org/10467 Tested-by: build bot (Jenkins) Reviewed-by: Alexandru Gagniuc --- src/cpu/intel/fsp_model_206ax/model_206ax_init.c | 24 +++++++++++++++--------- src/cpu/intel/model_206ax/model_206ax_init.c | 24 +++++++++++++++--------- 2 files changed, 30 insertions(+), 18 deletions(-) (limited to 'src/cpu/intel') 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 -#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 -#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; } /* -- cgit v1.2.3