From 5dd7602d20a647cd30db4842820fdc9f211be009 Mon Sep 17 00:00:00 2001 From: Raul E Rangel Date: Thu, 15 Jul 2021 13:26:52 -0600 Subject: lib/thread: Move thread_run and thread_run_until outside of #if guard This will cause a linker error if these methods are used outside ramstage. BUG=b:179699789 TEST=compile guybrush w/ and w/o COOP_MULTITASKING Signed-off-by: Raul E Rangel Change-Id: If9983fca939c8a15fa570481bfe016a388458830 Reviewed-on: https://review.coreboot.org/c/coreboot/+/56352 Reviewed-by: Karthik Ramasubramanian Reviewed-by: Furquan Shaikh Tested-by: build bot (Jenkins) --- src/include/thread.h | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/src/include/thread.h b/src/include/thread.h index 7969f575fe..fed0bfb964 100644 --- a/src/include/thread.h +++ b/src/include/thread.h @@ -23,6 +23,18 @@ struct thread_handle { enum cb_err error; }; +/* Run func(arg) on a new thread. Return 0 on successful start of thread, < 0 + * when thread could not be started. The thread handle if populated, will + * reflect the state and return code of the thread. + */ +int thread_run(struct thread_handle *handle, enum cb_err (*func)(void *), void *arg); + +/* thread_run_until is the same as thread_run() except that it blocks state + * transitions from occurring in the (state, seq) pair of the boot state + * machine. */ +int thread_run_until(struct thread_handle *handle, enum cb_err (*func)(void *), void *arg, + boot_state_t state, boot_state_sequence_t seq); + /* Waits until the thread has terminated and returns the error code */ enum cb_err thread_join(struct thread_handle *handle); @@ -45,16 +57,6 @@ void threads_initialize(void); * aligned to CONFIG_STACK_SIZE, or NULL. */ void *arch_get_thread_stackbase(void); -/* Run func(arrg) on a new thread. Return 0 on successful start of thread, < 0 - * when thread could not be started. The thread handle if populated, will - * reflect the state and return code of the thread. - */ -int thread_run(struct thread_handle *handle, enum cb_err (*func)(void *), void *arg); -/* thread_run_until is the same as thread_run() except that it blocks state - * transitions from occurring in the (state, seq) pair of the boot state - * machine. */ -int thread_run_until(struct thread_handle *handle, enum cb_err (*func)(void *), void *arg, - boot_state_t state, boot_state_sequence_t seq); /* Return 0 on successful yield, < 0 when thread did not yield. */ int thread_yield(void); @@ -92,16 +94,6 @@ void arch_prepare_thread(struct thread *t, asmlinkage void (*thread_entry)(void *), void *arg); #else static inline void threads_initialize(void) {} -static inline int thread_run(struct thread_handle *handle, enum cb_err (*func)(void *), - void *arg) -{ - return -1; -} -static inline int thread_run_until(struct thread_handle *handle, enum cb_err (*func)(void *), - void *arg, boot_state_t state, boot_state_sequence_t seq) -{ - return -1; -} static inline int thread_yield(void) { return -1; -- cgit v1.2.3