aboutsummaryrefslogtreecommitdiff
path: root/src/soc/amd/common/block/acpi/acpi.c
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2020-08-14 14:48:45 -0600
committerAaron Durbin <adurbin@chromium.org>2020-08-17 17:39:54 +0000
commit746e598d07091b574036bbcb2d358fa0ebe5f875 (patch)
tree83d1730d183700bd2f31c1d571fce82cb8065602 /src/soc/amd/common/block/acpi/acpi.c
parentac8e1062cb33b25ab075a706625fe7cab4ebe304 (diff)
soc/amd/common: add single function ACPI PM1 GPE helpers
The existing code in common/block/acpi is mixing multiple operations: saving things to cbmem in common code but then soc code uses that information, reliant upon soc-specific struct soc_power_reg object, and only saving/snapshotting ACPI registers very deep in ramstage. To unwind the above provide some functions that are more targeted: - Add struct acpi_pm_gpe_state object - Add acpi_fill_pm_gpe_state() - Add acpi_pm_gpe_add_events_print_events() - Add acpi_clear_pm_gpe_status() BUG=b:159947207 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Change-Id: Ia7afed2861343802b3c78728784f7cfaf6f53f62 Reviewed-on: https://review.coreboot.org/c/coreboot/+/44481 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/soc/amd/common/block/acpi/acpi.c')
-rw-r--r--src/soc/amd/common/block/acpi/acpi.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/soc/amd/common/block/acpi/acpi.c b/src/soc/amd/common/block/acpi/acpi.c
index 2be9b9e25e..be331e3fea 100644
--- a/src/soc/amd/common/block/acpi/acpi.c
+++ b/src/soc/amd/common/block/acpi/acpi.c
@@ -91,6 +91,28 @@ static void log_pm1_status(uint16_t pm1_sts)
elog_add_event_wake(ELOG_WAKE_SOURCE_PCIE, 0);
}
+void acpi_fill_pm_gpe_state(struct acpi_pm_gpe_state *state)
+{
+ state->pm1_sts = acpi_read16(MMIO_ACPI_PM1_STS);
+ state->pm1_en = acpi_read16(MMIO_ACPI_PM1_EN);
+ state->gpe0_sts = acpi_read32(MMIO_ACPI_GPE0_STS);
+ state->gpe0_en = acpi_read32(MMIO_ACPI_GPE0_EN);
+ state->previous_sx_state = acpi_get_sleep_type();
+ state->aligning_field = 0;
+}
+
+void acpi_pm_gpe_add_events_print_events(const struct acpi_pm_gpe_state *state)
+{
+ log_pm1_status(state->pm1_sts);
+ print_pm1_status(state->pm1_sts);
+}
+
+void acpi_clear_pm_gpe_status(void)
+{
+ acpi_write16(MMIO_ACPI_PM1_STS, acpi_read16(MMIO_ACPI_PM1_STS));
+ acpi_write32(MMIO_ACPI_GPE0_STS, acpi_read32(MMIO_ACPI_GPE0_STS));
+}
+
static void save_sws(uint16_t pm1_status)
{
struct soc_power_reg *sws;