Subrata Banik has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32702
Change subject: lapic/lapic_cpu_init: Make use of cpu_index() [WIP] ......................................................................
lapic/lapic_cpu_init: Make use of cpu_index() [WIP]
Change-Id: Ic2b933f15f01ddb5e34e766384285e82440f775c Signed-off-by: Subrata Banik subrata.banik@intel.com --- M src/cpu/x86/lapic/lapic_cpu_init.c 1 file changed, 4 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/02/32702/1
diff --git a/src/cpu/x86/lapic/lapic_cpu_init.c b/src/cpu/x86/lapic/lapic_cpu_init.c index 3ad1f0a..4518f9f 100644 --- a/src/cpu/x86/lapic/lapic_cpu_init.c +++ b/src/cpu/x86/lapic/lapic_cpu_init.c @@ -245,7 +245,7 @@ /* Number of cpus that are currently running in coreboot */ static atomic_t active_cpus = ATOMIC_INIT(1);
-/* start_cpu_lock covers last_cpu_index and secondary_stack. +/* start_cpu_lock covers secondary_stack. * Only starting one CPU at a time let's me remove the logic * for select the stack from assembly language. * @@ -255,7 +255,7 @@ */
DECLARE_SPIN_LOCK(start_cpu_lock); -static unsigned int last_cpu_index = 0; + static void *stacks[CONFIG_MAX_CPUS]; volatile unsigned long secondary_stack; volatile unsigned int secondary_cpu_index; @@ -276,7 +276,7 @@ apicid = cpu->path.apic.apic_id;
/* Get an index for the new processor */ - index = ++last_cpu_index; + index = cpu_index();
/* Find boundaries of the new processor's stack */ stack_top = ALIGN_DOWN((uintptr_t)_estack, CONFIG_STACK_SIZE); @@ -522,7 +522,7 @@ } printk(BIOS_DEBUG, "All AP CPUs stopped (%ld loops)\n", loopcount); checkstack(_estack, 0); - for (i = 1; i < CONFIG_MAX_CPUS && i <= last_cpu_index; i++) + for (i = 1; i < CONFIG_MAX_CPUS; i++) checkstack((void *)stacks[i] + CONFIG_STACK_SIZE, i); }
@@ -578,7 +578,6 @@ smm_init();
if (is_smp_boot()) { - last_cpu_index = 0; smm_other_cpus(cpu_bus, info->cpu); } }