model_206ax: Fix APIC map when HT is disabled.
Change-Id: Idd05a16bd9bd31438437ef229aa87f55da8489fb Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-on: http://review.coreboot.org/10467 Tested-by: build bot (Jenkins) Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
This commit is contained in:
		@@ -36,8 +36,6 @@
 | 
				
			|||||||
#include "chip.h"
 | 
					#include "chip.h"
 | 
				
			||||||
#include <cpu/intel/smm/gen1/smi.h>
 | 
					#include <cpu/intel/smm/gen1/smi.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define CORE_THREAD_COUNT_MSR 0x35
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void enable_vmx(void)
 | 
					static void enable_vmx(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct cpuid_result regs;
 | 
						struct cpuid_result regs;
 | 
				
			||||||
@@ -291,16 +289,24 @@ static void configure_mca(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int cpu_get_apic_id_map(int *apic_id_map)
 | 
					int cpu_get_apic_id_map(int *apic_id_map)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	msr_t msr;
 | 
						struct cpuid_result result;
 | 
				
			||||||
	int num_cpus, i;
 | 
						unsigned threads_per_package, threads_per_core, i, shift = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	msr = rdmsr(CORE_THREAD_COUNT_MSR);
 | 
						/* Logical processors (threads) per core */
 | 
				
			||||||
	num_cpus = msr.lo & 0xffff;
 | 
						result = cpuid_ext(0xb, 0);
 | 
				
			||||||
 | 
						threads_per_core = result.ebx & 0xffff;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < num_cpus && i < CONFIG_MAX_CPUS; i++)
 | 
						/* Logical processors (threads) per package */
 | 
				
			||||||
		apic_id_map[i] = i;
 | 
						result = cpuid_ext(0xb, 1);
 | 
				
			||||||
 | 
						threads_per_package = result.ebx & 0xffff;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return num_cpus;
 | 
						if (threads_per_core == 1)
 | 
				
			||||||
 | 
							shift++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (i = 0; i < threads_per_package && i < CONFIG_MAX_CPUS; i++)
 | 
				
			||||||
 | 
							apic_id_map[i] = i << shift;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return threads_per_package;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,8 +37,6 @@
 | 
				
			|||||||
#include "chip.h"
 | 
					#include "chip.h"
 | 
				
			||||||
#include <cpu/intel/smm/gen1/smi.h>
 | 
					#include <cpu/intel/smm/gen1/smi.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define CORE_THREAD_COUNT_MSR 0x35
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * List of supported C-states in this processor
 | 
					 * 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)
 | 
					int cpu_get_apic_id_map(int *apic_id_map)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	msr_t msr;
 | 
						struct cpuid_result result;
 | 
				
			||||||
	int num_cpus, i;
 | 
						unsigned threads_per_package, threads_per_core, i, shift = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	msr = rdmsr(CORE_THREAD_COUNT_MSR);
 | 
						/* Logical processors (threads) per core */
 | 
				
			||||||
	num_cpus = msr.lo & 0xffff;
 | 
						result = cpuid_ext(0xb, 0);
 | 
				
			||||||
 | 
						threads_per_core = result.ebx & 0xffff;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (i = 0; i < num_cpus && i < CONFIG_MAX_CPUS; i++)
 | 
						/* Logical processors (threads) per package */
 | 
				
			||||||
		apic_id_map[i] = i;
 | 
						result = cpuid_ext(0xb, 1);
 | 
				
			||||||
 | 
						threads_per_package = result.ebx & 0xffff;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return num_cpus;
 | 
						if (threads_per_core == 1)
 | 
				
			||||||
 | 
							shift++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						for (i = 0; i < threads_per_package && i < CONFIG_MAX_CPUS; i++)
 | 
				
			||||||
 | 
							apic_id_map[i] = i << shift;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return threads_per_package;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user