From 26307c738537d4491f23c06bf00f7bcf29802223 Mon Sep 17 00:00:00 2001 From: Marshall Dawson Date: Fri, 3 May 2019 13:06:55 -0600 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/32658 Reviewed-by: Furquan Shaikh Tested-by: build bot (Jenkins) --- src/soc/amd/common/block/acpi/acpi.c | 8 ++++++-- src/soc/amd/stoneyridge/sb_util.c | 5 ----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/soc/amd/common/block/acpi/acpi.c b/src/soc/amd/common/block/acpi/acpi.c index 39e03e2c0c..e18933bb81 100644 --- a/src/soc/amd/common/block/acpi/acpi.c +++ b/src/soc/amd/common/block/acpi/acpi.c @@ -132,13 +132,17 @@ void acpi_clear_pm1_status(void) 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) { if (!(acpi_read16(MMIO_ACPI_PM1_STS) & WAK_STS)) return 0; - uint16_t pm_cnt = acpi_read16(MMIO_ACPI_PM1_CNT_BLK); - return acpi_sleep_from_pm1(pm_cnt) == ACPI_S3; + return acpi_get_sleep_type() == ACPI_S3; } /* If a system reset is about to be requested, modify the PM1 register so it diff --git a/src/soc/amd/stoneyridge/sb_util.c b/src/soc/amd/stoneyridge/sb_util.c index 11bf73a723..7869065237 100644 --- a/src/soc/amd/stoneyridge/sb_util.c +++ b/src/soc/amd/stoneyridge/sb_util.c @@ -29,11 +29,6 @@ uint16_t pm_acpi_pm_evt_blk(void) 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) { biosram_write32(BIOSRAM_UMA_SIZE, size); -- cgit v1.2.3