From 534b23639bd1ee82e752f0a8593e46c1d03d8d2c Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Wed, 6 Sep 2017 18:38:39 +0530 Subject: soc/intel/skylake: Create acpi_get_sleep_type() to get previous sleep state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: https://review.coreboot.org/21423 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Kyösti Mälkki --- src/soc/intel/skylake/romstage/power_state.c | 18 ++++++++++++++++-- 1 file 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 #include #include #include @@ -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; -- cgit v1.2.3