CBMEM: Support DYNAMIC_CBMEM with LATE_CBMEM_INIT

We can now create CBMEM with dynamic allocation even if CBMEM
location is resolved late in ramstage.

Change-Id: I8529ccbcd4a0e567ebe0a46232ac5d16476e81a8
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/7861
Reviewed-by: Aaron Durbin <adurbin@google.com>
Tested-by: build bot (Jenkins)
This commit is contained in:
Kyösti Mälkki
2014-12-19 08:20:45 +02:00
parent 02aebb67b3
commit 2fb6b40ed0
5 changed files with 58 additions and 18 deletions

View File

@@ -151,6 +151,9 @@ void cbmem_initialize_empty(void);
* below 4GiB. */
void *cbmem_top(void);
/* Set the top address for dynamic cbmem. Not for new designs. */
void cbmem_set_top(void *ramtop);
/* Add a cbmem entry of a given size and id. These return NULL on failure. The
* add function performs a find first and do not check against the original
* size. */
@@ -168,7 +171,6 @@ int cbmem_entry_remove(const struct cbmem_entry *entry);
void *cbmem_entry_start(const struct cbmem_entry *entry);
u64 cbmem_entry_size(const struct cbmem_entry *entry);
#else /* !CONFIG_DYNAMIC_CBMEM */
/* Allocation with static CBMEM is resolved at build time. We start
@@ -183,15 +185,10 @@ u64 cbmem_entry_size(const struct cbmem_entry *entry);
#define HIGH_MEMORY_SIZE ALIGN_UP(_CBMEM_SZ_TOTAL, 0x10000)
#ifndef __PRE_RAM__
void set_top_of_ram(uint64_t ramtop);
void backup_top_of_ram(uint64_t ramtop);
void cbmem_late_set_table(uint64_t base, uint64_t size);
#endif
unsigned long get_top_of_ram(void);
void get_cbmem_table(uint64_t *base, uint64_t *size);
struct cbmem_entry *get_cbmem_toc(void);
@@ -224,6 +221,16 @@ void cbmem_list(void);
void cbmem_print_entry(int n, u32 id, u64 start, u64 size);
#endif /* __PRE_RAM__ */
/* These are for compatibility with old boards only. Any new chipset and board
* must implement cbmem_top() for both romstage and ramstage to support
* early features like COLLECT_TIMESTAMPS and CBMEM_CONSOLE.
*/
#if IS_ENABLED(CONFIG_ARCH_X86) && IS_ENABLED(CONFIG_LATE_CBMEM_INIT)
unsigned long get_top_of_ram(void);
void set_top_of_ram(uint64_t ramtop);
void backup_top_of_ram(uint64_t ramtop);
#endif
#endif /* __ASSEMBLER__ */