aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel/fsp_baytrail/fsp
diff options
context:
space:
mode:
authorMohan D'Costa <mohan@ndr.co.jp>2014-09-18 15:57:06 +0900
committerMartin Roth <gaumless@gmail.com>2014-09-29 19:35:57 +0200
commited0c83877f453b94a5e68bef62d6dbba1b97f0d2 (patch)
treec0c3ba635505da345f65840cb2270556e7f13c19 /src/soc/intel/fsp_baytrail/fsp
parentbdae9bedcdf5650abee089564c47ecbf2ba70f79 (diff)
intel/fsp_baytrail: Add S3 suspend/resume Support
This adds S3 Suspend / Resume support to Intel's Bay Trail FSP It is based on the "src/soc/intel/baytrail/romstage/romstage.c" implementation. Change-Id: If0011068eb7290d1b764c5c4b12c17375fb69008 Signed-off-by: Mohan D'Costa <mohan@ndr.co.jp> Reviewed-on: http://review.coreboot.org/6937 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Martin Roth <gaumless@gmail.com> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/soc/intel/fsp_baytrail/fsp')
-rw-r--r--src/soc/intel/fsp_baytrail/fsp/chipset_fsp_util.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/soc/intel/fsp_baytrail/fsp/chipset_fsp_util.c b/src/soc/intel/fsp_baytrail/fsp/chipset_fsp_util.c
index 60a1f7af7e..83a1100234 100644
--- a/src/soc/intel/fsp_baytrail/fsp/chipset_fsp_util.c
+++ b/src/soc/intel/fsp_baytrail/fsp/chipset_fsp_util.c
@@ -28,7 +28,11 @@
#include <baytrail/pci_devs.h>
#include <drivers/intel/fsp/fsp_util.h>
#include "../chip.h"
+#include <arch/io.h>
#include <baytrail/reset.h>
+#include <baytrail/pmc.h>
+#include <baytrail/acpi.h>
+#include <baytrail/iomap.h>
#ifdef __PRE_RAM__
#include <baytrail/romstage.h>
@@ -307,18 +311,43 @@ void chipset_fsp_early_init(FSP_INIT_PARAMS *pFspInitParams,
FSP_INFO_HEADER *fsp_ptr)
{
FSP_INIT_RT_BUFFER *pFspRtBuffer = pFspInitParams->RtBufferPtr;
+ uint32_t prev_sleep_state;
+
+ /* Get previous sleep state but don't clear */
+ prev_sleep_state = chipset_prev_sleep_state(0);
+ printk(BIOS_INFO, "prev_sleep_state = S%d\n", prev_sleep_state);
/* Initialize the UPD Data */
GetUpdDefaultFromFsp (fsp_ptr, pFspRtBuffer->Common.UpdDataRgnPtr);
ConfigureDefaultUpdData(pFspRtBuffer->Common.UpdDataRgnPtr);
pFspInitParams->NvsBufferPtr = NULL;
- pFspRtBuffer->Common.BootMode = BOOT_WITH_FULL_CONFIGURATION;
-#if IS_ENABLED(CONFIG_ENABLE_FSP_FAST_BOOT)
+#if IS_ENABLED(CONFIG_ENABLE_MRC_CACHE)
/* Find the fastboot cache that was saved in the ROM */
pFspInitParams->NvsBufferPtr = find_and_set_fastboot_cache();
#endif
+ if (prev_sleep_state == 3) {
+ /* S3 resume */
+ if ( pFspInitParams->NvsBufferPtr == NULL) {
+ /* If waking from S3 and no cache then. */
+ printk(BIOS_WARNING, "No MRC cache found in S3 resume path.\n");
+ post_code(POST_RESUME_FAILURE);
+ /* Clear Sleep Type */
+ outl(inl(ACPI_BASE_ADDRESS + PM1_CNT) &
+ ~(SLP_TYP), ACPI_BASE_ADDRESS + PM1_CNT);
+ /* Reboot */
+ printk(BIOS_WARNING,"Rebooting..\n" );
+ warm_reset();
+ /* Should not reach here.. */
+ die("Reboot System\n");
+ }
+ pFspRtBuffer->Common.BootMode = BOOT_ON_S3_RESUME;
+ } else {
+ /* Not S3 resume */
+ pFspRtBuffer->Common.BootMode = BOOT_WITH_FULL_CONFIGURATION;
+ }
+
return;
}