summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Kconfig4
-rw-r--r--src/arch/x86/boot/Makefile.inc3
-rw-r--r--src/arch/x86/include/arch/early_variables.h10
-rw-r--r--src/cpu/x86/Makefile.inc3
-rw-r--r--src/cpu/x86/car.c8
-rw-r--r--src/lib/Makefile.inc3
6 files changed, 17 insertions, 14 deletions
diff --git a/src/Kconfig b/src/Kconfig
index 0fb88daa1b..066bda9e28 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -158,9 +158,7 @@ config EARLY_CBMEM_INIT
romstage.c and should be enabled by the board's Kconfig.
config BROKEN_CAR_MIGRATE
- bool
- default y if !EARLY_CBMEM_INIT && HAVE_ACPI_RESUME
- default n
+ def_bool !EARLY_CBMEM_INIT
help
Many boards use CAR_GLOBAL but have no EARLY_CBMEM_INIT and
manage CAR migration on S3 resume path only. Couple boards use
diff --git a/src/arch/x86/boot/Makefile.inc b/src/arch/x86/boot/Makefile.inc
index 9a68d81488..9f06b4f4eb 100644
--- a/src/arch/x86/boot/Makefile.inc
+++ b/src/arch/x86/boot/Makefile.inc
@@ -1,8 +1,7 @@
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
-romstage-$(CONFIG_EARLY_CBMEM_INIT) += cbmem.c
-romstage-$(CONFIG_BROKEN_CAR_MIGRATE) += cbmem.c
+romstage-y += cbmem.c
endif # CONFIG_ARCH_ROMSTAGE_X86_32
diff --git a/src/arch/x86/include/arch/early_variables.h b/src/arch/x86/include/arch/early_variables.h
index c850a8427d..f76c0481ab 100644
--- a/src/arch/x86/include/arch/early_variables.h
+++ b/src/arch/x86/include/arch/early_variables.h
@@ -45,16 +45,18 @@ void *car_get_var_ptr(void *var);
#define car_set_var(var, val) \
do { car_get_var(var) = (val); } while(0)
-/* Migrate the CAR variables to memory. */
-void car_migrate_variables(void);
-
#else
#define CAR_MIGRATE(migrate_fn_)
static inline void *car_get_var_ptr(void *var) { return var; }
#define car_get_var(var) (var)
#define car_set_var(var, val) do { (var) = (val); } while (0)
-static inline void car_migrate_variables(void) { }
#endif
+#if defined(__PRE_RAM__) && IS_ENABLED(CONFIG_CACHE_AS_RAM)
+/* Migrate the CAR variables to memory. */
+void car_migrate_variables(void);
+#else
+static inline void car_migrate_variables(void) { }
+#endif
#endif
diff --git a/src/cpu/x86/Makefile.inc b/src/cpu/x86/Makefile.inc
index 418b5d7b66..2347f88500 100644
--- a/src/cpu/x86/Makefile.inc
+++ b/src/cpu/x86/Makefile.inc
@@ -1,6 +1,5 @@
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32),y)
-romstage-$(CONFIG_EARLY_CBMEM_INIT) += car.c
-romstage-$(CONFIG_BROKEN_CAR_MIGRATE) += car.c
+romstage-$(CONFIG_CACHE_AS_RAM) += car.c
endif
subdirs-$(CONFIG_PARALLEL_MP) += name
diff --git a/src/cpu/x86/car.c b/src/cpu/x86/car.c
index a7e38420a8..c9cc6d6178 100644
--- a/src/cpu/x86/car.c
+++ b/src/cpu/x86/car.c
@@ -73,7 +73,7 @@ void *car_get_var_ptr(void *var)
return &migrated_base[offset];
}
-void car_migrate_variables(void)
+static void do_car_migrate_variables(void)
{
void *migrated_base;
car_migration_func_t *migrate_func;
@@ -102,3 +102,9 @@ void car_migrate_variables(void)
migrate_func++;
}
}
+
+void car_migrate_variables(void)
+{
+ if (!IS_ENABLED(CONFIG_BROKEN_CAR_MIGRATE))
+ do_car_migrate_variables();
+}
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 327c9f2503..cf3434d405 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -75,8 +75,7 @@ ramstage-y += dynamic_cbmem.c
romstage-y += dynamic_cbmem.c
else
ramstage-y += cbmem.c
-romstage-$(CONFIG_EARLY_CBMEM_INIT) += cbmem.c
-romstage-$(CONFIG_BROKEN_CAR_MIGRATE) += cbmem.c
+romstage-y += cbmem.c
endif # CONFIG_DYNAMIC_CBMEM
ramstage-y += cbmem_info.c