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>
This commit is contained in:
parent
6dc148a42b
commit
534b23639b
|
@ -14,6 +14,7 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <arch/acpi.h>
|
||||||
#include <arch/early_variables.h>
|
#include <arch/early_variables.h>
|
||||||
#include <arch/io.h>
|
#include <arch/io.h>
|
||||||
#include <cbmem.h>
|
#include <cbmem.h>
|
||||||
|
@ -35,12 +36,17 @@
|
||||||
|
|
||||||
static struct chipset_power_state power_state CAR_GLOBAL;
|
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)
|
static void migrate_power_state(int is_recovery)
|
||||||
{
|
{
|
||||||
struct chipset_power_state *ps_cbmem;
|
struct chipset_power_state *ps_cbmem;
|
||||||
struct chipset_power_state *ps_car;
|
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));
|
ps_cbmem = cbmem_add(CBMEM_ID_POWER_STATE, sizeof(*ps_cbmem));
|
||||||
|
|
||||||
if (ps_cbmem == NULL) {
|
if (ps_cbmem == NULL) {
|
||||||
|
@ -129,7 +135,7 @@ struct chipset_power_state *fill_power_state(void)
|
||||||
{
|
{
|
||||||
uint16_t tcobase;
|
uint16_t tcobase;
|
||||||
uint8_t *pmc;
|
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();
|
tcobase = smbus_tco_regs();
|
||||||
|
|
||||||
|
@ -161,6 +167,14 @@ struct chipset_power_state *fill_power_state(void)
|
||||||
return ps;
|
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)
|
int vboot_platform_is_resuming(void)
|
||||||
{
|
{
|
||||||
return acpi_sleep_from_pm1(inl(ACPI_BASE_ADDRESS + PM1_CNT)) == ACPI_S3;
|
return acpi_sleep_from_pm1(inl(ACPI_BASE_ADDRESS + PM1_CNT)) == ACPI_S3;
|
||||||
|
|
Loading…
Reference in New Issue