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
|
|
@ -203,13 +203,19 @@ 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);
|
||||
#define CBMEM_INIT_HOOK(init_fn_) static cbmem_init_hook_t init_fn_ ## _ptr \
|
||||
__attribute__((used, section(".rodata.cbmem_init_hooks"))) = init_fn_;
|
||||
|
||||
#ifndef __PRE_RAM__
|
||||
/* Ramstage only functions. */
|
||||
void cbmem_list(void);
|
||||
void cbmem_arch_init(void);
|
||||
void cbmem_print_entry(int n, u32 id, u64 start, u64 size);
|
||||
static inline void cbmem_run_init_hooks(void) {}
|
||||
#else
|
||||
static inline void cbmem_arch_init(void) {}
|
||||
void cbmem_run_init_hooks(void);
|
||||
#endif /* __PRE_RAM__ */
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
||||
|
|
|
|||
|
|
@ -90,11 +90,6 @@ void timestamp_init(uint64_t base);
|
|||
void timestamp_add(enum timestamp_id id, uint64_t ts_time);
|
||||
/* Calls timestamp_add with current timestamp. */
|
||||
void timestamp_add_now(enum timestamp_id id);
|
||||
/*
|
||||
* Sync all timestamps from timestamp_cache to cbmem area. Called by
|
||||
* cbmem_initialize.
|
||||
*/
|
||||
void timestamp_sync(void);
|
||||
/* Implemented by the architecture code */
|
||||
uint64_t timestamp_get(void);
|
||||
#else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue