Skip to content
Snippets Groups Projects
Commit 1206723b authored by Bin Meng's avatar Bin Meng
Browse files

x86: fsp: acpi: Pass different boot mode to FSP init


When ACPI S3 resume is turned on, we should pass different boot mode
to FSP init instead of default BOOT_FULL_CONFIG.

Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
Reviewed-by: default avatarSimon Glass <sjg@chromium.org>
Tested-by: default avatarStefan Roese <sr@denx.de>
parent b7ef3bff
No related branches found
No related tags found
No related merge requests found
...@@ -61,4 +61,22 @@ static inline enum acpi_sleep_state acpi_sleep_from_pm1(u32 pm1_cnt) ...@@ -61,4 +61,22 @@ static inline enum acpi_sleep_state acpi_sleep_from_pm1(u32 pm1_cnt)
return -EINVAL; return -EINVAL;
} }
/**
* chipset_prev_sleep_state() - Get chipset previous sleep state
*
* This returns chipset previous sleep state from ACPI registers.
* Platform codes must supply this routine in order to support ACPI S3.
*
* @return ACPI_S0/S1/S2/S3/S4/S5.
*/
enum acpi_sleep_state chipset_prev_sleep_state(void);
/**
* chipset_clear_sleep_state() - Clear chipset sleep state
*
* This clears chipset sleep state in ACPI registers.
* Platform codes must supply this routine in order to support ACPI S3.
*/
void chipset_clear_sleep_state(void);
#endif /* __ASM_ACPI_S3_H__ */ #endif /* __ASM_ACPI_S3_H__ */
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <common.h> #include <common.h>
#include <errno.h> #include <errno.h>
#include <asm/acpi_s3.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/mrccache.h> #include <asm/mrccache.h>
#include <asm/post.h> #include <asm/post.h>
...@@ -78,6 +79,10 @@ static __maybe_unused void *fsp_prepare_mrc_cache(void) ...@@ -78,6 +79,10 @@ static __maybe_unused void *fsp_prepare_mrc_cache(void)
int arch_fsp_init(void) int arch_fsp_init(void)
{ {
void *nvs; void *nvs;
int boot_mode = BOOT_FULL_CONFIG;
#ifdef CONFIG_HAVE_ACPI_RESUME
int prev_sleep_state = chipset_prev_sleep_state();
#endif
if (!gd->arch.hob_list) { if (!gd->arch.hob_list) {
#ifdef CONFIG_ENABLE_MRC_CACHE #ifdef CONFIG_ENABLE_MRC_CACHE
...@@ -85,12 +90,31 @@ int arch_fsp_init(void) ...@@ -85,12 +90,31 @@ int arch_fsp_init(void)
#else #else
nvs = NULL; nvs = NULL;
#endif #endif
#ifdef CONFIG_HAVE_ACPI_RESUME
if (prev_sleep_state == ACPI_S3) {
if (nvs == NULL) {
/* If waking from S3 and no cache then */
debug("No MRC cache found in S3 resume path\n");
post_code(POST_RESUME_FAILURE);
/* Clear Sleep Type */
chipset_clear_sleep_state();
/* Reboot */
debug("Rebooting..\n");
reset_cpu(0);
/* Should not reach here.. */
panic("Reboot System");
}
boot_mode = BOOT_ON_S3_RESUME;
}
#endif
/* /*
* The first time we enter here, call fsp_init(). * The first time we enter here, call fsp_init().
* Note the execution does not return to this function, * Note the execution does not return to this function,
* instead it jumps to fsp_continue(). * instead it jumps to fsp_continue().
*/ */
fsp_init(CONFIG_FSP_TEMP_RAM_ADDR, BOOT_FULL_CONFIG, nvs); fsp_init(CONFIG_FSP_TEMP_RAM_ADDR, boot_mode, nvs);
} else { } else {
/* /*
* The second time we enter here, adjust the size of malloc() * The second time we enter here, adjust the size of malloc()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment