summaryrefslogtreecommitdiff
path: root/src/include/cbmem.h
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2014-12-19 08:20:45 +0200
committerKyösti Mälkki <kyosti.malkki@gmail.com>2015-01-27 22:50:14 +0100
commit2fb6b40ed0d4c4d169d4b909ad784e1841b50242 (patch)
tree6d34fc2c9fd525ba86100881515087cc6dee0d6e /src/include/cbmem.h
parent02aebb67b394a9cf81eade4a3952fce3a19c974c (diff)
downloadcoreboot-2fb6b40ed0d4c4d169d4b909ad784e1841b50242.tar.xz
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)
Diffstat (limited to 'src/include/cbmem.h')
-rw-r--r--src/include/cbmem.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/include/cbmem.h b/src/include/cbmem.h
index 05708daead..c2e73144c7 100644
--- a/src/include/cbmem.h
+++ b/src/include/cbmem.h
@@ -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__ */