soc/amd/stoneyridge: Relocate acpi_get_sleep_type()

Move the function into common code.  Convert it to use the memory-
mapped access type.  Convert vboot_platform_is_resuming() to call it
instead of duplicating the source.

BUG=b:131682806

Change-Id: I245bebb8dc2d331cdd56acfb245a004536b792ab
Signed-off-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32658
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Marshall Dawson 2019-05-03 13:06:55 -06:00 committed by Martin Roth
parent ec63a7140a
commit 26307c7385
2 changed files with 6 additions and 7 deletions

View File

@ -132,13 +132,17 @@ void acpi_clear_pm1_status(void)
print_pm1_status(pm1_sts); print_pm1_status(pm1_sts);
} }
int acpi_get_sleep_type(void)
{
return acpi_sleep_from_pm1(acpi_read16(MMIO_ACPI_PM1_CNT_BLK));
}
int vboot_platform_is_resuming(void) int vboot_platform_is_resuming(void)
{ {
if (!(acpi_read16(MMIO_ACPI_PM1_STS) & WAK_STS)) if (!(acpi_read16(MMIO_ACPI_PM1_STS) & WAK_STS))
return 0; return 0;
uint16_t pm_cnt = acpi_read16(MMIO_ACPI_PM1_CNT_BLK); return acpi_get_sleep_type() == ACPI_S3;
return acpi_sleep_from_pm1(pm_cnt) == ACPI_S3;
} }
/* If a system reset is about to be requested, modify the PM1 register so it /* If a system reset is about to be requested, modify the PM1 register so it

View File

@ -29,11 +29,6 @@ uint16_t pm_acpi_pm_evt_blk(void)
return pm_read16(PM_EVT_BLK); return pm_read16(PM_EVT_BLK);
} }
int acpi_get_sleep_type(void)
{
return acpi_sleep_from_pm1(inw(pm_acpi_pm_cnt_blk()));
}
void save_uma_size(uint32_t size) void save_uma_size(uint32_t size)
{ {
biosram_write32(BIOSRAM_UMA_SIZE, size); biosram_write32(BIOSRAM_UMA_SIZE, size);