aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2014-12-31 20:55:19 +0200
committerKyösti Mälkki <kyosti.malkki@gmail.com>2015-01-27 22:47:35 +0100
commit91fac61240612291f7be3362f7acad31803e8b03 (patch)
tree31c604a58e7b389b45d2f397eb7b37171c45dcc8 /src
parent3bf38548474697d11c935f23a610222c36df90c0 (diff)
downloadcoreboot-91fac61240612291f7be3362f7acad31803e8b03.tar.gz
coreboot-91fac61240612291f7be3362f7acad31803e8b03.tar.xz
coreboot-91fac61240612291f7be3362f7acad31803e8b03.zip
CBMEM: Tidy up CAR migration
Move the CAR migration call to arch -specific part of CBMEM init, it is truly a x86 specific thing. Change-Id: I715417e54f197b8745e0670d6b900a5660178141 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/7860 Reviewed-by: Aaron Durbin <adurbin@google.com> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src')
-rw-r--r--src/Kconfig14
-rw-r--r--src/arch/arm/include/arch/early_variables.h1
-rw-r--r--src/arch/arm64/include/arch/early_variables.h1
-rw-r--r--src/arch/riscv/include/arch/early_variables.h5
-rw-r--r--src/arch/x86/Kconfig15
-rw-r--r--src/arch/x86/boot/cbmem.c4
-rw-r--r--src/cpu/x86/car.c8
-rw-r--r--src/lib/cbmem.c3
-rw-r--r--src/lib/dynamic_cbmem.c10
9 files changed, 30 insertions, 31 deletions
diff --git a/src/Kconfig b/src/Kconfig
index 92714d5ed..a58e04a4d 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -159,20 +159,6 @@ config INCLUDE_CONFIG_FILE
config EARLY_CBMEM_INIT
def_bool !LATE_CBMEM_INIT
-config LATE_CBMEM_INIT
- def_bool n
- help
- Enable this in chipset's Kconfig if northbridge does not implement
- early get_top_of_ram() call for romstage. CBMEM tables will be
- allocated late in ramstage, after PCI devices resources are known.
-
-config BROKEN_CAR_MIGRATE
- def_bool LATE_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
- CAR_GLOBAL and never do CAR migration.
-
config DYNAMIC_CBMEM
bool
default n
diff --git a/src/arch/arm/include/arch/early_variables.h b/src/arch/arm/include/arch/early_variables.h
index cb0872e8f..97bc0cd38 100644
--- a/src/arch/arm/include/arch/early_variables.h
+++ b/src/arch/arm/include/arch/early_variables.h
@@ -27,6 +27,5 @@ static inline void *car_get_var_ptr(void *var) { return var; }
#define car_get_var(var) (var)
#define car_sync_var(var) (var)
#define car_set_var(var, val) do { (var) = (val); } while (0)
-static inline void car_migrate_variables(void) { }
#endif
diff --git a/src/arch/arm64/include/arch/early_variables.h b/src/arch/arm64/include/arch/early_variables.h
index cb0872e8f..97bc0cd38 100644
--- a/src/arch/arm64/include/arch/early_variables.h
+++ b/src/arch/arm64/include/arch/early_variables.h
@@ -27,6 +27,5 @@ static inline void *car_get_var_ptr(void *var) { return var; }
#define car_get_var(var) (var)
#define car_sync_var(var) (var)
#define car_set_var(var, val) do { (var) = (val); } while (0)
-static inline void car_migrate_variables(void) { }
#endif
diff --git a/src/arch/riscv/include/arch/early_variables.h b/src/arch/riscv/include/arch/early_variables.h
index f9516a4c1..97bc0cd38 100644
--- a/src/arch/riscv/include/arch/early_variables.h
+++ b/src/arch/riscv/include/arch/early_variables.h
@@ -20,10 +20,6 @@
#ifndef ARCH_EARLY_VARIABLES_H
#define ARCH_EARLY_VARIABLES_H
-#if defined(CONFIG_CAR_MIGRATION) && CONFIG_CAR_MIGRATION
- #error "This is RISCV, silly... we don't have CAR here."
-#endif
-
#define CAR_GLOBAL
#define CAR_MIGRATE(migrate_fn_)
@@ -31,6 +27,5 @@ static inline void *car_get_var_ptr(void *var) { return var; }
#define car_get_var(var) (var)
#define car_sync_var(var) (var)
#define car_set_var(var, val) do { (var) = (val); } while (0)
-static inline void car_migrate_variables(void) { }
#endif
diff --git a/src/arch/x86/Kconfig b/src/arch/x86/Kconfig
index edbc67acb..dfb91fad8 100644
--- a/src/arch/x86/Kconfig
+++ b/src/arch/x86/Kconfig
@@ -51,6 +51,21 @@ config ROMCC
bool
default n
+config BROKEN_CAR_MIGRATE
+ def_bool n
+ help
+ Many boards use CAR_GLOBAL but have no EARLY_CBMEM_INIT and
+ manage CAR migration on S3 resume path only. Couple boards use
+ CAR_GLOBAL and never do CAR migration.
+
+config LATE_CBMEM_INIT
+ def_bool n
+ select BROKEN_CAR_MIGRATE
+ help
+ Enable this in chipset's Kconfig if northbridge does not implement
+ early get_top_of_ram() call for romstage. CBMEM tables will be
+ allocated late in ramstage, after PCI devices resources are known.
+
config PC80_SYSTEM
bool
default y if ARCH_X86
diff --git a/src/arch/x86/boot/cbmem.c b/src/arch/x86/boot/cbmem.c
index af42edd84..80588c385 100644
--- a/src/arch/x86/boot/cbmem.c
+++ b/src/arch/x86/boot/cbmem.c
@@ -21,6 +21,7 @@
#include <arch/acpi.h>
/* FIXME: Remove after CBMEM_INIT_HOOKS. */
+#include <arch/early_variables.h>
#include <cpu/x86/gdt.h>
#include <console/cbmem_console.h>
#include <timestamp.h>
@@ -76,6 +77,9 @@ void *cbmem_top(void)
void cbmem_run_init_hooks(void)
{
+ /* Migrate car.global_data. */
+ car_migrate_variables();
+
#if !defined(__PRE_RAM__)
/* Relocate CBMEM console. */
cbmemc_reinit();
diff --git a/src/cpu/x86/car.c b/src/cpu/x86/car.c
index e757f0912..cca9afd69 100644
--- a/src/cpu/x86/car.c
+++ b/src/cpu/x86/car.c
@@ -108,7 +108,6 @@ void *car_sync_var_ptr(void *var)
static void do_car_migrate_variables(void)
{
void *migrated_base;
- car_migration_func_t *migrate_func;
size_t car_data_size = &_car_data_end[0] - &_car_data_start[0];
/* Check if already migrated. */
@@ -126,7 +125,11 @@ static void do_car_migrate_variables(void)
/* Mark that the data has been moved. */
car_migrated = ~0;
+}
+static void do_car_migrate_hooks(void)
+{
+ car_migration_func_t *migrate_func;
/* Call all the migration functions. */
migrate_func = &_car_migrate_start;
while (*migrate_func != NULL) {
@@ -139,4 +142,7 @@ void car_migrate_variables(void)
{
if (!IS_ENABLED(CONFIG_BROKEN_CAR_MIGRATE))
do_car_migrate_variables();
+
+ if (!IS_ENABLED(CONFIG_BROKEN_CAR_MIGRATE))
+ do_car_migrate_hooks();
}
diff --git a/src/lib/cbmem.c b/src/lib/cbmem.c
index ba6560c49..d5f89a188 100644
--- a/src/lib/cbmem.c
+++ b/src/lib/cbmem.c
@@ -242,8 +242,9 @@ int cbmem_recovery(int is_wakeup)
cbmem_fail_resume();
}
+ /* Complete migration to CBMEM. */
cbmem_run_init_hooks();
- car_migrate_variables();
+
return !found;
}
diff --git a/src/lib/dynamic_cbmem.c b/src/lib/dynamic_cbmem.c
index a5f2fc2db..645521776 100644
--- a/src/lib/dynamic_cbmem.c
+++ b/src/lib/dynamic_cbmem.c
@@ -170,18 +170,14 @@ void cbmem_initialize_empty(void)
printk(BIOS_DEBUG, "CBMEM: root @ %p %d entries.\n",
root, root->max_entries);
+ /* Complete migration to CBMEM. */
cbmem_run_init_hooks();
-
- /* Migrate cache-as-ram variables. */
- car_migrate_variables();
}
static inline int cbmem_fail_recovery(void)
{
cbmem_initialize_empty();
cbmem_fail_resume();
- /* Migrate cache-as-ram variables. */
- car_migrate_variables();
return 1;
}
@@ -248,11 +244,9 @@ int cbmem_initialize(void)
root->locked = 1;
#endif
+ /* Complete migration to CBMEM. */
cbmem_run_init_hooks();
- /* Migrate cache-as-ram variables. */
- car_migrate_variables();
-
/* Recovery successful. */
return 0;
}