sandybridge: Correct reporting of cores and threads
The reporting of cores and threads in the system was a bit ambiguous. This patch makes it clearer. Change-Id: Ia05838a53f696fbaf78a1762fc6f4bf348d4ff0e Signed-off-by: Stefan Reinauer <reinauer@google.com> Reviewed-on: http://review.coreboot.org/1786 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
parent
cb6fd30155
commit
bb9dff5556
|
@ -436,22 +436,25 @@ static unsigned ehci_debug_addr;
|
||||||
static void intel_cores_init(device_t cpu)
|
static void intel_cores_init(device_t cpu)
|
||||||
{
|
{
|
||||||
struct cpuid_result result;
|
struct cpuid_result result;
|
||||||
unsigned cores, threads, i;
|
unsigned threads_per_package, threads_per_core, i;
|
||||||
|
|
||||||
result = cpuid_ext(0xb, 0); /* Threads per core */
|
/* Logical processors (threads) per core */
|
||||||
threads = result.ebx & 0xff;
|
result = cpuid_ext(0xb, 0);
|
||||||
|
threads_per_core = result.ebx & 0xffff;
|
||||||
|
|
||||||
result = cpuid_ext(0xb, 1); /* Cores per package */
|
/* Logical processors (threads) per package */
|
||||||
cores = result.ebx & 0xff;
|
result = cpuid_ext(0xb, 1);
|
||||||
|
threads_per_package = result.ebx & 0xffff;
|
||||||
|
|
||||||
/* Only initialize extra cores from BSP */
|
/* Only initialize extra cores from BSP */
|
||||||
if (cpu->path.apic.apic_id)
|
if (cpu->path.apic.apic_id)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
printk(BIOS_DEBUG, "CPU: %u has %u cores %u threads\n",
|
printk(BIOS_DEBUG, "CPU: %u has %u cores, %u threads per core\n",
|
||||||
cpu->path.apic.apic_id, cores, threads);
|
cpu->path.apic.apic_id, threads_per_package/threads_per_core,
|
||||||
|
threads_per_core);
|
||||||
|
|
||||||
for (i = 1; i < cores; ++i) {
|
for (i = 1; i < threads_per_package; ++i) {
|
||||||
struct device_path cpu_path;
|
struct device_path cpu_path;
|
||||||
device_t new;
|
device_t new;
|
||||||
|
|
||||||
|
@ -461,7 +464,7 @@ static void intel_cores_init(device_t cpu)
|
||||||
cpu->path.apic.apic_id + i;
|
cpu->path.apic.apic_id + i;
|
||||||
|
|
||||||
/* Update APIC ID if no hyperthreading */
|
/* Update APIC ID if no hyperthreading */
|
||||||
if (threads == 1)
|
if (threads_per_core == 1)
|
||||||
cpu_path.apic.apic_id <<= 1;
|
cpu_path.apic.apic_id <<= 1;
|
||||||
|
|
||||||
/* Allocate the new cpu device structure */
|
/* Allocate the new cpu device structure */
|
||||||
|
|
Loading…
Reference in New Issue