diff options
author | Aaron Durbin <adurbin@chromium.org> | 2015-06-09 13:54:10 -0500 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2015-06-09 22:03:30 +0200 |
commit | 41607a4682c75b716e342cfc773926c753fb6086 (patch) | |
tree | 9fe3ea3bbbcce423cc9dfb6c91a890a2dab3a942 | |
parent | db23215039894cf7668cba21c94753a9fcc546a0 (diff) |
cbmem: add indicator to hooks if cbmem is being recovered
It can be helpful to certain users of the cbmem init hooks
to know if recovery was done or not. Therefore, add this
as a parameter to the hooks.
Change-Id: I049fc191059cfdb8095986d3dc4eee9e25cf5452
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/10480
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
-rw-r--r-- | src/arch/x86/boot/gdt.c | 2 | ||||
-rw-r--r-- | src/cpu/x86/car.c | 2 | ||||
-rw-r--r-- | src/drivers/usb/ehci_debug.c | 2 | ||||
-rw-r--r-- | src/include/cbmem.h | 5 | ||||
-rw-r--r-- | src/lib/cbmem_common.c | 4 | ||||
-rw-r--r-- | src/lib/cbmem_console.c | 2 | ||||
-rw-r--r-- | src/lib/imd_cbmem.c | 6 | ||||
-rw-r--r-- | src/lib/timestamp.c | 2 | ||||
-rw-r--r-- | src/soc/intel/baytrail/romstage/romstage.c | 2 | ||||
-rw-r--r-- | src/soc/intel/broadwell/romstage/power_state.c | 2 |
10 files changed, 16 insertions, 13 deletions
diff --git a/src/arch/x86/boot/gdt.c b/src/arch/x86/boot/gdt.c index e13d3bc4da..44156ea3f6 100644 --- a/src/arch/x86/boot/gdt.c +++ b/src/arch/x86/boot/gdt.c @@ -32,7 +32,7 @@ struct gdtarg { /* Copy GDT to new location and reload it. * FIXME: We only do this for BSP CPU. */ -static void move_gdt(void) +static void move_gdt(int is_recovery) { void *newgdt; u16 num_gdt_bytes = (u32)&gdt_end - (u32)&gdt; diff --git a/src/cpu/x86/car.c b/src/cpu/x86/car.c index ffcf0dbf9f..b0a86b184b 100644 --- a/src/cpu/x86/car.c +++ b/src/cpu/x86/car.c @@ -136,7 +136,7 @@ static void do_car_migrate_variables(void) car_migrated = ~0; } -static void car_migrate_variables(void) +static void car_migrate_variables(int is_recovery) { if (!IS_ENABLED(CONFIG_BROKEN_CAR_MIGRATE) && !IS_ENABLED(PLATFORM_USES_FSP1_0)) do_car_migrate_variables(); diff --git a/src/drivers/usb/ehci_debug.c b/src/drivers/usb/ehci_debug.c index a6de8b27cc..5098f97ff5 100644 --- a/src/drivers/usb/ehci_debug.c +++ b/src/drivers/usb/ehci_debug.c @@ -670,7 +670,7 @@ static int get_usbdebug_from_cbmem(struct ehci_debug_info *info) } #elif defined(__PRE_RAM__) -static void migrate_ehci_debug(void) +static void migrate_ehci_debug(int is_recovery) { struct ehci_debug_info *dbg_info = dbgp_ehci_info(); struct ehci_debug_info *dbg_info_cbmem; diff --git a/src/include/cbmem.h b/src/include/cbmem.h index 55b04b4106..341296cec1 100644 --- a/src/include/cbmem.h +++ b/src/include/cbmem.h @@ -113,8 +113,9 @@ void *cbmem_add(u32 id, u64 size); /* Find a cbmem entry of a given id. These return NULL on failure. */ void *cbmem_find(u32 id); -typedef void (* const cbmem_init_hook_t)(void); -void cbmem_run_init_hooks(void); +/* Indicate to each hook if cbmem is being recovered or not. */ +typedef void (* const cbmem_init_hook_t)(int is_recovery); +void cbmem_run_init_hooks(int is_recovery); void cbmem_fail_resume(void); #ifndef __PRE_RAM__ diff --git a/src/lib/cbmem_common.c b/src/lib/cbmem_common.c index 496bafa986..d3019c5644 100644 --- a/src/lib/cbmem_common.c +++ b/src/lib/cbmem_common.c @@ -25,7 +25,7 @@ #include <arch/acpi.h> #endif -void cbmem_run_init_hooks(void) +void cbmem_run_init_hooks(int is_recovery) { cbmem_init_hook_t *init_hook_ptr = (cbmem_init_hook_t*) &_cbmem_init_hooks; cbmem_init_hook_t *einit_hook_ptr = (cbmem_init_hook_t*) &_ecbmem_init_hooks; @@ -34,7 +34,7 @@ void cbmem_run_init_hooks(void) return; while (init_hook_ptr != einit_hook_ptr) { - (*init_hook_ptr)(); + (*init_hook_ptr)(is_recovery); init_hook_ptr++; } } diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c index 48664543fc..464294cabc 100644 --- a/src/lib/cbmem_console.c +++ b/src/lib/cbmem_console.c @@ -208,7 +208,7 @@ static void copy_console_buffer(struct cbmem_console *old_cons_p, new_cons_p->buffer_cursor = cursor; } -static void cbmemc_reinit(void) +static void cbmemc_reinit(int is_recovery) { struct cbmem_console *cbm_cons_p; const size_t size = CONFIG_CONSOLE_CBMEM_BUFFER_SIZE; diff --git a/src/lib/imd_cbmem.c b/src/lib/imd_cbmem.c index d1ff57d96c..fa6533484f 100644 --- a/src/lib/imd_cbmem.c +++ b/src/lib/imd_cbmem.c @@ -101,6 +101,7 @@ void cbmem_initialize_empty_id_size(u32 id, u64 size) { struct imd *imd; struct imd imd_backing; + const int no_recovery = 0; imd = imd_init_backing(&imd_backing); imd_handle_init(imd, cbmem_top()); @@ -118,7 +119,7 @@ void cbmem_initialize_empty_id_size(u32 id, u64 size) cbmem_add(id, size); /* Complete migration to CBMEM. */ - cbmem_run_init_hooks(); + cbmem_run_init_hooks(no_recovery); } static inline int cbmem_fail_recovery(void) @@ -137,6 +138,7 @@ int cbmem_initialize_id_size(u32 id, u64 size) { struct imd *imd; struct imd imd_backing; + const int recovery = 1; imd = imd_init_backing(&imd_backing); imd_handle_init(imd, cbmem_top()); @@ -158,7 +160,7 @@ int cbmem_initialize_id_size(u32 id, u64 size) cbmem_add(id, size); /* Complete migration to CBMEM. */ - cbmem_run_init_hooks(); + cbmem_run_init_hooks(recovery); /* Recovery successful. */ return 0; diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c index 3b886b62c6..0c41ea2156 100644 --- a/src/lib/timestamp.c +++ b/src/lib/timestamp.c @@ -157,7 +157,7 @@ void timestamp_init(uint64_t base) #endif } -static void timestamp_reinit(void) +static void timestamp_reinit(int is_recovery) { if (!timestamp_should_run()) return; diff --git a/src/soc/intel/baytrail/romstage/romstage.c b/src/soc/intel/baytrail/romstage/romstage.c index 3f35bdeb93..1b93eb67f4 100644 --- a/src/soc/intel/baytrail/romstage/romstage.c +++ b/src/soc/intel/baytrail/romstage/romstage.c @@ -144,7 +144,7 @@ void * asmlinkage romstage_main(unsigned long bist, static struct chipset_power_state power_state CAR_GLOBAL; -static void migrate_power_state(void) +static void migrate_power_state(int is_recovery) { struct chipset_power_state *ps_cbmem; struct chipset_power_state *ps_car; diff --git a/src/soc/intel/broadwell/romstage/power_state.c b/src/soc/intel/broadwell/romstage/power_state.c index ce52b49b85..defa014d83 100644 --- a/src/soc/intel/broadwell/romstage/power_state.c +++ b/src/soc/intel/broadwell/romstage/power_state.c @@ -36,7 +36,7 @@ static struct chipset_power_state power_state CAR_GLOBAL; -static void migrate_power_state(void) +static void migrate_power_state(int is_recovery) { struct chipset_power_state *ps_cbmem; struct chipset_power_state *ps_car; |