cpu/mp_init.c: Only enable CPUs once they execute code

On some systems the BSP cannot know how many CPUs are present in the
system. A typical use case is a multi socket system. Setting the enable
flag only on CPUs that actually exist makes it more flexible.

Change-Id: I6c8042b4d6127239175924f996f735bf9c83c6e8
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/68892
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Arthur Heymans 2022-10-26 10:09:00 +02:00 committed by Lean Sheng Tan
parent a804f9195e
commit ddf48eb7c7
1 changed files with 2 additions and 0 deletions

View File

@ -201,6 +201,7 @@ static asmlinkage void ap_init(unsigned int index)
/* Fix up APIC id with reality. */ /* Fix up APIC id with reality. */
dev->path.apic.apic_id = lapicid(); dev->path.apic.apic_id = lapicid();
dev->path.apic.initial_lapicid = initial_lapicid(); dev->path.apic.initial_lapicid = initial_lapicid();
dev->enabled = 1;
if (cpu_is_intel()) if (cpu_is_intel())
printk(BIOS_INFO, "AP: slot %u apic_id %x, MCU rev: 0x%08x\n", index, printk(BIOS_INFO, "AP: slot %u apic_id %x, MCU rev: 0x%08x\n", index,
@ -387,6 +388,7 @@ static int allocate_cpu_devices(struct bus *cpu_bus, struct mp_params *p)
continue; continue;
} }
new->name = processor_name; new->name = processor_name;
new->enabled = 0; /* Runtime will enable it */
} }
return max_cpus; return max_cpus;