boot state: schedule static callbacks

Many of the boot state callbacks can be scheduled at compile time.
Therefore, provide a way for a compilation unit to inform the
boot state machine when its callbacks should be called. Each C
module can export the callbacks and their scheduling requirements
without changing the shared boot flow code.

Change-Id: Ibc4cea4bd5ad45b2149c2d4aa91cbea652ed93ed
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/3133
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
Aaron Durbin
2013-04-24 16:12:52 -05:00
committed by Ronald G. Minnich
parent 7e35efa83c
commit a4feddf897
5 changed files with 51 additions and 0 deletions

View File

@@ -293,6 +293,23 @@ int boot_state_sched_on_exit(struct boot_state_callback *bscb,
return boot_state_sched_callback(state, bscb, BS_ON_EXIT);
}
static void boot_state_schedule_static_entries(void)
{
extern struct boot_state_init_entry _bs_init_begin;
extern struct boot_state_init_entry _bs_init_end;
struct boot_state_init_entry *cur;
cur = &_bs_init_begin;
while (cur != &_bs_init_end) {
if (cur->when == BS_ON_ENTRY)
boot_state_sched_on_entry(&cur->bscb, cur->state);
else
boot_state_sched_on_exit(&cur->bscb, cur->state);
cur++;
}
}
void hardwaremain(int boot_complete)
{
timestamp_stash(TS_START_RAMSTAGE);
@@ -318,6 +335,9 @@ void hardwaremain(int boot_complete)
hard_reset();
}
/* Schedule the static boot state entries. */
boot_state_schedule_static_entries();
/* FIXME: Is there a better way to handle this? */
init_timer();