[coreboot] New patch to review for coreboot: ed57d88 ramstage: Add cbmem_get_table_location()
Stefan Reinauer (stefan.reinauer@coreboot.org)
gerrit at coreboot.org
Tue Mar 19 01:59:05 CET 2013
Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2797
-gerrit
commit ed57d885dfc5660fdf79c780b3d390c5ed9f2e75
Author: Aaron Durbin <adurbin at chromium.org>
Date: Tue Feb 12 00:40:30 2013 -0600
ramstage: Add cbmem_get_table_location()
When CONFIG_EARLY_CBMEM_INIT is selected romstage is supposed to have
initialized cbmem. Therefore provide a weak function for the chipset
to implement named cbmem_get_table_location(). When
CONFIG_EARLY_CBMEM_INIT is selected cbmem_get_table_location() will be
called to get the cbmem location and size. After that cbmem_initialize()
is called.
Change-Id: Idc45a95f9d4b1d83eb3c6d4977f7a8c80c1ffe76
Signed-off-by: Aaron Durbin <adurbin at chromium.org>
---
src/include/cbmem.h | 5 +++++
src/lib/hardwaremain.c | 10 ++++++++++
2 files changed, 15 insertions(+)
diff --git a/src/include/cbmem.h b/src/include/cbmem.h
index d0f0c9a..1212cb2 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 d2213d2..b29cc93 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. */
More information about the coreboot
mailing list