summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86/include/arch/early_variables.h9
-rw-r--r--src/cpu/x86/car.c5
2 files changed, 14 insertions, 0 deletions
diff --git a/src/arch/x86/include/arch/early_variables.h b/src/arch/x86/include/arch/early_variables.h
index d0cfda75aa..2c6c539654 100644
--- a/src/arch/x86/include/arch/early_variables.h
+++ b/src/arch/x86/include/arch/early_variables.h
@@ -44,12 +44,20 @@ static inline void *car_sync_var_ptr(void *var)
{
return var;
}
+
+static inline int car_active(void)
+{
+ return 1;
+}
#else
/* Get the correct pointer for the CAR global variable. */
void *car_get_var_ptr(void *var);
/* Get and update a CAR_GLOBAL pointing elsewhere in car.global_data*/
void *car_sync_var_ptr(void *var);
+
+/* Return 1 when currently running with globals in Cache-as-RAM, 0 otherwise. */
+int car_active(void);
#endif /* ENV_VERSTAGE */
/* Get and set a primitive type global variable. */
@@ -73,6 +81,7 @@ static inline size_t car_object_offset(void *ptr)
#else
#define CAR_GLOBAL
static inline void *car_get_var_ptr(void *var) { return var; }
+static inline int car_active(void) { return 0; }
#define car_get_var(var) (var)
#define car_sync_var(var) (var)
#define car_set_var(var, val) (var) = (val)
diff --git a/src/cpu/x86/car.c b/src/cpu/x86/car.c
index 606a35e2f6..1b02f8b7da 100644
--- a/src/cpu/x86/car.c
+++ b/src/cpu/x86/car.c
@@ -113,6 +113,11 @@ void *car_sync_var_ptr(void *var)
return mig_var;
}
+int car_active(void)
+{
+ return !car_migrated;
+}
+
static void do_car_migrate_variables(void)
{
void *migrated_base;