aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorRaul E Rangel <rrangel@chromium.org>2021-11-22 13:43:49 -0700
committerFelix Held <felix-coreboot@felixheld.de>2021-12-15 23:25:32 +0000
commitd8f07c1f357ac92d33140450a7de0bae934141a2 (patch)
tree3382f5fc0dbc99662ad1ec9afc12383e76434162 /src/include
parentaf54d7d0dda28a051340c615fbf0cb4017ff4aec (diff)
rules.h, thread.h, lib/cbfs: Add ENV_STAGE_SUPPORTS_COOP
This change consolidates the COOP rules. Co-op in theory works in all x86 stages now, but it hasn't been enabled yet. BUG=b:179699789 TEST=Boot guybrush to OS and verify preloads still work Signed-off-by: Raul E Rangel <rrangel@chromium.org> Change-Id: I1197406d1d36391998b08e3076146bb2fff59d00 Reviewed-on: https://review.coreboot.org/c/coreboot/+/59550 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/rules.h7
-rw-r--r--src/include/thread.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/src/include/rules.h b/src/include/rules.h
index d08929cae2..02b55c5f8a 100644
--- a/src/include/rules.h
+++ b/src/include/rules.h
@@ -303,6 +303,13 @@
/* When set <arch/smp/spinlock.h> is included for the spinlock implementation. */
#define ENV_STAGE_SUPPORTS_SMP (CONFIG(SMP) && STAGE_HAS_SPINLOCKS)
+#if ENV_X86 && CONFIG(COOP_MULTITASKING) && (ENV_RAMSTAGE || ENV_ROMSTAGE)
+/* TODO: Enable in all x86 stages */
+#define ENV_STAGE_SUPPORTS_COOP 1
+#else
+#define ENV_STAGE_SUPPORTS_COOP 0
+#endif
+
/**
* For pre-DRAM stages and post-CAR always build with simple device model, ie.
* PCI, PNP and CPU functions operate without use of devicetree. The reason
diff --git a/src/include/thread.h b/src/include/thread.h
index 19b69fa30d..4f10782415 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 || ENV_ROMSTAGE) && CONFIG(COOP_MULTITASKING)
+#if ENV_STAGE_SUPPORTS_COOP
struct thread {
int id;