summaryrefslogtreecommitdiff
path: root/src/arch
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/arch
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/arch')
-rw-r--r--src/arch/x86/boot/cbmem.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/arch/x86/boot/cbmem.c b/src/arch/x86/boot/cbmem.c
index a1452237e3..1036adc17f 100644
--- a/src/arch/x86/boot/cbmem.c
+++ b/src/arch/x86/boot/cbmem.c
@@ -39,6 +39,9 @@ void get_cbmem_table(uint64_t *base, uint64_t *size)
*size = 0;
}
}
+#endif /* !DYNAMIC_CBMEM */
+
+#if IS_ENABLED(CONFIG_LATE_CBMEM_INIT)
#if !defined(__PRE_RAM__)
void __attribute__((weak)) backup_top_of_ram(uint64_t ramtop)
@@ -46,14 +49,14 @@ void __attribute__((weak)) backup_top_of_ram(uint64_t ramtop)
/* Do nothing. Chipset may have implementation to save ramtop in NVRAM. */
}
-/* This is for compatibility with old boards only. Any new chipset and board
- * must implement get_top_of_ram() for both romstage and ramstage to support
- * early features like COLLECT_TIMESTAMPS and CBMEM_CONSOLE.
- */
void set_top_of_ram(uint64_t ramtop)
{
backup_top_of_ram(ramtop);
+#if !CONFIG_DYNAMIC_CBMEM
cbmem_late_set_table(ramtop - HIGH_MEMORY_SIZE, HIGH_MEMORY_SIZE);
+#else
+ cbmem_set_top((void*)(uintptr_t)ramtop);
+#endif
}
#endif /* !__PRE_RAM__ */
@@ -70,7 +73,8 @@ void *cbmem_top(void)
return (void *)get_top_of_ram();
}
#endif
-#endif /* !DYNAMIC_CBMEM */
+
+#endif /* LATE_CBMEM_INIT */
void cbmem_run_init_hooks(void)
{