cbmem: Unify random on-CBMEM-init tasks under common CBMEM_INIT_HOOK() API
There are several use cases for performing a certain task when CBMEM is first set up (usually to migrate some data into it that was previously kept in BSS/SRAM/hammerspace), and unfortunately we handle each of them differently: timestamp migration is called explicitly from cbmem_initialize(), certain x86-chipset-specific tasks use the CAR_MIGRATION() macro to register a hook, and the CBMEM console is migrated through a direct call from romstage (on non-x86 and SandyBridge boards). This patch decouples the CAR_MIGRATION() hook mechanism from cache-as-RAM and rechristens it to CBMEM_INIT_HOOK(), which is a clearer description of what it really does. All of the above use cases are ported to this new, consistent model, allowing us to have one less line of boilerplate in non-CAR romstages. BRANCH=None BUG=None TEST=Built and booted on Nyan_Blaze and Falco with and without CONFIG_CBMEM_CONSOLE. Confirmed that 'cbmem -c' shows the full log after boot (and the resume log after S3 resume on Falco). Compiled for Parrot, Stout and Lumpy. Change-Id: I1681b372664f5a1f15c3733cbd32b9b11f55f8ea Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/232612 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
a126a62f65
commit
7dd5bbd712
30 changed files with 48 additions and 105 deletions
|
|
@ -23,11 +23,6 @@
|
|||
#include <cbmem.h>
|
||||
#include <arch/early_variables.h>
|
||||
|
||||
typedef void (* const car_migration_func_t)(void);
|
||||
|
||||
extern car_migration_func_t _car_migrate_start;
|
||||
extern car_migration_func_t _car_migrate_end;
|
||||
|
||||
extern char _car_data_start[];
|
||||
extern char _car_data_end[];
|
||||
|
||||
|
|
@ -77,7 +72,6 @@ void *car_get_var_ptr(void *var)
|
|||
void 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];
|
||||
|
||||
migrated_base = cbmem_add(CBMEM_ID_CAR_GLOBALS, car_data_size);
|
||||
|
|
@ -91,11 +85,4 @@ void car_migrate_variables(void)
|
|||
|
||||
/* Mark that the data has been moved. */
|
||||
car_migrated = ~0;
|
||||
|
||||
/* Call all the migration functions. */
|
||||
migrate_func = &_car_migrate_start;
|
||||
while (migrate_func != &_car_migrate_end) {
|
||||
(*migrate_func)();
|
||||
migrate_func++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue