[coreboot-gerrit] New patch to review for coreboot: bootstate: add arch specific hook at coreboot exit
Aaron Durbin (adurbin@chromium.org)
gerrit at coreboot.org
Wed Dec 7 19:15:43 CET 2016
Aaron Durbin (adurbin at chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17767
-gerrit
commit b368a60fb2cbf0904d324669eba287ca643f5ee8
Author: Aaron Durbin <adurbin at chromium.org>
Date: Wed Dec 7 11:58:20 2016 -0600
bootstate: add arch specific hook at coreboot exit
The bootstate machine allows one to schedule work at the
boundaries of each state. However, there are no priorities by
design. As such if there are things that need to be performed
that are interdependent between callbacks there's no way to
do that aside from explicitly putting the call in one of the
callbacks.
This situation arises around BS_OS_RESUME, BS_PAYLOAD_LOAD,
and BS_PAYLOAD_BOOT as those are the states where coreboot is
about to exit. As such, provide an architecture specific hook
at these key places so that one is guaranteed any work done
in arch_bootstate_coreboot_exit() is after all callbacks in
the state machine.
BUG=chrome-os-partner:60657
BRANCH=reef
Change-Id: Icb4afb341ab15af0670501b9d21799e564fb32c6
Signed-off-by: Aaron Durbin <adurbin at chromium.org>
---
src/include/bootstate.h | 4 ++++
src/lib/hardwaremain.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/src/include/bootstate.h b/src/include/bootstate.h
index 09178a5..481a8bc 100644
--- a/src/include/bootstate.h
+++ b/src/include/bootstate.h
@@ -195,4 +195,8 @@ struct boot_state_init_entry {
bsie_ ## func_ ##_## state_ ##_## when_ BOOT_STATE_INIT_ATTR = \
& func_ ##_## state_ ##_## when_;
+/* Hook per arch when coreboot is exiting to payload or ACPI OS resume. It's
+ * the very last thing done before the transition. */
+void arch_bootstate_coreboot_exit(void);
+
#endif /* BOOTSTATE_H */
diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c
index ef78960..57768f2 100644
--- a/src/lib/hardwaremain.c
+++ b/src/lib/hardwaremain.c
@@ -115,6 +115,8 @@ static struct boot_state boot_states[] = {
BS_INIT_ENTRY(BS_PAYLOAD_BOOT, bs_payload_boot),
};
+void __attribute__((weak)) arch_bootstate_coreboot_exit(void) { }
+
static boot_state_t bs_pre_device(void *arg)
{
return BS_DEV_INIT_CHIPS;
@@ -198,6 +200,7 @@ static boot_state_t bs_os_resume_check(void *arg)
static boot_state_t bs_os_resume(void *wake_vector)
{
#if CONFIG_HAVE_ACPI_RESUME
+ arch_bootstate_coreboot_exit();
acpi_resume(wake_vector);
#endif
return BS_WRITE_TABLES;
@@ -226,6 +229,7 @@ static boot_state_t bs_payload_load(void *arg)
static boot_state_t bs_payload_boot(void *arg)
{
+ arch_bootstate_coreboot_exit();
payload_run();
printk(BIOS_EMERG, "Boot failed\n");
More information about the coreboot-gerrit
mailing list