summaryrefslogtreecommitdiff
path: root/src/soc/intel/skylake
diff options
context:
space:
mode:
authorSubrata Banik <subrata.banik@intel.com>2017-09-06 18:38:39 +0530
committerSubrata Banik <subrata.banik@intel.com>2017-09-08 01:15:47 +0000
commit534b23639bd1ee82e752f0a8593e46c1d03d8d2c (patch)
treeb76d94ad2f93d9d2b0d7de8d0d433252f958196d /src/soc/intel/skylake
parent6dc148a42b9ae719521caff43556d60cf8ef7ca6 (diff)
soc/intel/skylake: Create acpi_get_sleep_type() to get previous sleep state
This patch implements soc function to get previous sleep state using chipset_power_state global structure. acpi_get_sleep_type is needed in PRE_RAM stage when soc selects CONFIG_EARLY_EBDA_INIT kconfig option. Change-Id: I79acbfc09c8d255fbf9d73e49e8c7764f3f3fac6 Signed-off-by: Subrata Banik <subrata.banik@intel.com> Reviewed-on: https://review.coreboot.org/21423 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Diffstat (limited to 'src/soc/intel/skylake')
-rw-r--r--src/soc/intel/skylake/romstage/power_state.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/soc/intel/skylake/romstage/power_state.c b/src/soc/intel/skylake/romstage/power_state.c
index 61851a587d..19f43c3a93 100644
--- a/src/soc/intel/skylake/romstage/power_state.c
+++ b/src/soc/intel/skylake/romstage/power_state.c
@@ -14,6 +14,7 @@
* GNU General Public License for more details.
*/
+#include <arch/acpi.h>
#include <arch/early_variables.h>
#include <arch/io.h>
#include <cbmem.h>
@@ -35,12 +36,17 @@
static struct chipset_power_state power_state CAR_GLOBAL;
+static struct chipset_power_state *get_power_state(void)
+{
+ return car_get_var_ptr(&power_state);
+}
+
static void migrate_power_state(int is_recovery)
{
struct chipset_power_state *ps_cbmem;
struct chipset_power_state *ps_car;
- ps_car = car_get_var_ptr(&power_state);
+ ps_car = get_power_state();
ps_cbmem = cbmem_add(CBMEM_ID_POWER_STATE, sizeof(*ps_cbmem));
if (ps_cbmem == NULL) {
@@ -129,7 +135,7 @@ struct chipset_power_state *fill_power_state(void)
{
uint16_t tcobase;
uint8_t *pmc;
- struct chipset_power_state *ps = car_get_var_ptr(&power_state);
+ struct chipset_power_state *ps = get_power_state();
tcobase = smbus_tco_regs();
@@ -161,6 +167,14 @@ struct chipset_power_state *fill_power_state(void)
return ps;
}
+int acpi_get_sleep_type(void)
+{
+ struct chipset_power_state *ps;
+
+ ps = get_power_state();
+ return ps->prev_sleep_state;
+}
+
int vboot_platform_is_resuming(void)
{
return acpi_sleep_from_pm1(inl(ACPI_BASE_ADDRESS + PM1_CNT)) == ACPI_S3;