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 <rrangel@chromium.org>
Change-Id: I7f1d6afac3b0622612565b37c61fbd2cd2481552
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56356
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Raul E Rangel 2021-07-15 17:28:13 -06:00 committed by Raul Rangel
parent d5dca21a95
commit b95369c914
1 changed files with 3 additions and 4 deletions

View File

@ -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)