diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/cbmem.h | 5 | ||||
-rw-r--r-- | src/lib/hardwaremain.c | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/include/cbmem.h b/src/include/cbmem.h index d0f0c9a5cc..1212cb2655 100644 --- a/src/include/cbmem.h +++ b/src/include/cbmem.h @@ -67,6 +67,11 @@ #ifndef __ASSEMBLER__ #ifndef __PRE_RAM__ extern uint64_t high_tables_base, high_tables_size; +#if CONFIG_EARLY_CBMEM_INIT +/* Return 0 on success, < 0 on error. */ +int __attribute__((weak)) cbmem_get_table_location(uint64_t *tables_base, + uint64_t *tables_size); +#endif #endif int cbmem_initialize(void); diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c index d2213d2c83..b29cc93e79 100644 --- a/src/lib/hardwaremain.c +++ b/src/lib/hardwaremain.c @@ -85,6 +85,16 @@ void hardwaremain(int boot_complete) /* FIXME: Is there a better way to handle this? */ init_timer(); + /* CONFIG_EARLY_CBMEM_INIT indicates that romstage initialized + * the cbmem area. Therefore the table location can be initialized + * early in ramstage if cbmem_get_table_location() is implemented. + */ +#if CONFIG_EARLY_CBMEM_INIT + if (cbmem_get_table_location != NULL && + !cbmem_get_table_location(&high_tables_base, &high_tables_size)) + cbmem_initialize(); +#endif + timestamp_stash(TS_DEVICE_ENUMERATE); /* Initialize chips early, they might disable unused devices. */ |