From: Simon Glass Date: Thu, 7 Sep 2023 15:58:18 +0000 (-0600) Subject: x86: broadwell: Avoid initing the CPU twice X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=3ca9b86e2344ddea2dafc2c1edb24cf010149249;p=u-boot.git x86: broadwell: Avoid initing the CPU twice When TPL has already set up the CPU, don't do it again. This existing code actually has this backwards, so fix it. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- diff --git a/arch/x86/cpu/broadwell/cpu.c b/arch/x86/cpu/broadwell/cpu.c index 560b1f7893..cbd4a3b679 100644 --- a/arch/x86/cpu/broadwell/cpu.c +++ b/arch/x86/cpu/broadwell/cpu.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -67,12 +68,11 @@ int arch_cpu_init(void) { post_code(POST_CPU_INIT); -#ifdef CONFIG_TPL /* Do a mini-init if TPL has already done the full init */ - return x86_cpu_reinit_f(); -#else - return x86_cpu_init_f(); -#endif + if (IS_ENABLED(CONFIG_TPL) && spl_phase() != PHASE_TPL) + return x86_cpu_reinit_f(); + else + return x86_cpu_init_f(); } int checkcpu(void)