Subrata Banik has uploaded this change for review. ( https://review.coreboot.org/21423
Change subject: soc/intel/skylake: Create acpi_get_sleep_type() to get previous sleep state ......................................................................
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 --- M src/soc/intel/skylake/romstage/power_state.c 1 file changed, 16 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/23/21423/1
diff --git a/src/soc/intel/skylake/romstage/power_state.c b/src/soc/intel/skylake/romstage/power_state.c index 61851a5..f58ef16 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 (struct chipset_power_state *)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 @@ { 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 @@ 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;