From b95369c91447f3fa6c672ffd346caf34c81134c0 Mon Sep 17 00:00:00 2001 From: Raul E Rangel Date: Thu, 15 Jul 2021 17:28:13 -0600 Subject: [PATCH] lib/thread: Clean up initialization sequence idle_thread_init was actually configuring the BSP thread at the end. We can instead do this in threads_initialize. This now lets us set initialized after the idle thread has been set up. BUG=b:179699789 TEST=Boot guybrush to OS Signed-off-by: Raul E Rangel Change-Id: I7f1d6afac3b0622612565b37c61fbd2cd2481552 Reviewed-on: https://review.coreboot.org/c/coreboot/+/56356 Reviewed-by: Julius Werner Reviewed-by: Furquan Shaikh Reviewed-by: Karthik Ramasubramanian Tested-by: build bot (Jenkins) --- src/lib/thread.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lib/thread.c b/src/lib/thread.c index a8c0772c89..d44c218094 100644 --- a/src/lib/thread.c +++ b/src/lib/thread.c @@ -213,8 +213,6 @@ static void idle_thread_init(void) /* Queue idle thread to run once all other threads have yielded. */ prepare_thread(t, idle_thread, NULL, call_wrapper, NULL); push_runnable(t); - /* Mark the currently executing thread to cooperate. */ - thread_cooperate(); } /* Don't inline this function so the timeout_callback won't have its storage @@ -260,6 +258,7 @@ void threads_initialize(void) ci->thread = t; t->stack_orig = (uintptr_t)ci; t->id = 0; + t->can_yield = 1; stack_top = &thread_stacks[CONFIG_STACK_SIZE] - sizeof(struct cpu_info); for (i = 1; i < TOTAL_NUM_THREADS; i++) { @@ -270,9 +269,9 @@ void threads_initialize(void) free_thread(t); } - initialized = 1; - idle_thread_init(); + + initialized = 1; } int thread_run(void (*func)(void *), void *arg)