summaryrefslogtreecommitdiff
path: root/src/lib/thread.c
diff options
context:
space:
mode:
authorRaul E Rangel <rrangel@chromium.org>2021-07-15 17:28:13 -0600
committerRaul Rangel <rrangel@chromium.org>2021-07-18 15:13:00 +0000
commitb95369c91447f3fa6c672ffd346caf34c81134c0 (patch)
treedd31fbdf803ce9a9949ffe19ef1447bdaddab185 /src/lib/thread.c
parentd5dca21a958001a555b9a313156567f0bdec643b (diff)
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>
Diffstat (limited to 'src/lib/thread.c')
-rw-r--r--src/lib/thread.c7
1 files 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)