soc/intel/cannonlake: Create acpi_get_sleep_type() to get previous sleep state

This patch uses PMC common function to get previous sleep state
using cbmem or 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: Ib9f8bdc1c682807450b6c01941b9a0927789b2d8
Signed-off-by: Subrata Banik <subrata.banik@intel.com>
Reviewed-on: https://review.coreboot.org/21988
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Subrata Banik 2017-10-12 19:38:21 +05:30 committed by Aaron Durbin
parent c1ca65df3f
commit 319e3b4cce
1 changed files with 8 additions and 2 deletions

View File

@ -24,14 +24,20 @@
#include <soc/pci_devs.h>
#include <soc/pm.h>
static struct chipset_power_state power_state CAR_GLOBAL;
int acpi_get_sleep_type(void)
{
struct chipset_power_state *ps;
ps = pmc_get_power_state();
return ps->prev_sleep_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 = pmc_get_power_state();
ps_cbmem = cbmem_add(CBMEM_ID_POWER_STATE, sizeof(*ps_cbmem));
if (ps_cbmem == NULL) {