Aaron Durbin (adurbin@google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3136
-gerrit
commit 5f232f18b898bc8a5bc4f47be0eed9f7d67a1ed7 Author: Aaron Durbin adurbin@chromium.org Date: Wed Apr 24 16:39:08 2013 -0500
cbmem: use boot state machine
There were previously 2 functions, init_cbmem_pre_device() and init_cbmem_post_device(), where the 2 cbmem implementations implemented one or the other. These 2 functions are no longer needed to be called in the boot flow once the boot state callbacks are utilized.
Change-Id: Ida71f1187bdcc640ae600705ddb3517e1410a80d Signed-off-by: Aaron Durbin adurbin@chromium.org --- src/include/cbmem.h | 5 ----- src/lib/cbmem.c | 12 +++++++----- src/lib/dynamic_cbmem.c | 8 ++++++-- src/lib/hardwaremain.c | 3 --- 4 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/src/include/cbmem.h b/src/include/cbmem.h index 219dbfc..ca2c50b 100644 --- a/src/include/cbmem.h +++ b/src/include/cbmem.h @@ -161,11 +161,6 @@ void cbmem_list(void); void cbmem_arch_init(void); void __attribute__((weak)) cbmem_post_handling(void); void cbmem_print_entry(int n, u32 id, u64 start, u64 size); -/* The pre|post device cbmem initialization functions are for the - * ramstage main to call. When cbmem is actually initialized depends on - * the cbmem implementation. */ -void init_cbmem_pre_device(void); -void init_cbmem_post_device(void); #else static inline void cbmem_arch_init(void) {} #endif /* __PRE_RAM__ */ diff --git a/src/lib/cbmem.c b/src/lib/cbmem.c index ad98082..e8200b6 100644 --- a/src/lib/cbmem.c +++ b/src/lib/cbmem.c @@ -19,6 +19,7 @@
#include <types.h> #include <string.h> +#include <bootstate.h> #include <cbmem.h> #include <console/console.h> #if CONFIG_HAVE_ACPI_RESUME && !defined(__PRE_RAM__) @@ -232,11 +233,7 @@ int cbmem_initialize(void) #endif
#ifndef __PRE_RAM__ -/* cbmem cannot be initialized before device drivers, but it can be initialized - * after the drivers have run. */ -void init_cbmem_pre_device(void) {} - -void init_cbmem_post_device(void) +static void init_cbmem_post_device(void *unused) { cbmem_initialize(); #if CONFIG_CONSOLE_CBMEM @@ -244,6 +241,11 @@ void init_cbmem_post_device(void) #endif }
+BOOT_STATE_INIT_ENTRIES(cbmem_bscb) = { + BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_ENTRY, + init_cbmem_post_device, NULL), +}; + void cbmem_list(void) { struct cbmem_entry *cbmem_toc; diff --git a/src/lib/dynamic_cbmem.c b/src/lib/dynamic_cbmem.c index ae6c87a..5c269a0 100644 --- a/src/lib/dynamic_cbmem.c +++ b/src/lib/dynamic_cbmem.c @@ -17,6 +17,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#include <bootstate.h> #include <boot/tables.h> #include <console/console.h> #include <cbmem.h> @@ -411,7 +412,7 @@ void *cbmem_entry_start(const struct cbmem_entry *entry) /* selected cbmem can be initialized early in ramstage. Additionally, that * means cbmem console can be reinitialized early as well. The post_device * function is empty since cbmem was initialized early in ramstage. */ -void init_cbmem_pre_device(void) +static void init_cbmem_pre_device(void *unused) { cbmem_initialize(); #if CONFIG_CONSOLE_CBMEM @@ -419,7 +420,10 @@ void init_cbmem_pre_device(void) #endif /* CONFIG_CONSOLE_CBMEM */ }
-void init_cbmem_post_device(void) {} +BOOT_STATE_INIT_ENTRIES(cbmem_bscb) = { + BOOT_STATE_INIT_ENTRY(BS_PRE_DEVICE, BS_ON_ENTRY, + init_cbmem_pre_device, NULL), +};
void cbmem_add_lb_mem(struct lb_memory *mem) { diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c index e4b2659..dc2afa4 100644 --- a/src/lib/hardwaremain.c +++ b/src/lib/hardwaremain.c @@ -97,7 +97,6 @@ static struct boot_state boot_states[] = {
static boot_state_t bs_pre_device(void *arg) { - init_cbmem_pre_device(); return BS_DEV_INIT_CHIPS; }
@@ -154,8 +153,6 @@ static boot_state_t bs_post_device(void *arg) { timestamp_stash(TS_DEVICE_DONE);
- init_cbmem_post_device(); - timestamp_sync();
return BS_OS_RESUME_CHECK;