From ca0606e04fd6e6f9ed2e11d31155a17bed3d3a12 Mon Sep 17 00:00:00 2001
From: Raul E Rangel <rrangel@chromium.org>
Date: Wed, 21 Jul 2021 14:34:00 -0600
Subject: arch/x86,lib/thread: Enable thread support in romstage

This change does the following:
* Pushes the cpu_info struct into the top of the stack (just like
  c_start.S). This is required so the cpu_info function works correctly.

* Adds the thread.c to the romstage build.

I only enabled this for romstage since I haven't done any tests in other
stages, but in theory it should work for other stages.

BUG=b:179699789
TEST=Boot guybrush with threads enabled in romstage

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Change-Id: I8e32e1c54dea0d0c85dd6d6753147099aa54b9b5
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56494
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
---
 src/lib/Makefile.inc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'src/lib')

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
-- 
cgit v1.2.3