[coreboot-gerrit] New patch to review for coreboot: b0a3ef1 model_206ax: Fix APIC map when HT is disabled.

Vladimir Serbinenko (phcoder@gmail.com) gerrit at coreboot.org
Mon Jun 8 20:39:30 CEST 2015


Vladimir Serbinenko (phcoder at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10467

-gerrit

commit b0a3ef16a499620e79c4b7416d062e2653adc3e4
Author: Vladimir Serbinenko <phcoder at gmail.com>
Date:   Mon Jun 8 20:06:48 2015 +0200

    model_206ax: Fix APIC map when HT is disabled.
    
    Change-Id: Idd05a16bd9bd31438437ef229aa87f55da8489fb
    Signed-off-by: Vladimir Serbinenko <phcoder at gmail.com>
---
 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(-)

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 bcff1e8..9b76c22 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 2028af0..922eb49 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;
 }
 
 /*



More information about the coreboot-gerrit mailing list