summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/rules.h7
-rw-r--r--src/include/thread.h2
-rw-r--r--src/lib/cbfs.c2
3 files changed, 9 insertions, 2 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;
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
index 3a044f742b..d2a4b84656 100644
--- a/src/lib/cbfs.c
+++ b/src/lib/cbfs.c
@@ -359,7 +359,7 @@ static enum cb_err get_preload_rdev(struct region_device *rdev, const char *name
enum cb_err err;
struct cbfs_preload_context *context;
- if (!CONFIG(CBFS_PRELOAD) || (!ENV_RAMSTAGE && !ENV_ROMSTAGE))
+ if (!CONFIG(CBFS_PRELOAD) || !ENV_STAGE_SUPPORTS_COOP)
return CB_ERR_ARG;
context = find_cbfs_preload_context(name);