diff options
author | Aaron Durbin <adurbin@chromium.org> | 2013-04-24 22:33:08 -0500 |
---|---|---|
committer | Ronald G. Minnich <rminnich@gmail.com> | 2013-05-01 07:07:33 +0200 |
commit | 0a6c20a2a3bc16aa12b04dd3db1d1260777edf0e (patch) | |
tree | d5ab49da23e52e262c016ed7cb3a11f8e6a1556e /src/lib/hardwaremain.c | |
parent | a4feddf897023b37cfac2af529e787504849f985 (diff) |
acpi: split resume check and actual resume code
It's helpful to provide a distinct state that affirmatively
describes that OS resume will occur. The previous code included
the check and the actual resuming in one function. Because of this
grouping one had to annotate the innards of the ACPI resume
path to perform specific actions before OS resume. By providing
a distinct state in the boot state machine the necessary actions
can be scheduled accordingly without modifying the ACPI code.
Change-Id: I8b00aacaf820cbfbb21cb851c422a143371878bd
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/3134
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/lib/hardwaremain.c')
-rw-r--r-- | src/lib/hardwaremain.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c index 0a5a522b99..d8b9d433f6 100644 --- a/src/lib/hardwaremain.c +++ b/src/lib/hardwaremain.c @@ -54,6 +54,7 @@ static boot_state_t bs_dev_resources(void *arg); static boot_state_t bs_dev_eanble(void *arg); static boot_state_t bs_dev_init(void *arg); static boot_state_t bs_post_device(void *arg); +static boot_state_t bs_os_resume_check(void *arg); static boot_state_t bs_os_resume(void *arg); static boot_state_t bs_write_tables(void *arg); static boot_state_t bs_payload_load(void *arg); @@ -88,6 +89,7 @@ static struct boot_state boot_states[] = { BS_INIT_ENTRY(BS_DEV_ENABLE, bs_dev_eanble), BS_INIT_ENTRY(BS_DEV_INIT, bs_dev_init), BS_INIT_ENTRY(BS_POST_DEVICE, bs_post_device), + BS_INIT_ENTRY(BS_OS_RESUME_CHECK, bs_os_resume_check), BS_INIT_ENTRY(BS_OS_RESUME, bs_os_resume), BS_INIT_ENTRY(BS_WRITE_TABLES, bs_write_tables), BS_INIT_ENTRY(BS_PAYLOAD_LOAD, bs_payload_load), @@ -157,21 +159,35 @@ static boot_state_t bs_post_device(void *arg) timestamp_sync(); - return BS_OS_RESUME; + return BS_OS_RESUME_CHECK; } -static boot_state_t bs_os_resume(void *arg) +static boot_state_t bs_os_resume_check(void *arg) { #if CONFIG_HAVE_ACPI_RESUME - suspend_resume(); + void *wake_vector; + + wake_vector = acpi_find_wakeup_vector(); + + if (wake_vector != NULL) { + boot_states[BS_OS_RESUME].arg = wake_vector; + return BS_OS_RESUME; + } post_code(0x8a); #endif - timestamp_add_now(TS_CBMEM_POST); return BS_WRITE_TABLES; } +static boot_state_t bs_os_resume(void *wake_vector) +{ +#if CONFIG_HAVE_ACPI_RESUME + acpi_resume(wake_vector); +#endif + return BS_WRITE_TABLES; +} + static boot_state_t bs_write_tables(void *arg) { if (cbmem_post_handling) |