aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arch/x86/Makefile.inc2
-rw-r--r--src/arch/x86/assembly_entry.S8
-rw-r--r--src/include/thread.h2
-rw-r--r--src/lib/Makefile.inc8
4 files changed, 17 insertions, 3 deletions
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index 3949e3afa4..e91ddac82d 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -154,6 +154,8 @@ romstage-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c
romstage-y += postcar_loader.c
romstage-$(CONFIG_COLLECT_TIMESTAMPS_TSC) += timestamp.c
romstage-$(CONFIG_HAVE_CF9_RESET) += cf9_reset.c
+romstage-$(CONFIG_COOP_MULTITASKING) += thread.c
+romstage-$(CONFIG_COOP_MULTITASKING) += thread_switch.S
romstage-srcs += $(wildcard $(src)/mainboard/$(MAINBOARDDIR)/romstage.c)
romstage-libs ?=
diff --git a/src/arch/x86/assembly_entry.S b/src/arch/x86/assembly_entry.S
index 6e730273f8..b0e15dc700 100644
--- a/src/arch/x86/assembly_entry.S
+++ b/src/arch/x86/assembly_entry.S
@@ -35,6 +35,14 @@ _start:
/* reset stack pointer to CAR/EARLYRAM stack */
mov $_STACK_TOP, %esp
+#if CONFIG(COOP_MULTITASKING)
+ /* Push the thread pointer. */
+ push $0
+#endif
+ /* Push the CPU index and struct CPU */
+ push $0
+ push $0
+
/* clear .bss section as it is not shared */
cld
xor %eax, %eax
diff --git a/src/include/thread.h b/src/include/thread.h
index 3c06cc5311..cb085b5509 100644
--- a/src/include/thread.h
+++ b/src/include/thread.h
@@ -38,7 +38,7 @@ int thread_run_until(struct thread_handle *handle, enum cb_err (*func)(void *),
/* Waits until the thread has terminated and returns the error code */
enum cb_err thread_join(struct thread_handle *handle);
-#if ENV_RAMSTAGE && CONFIG(COOP_MULTITASKING)
+#if (ENV_RAMSTAGE || ENV_ROMSTAGE) && CONFIG(COOP_MULTITASKING)
struct thread {
int id;
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index baf9c4d651..bb3cf6a080 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -149,8 +149,6 @@ ramstage-$(CONFIG_COVERAGE) += libgcov.c
ramstage-y += edid.c
ramstage-y += edid_fill_fb.c
ramstage-y += memrange.c
-ramstage-$(CONFIG_COOP_MULTITASKING) += thread.c
-ramstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c
ramstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c
ramstage-$(CONFIG_GENERIC_UDELAY) += timer.c
ramstage-y += b64_decode.c
@@ -160,6 +158,12 @@ ramstage-$(CONFIG_FLATTENED_DEVICE_TREE) += device_tree.c
ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit.c
ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit_payload.c
+romstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c
+ramstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c
+
+romstage-$(CONFIG_COOP_MULTITASKING) += thread.c
+ramstage-$(CONFIG_COOP_MULTITASKING) += thread.c
+
romstage-y += cbmem_common.c
romstage-y += imd_cbmem.c
romstage-y += imd.c