diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2021-01-21 16:41:16 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2021-01-25 17:05:43 +0000 |
commit | 08bd2077bf89da9e4d1cd1f42952975a07e3fd36 (patch) | |
tree | 7abeb0e4b4b2716a3c755d3a5e8f80a274d09b20 /src | |
parent | b0db813523ab6de2fa0894d1e2cb979f22a01871 (diff) |
soc/amd/common: Refactor ACPI wake source
Change-Id: I5cb65e131bf2a35c4305ea971812d9799b964c4d
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49837
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/soc/amd/common/block/acpi/pm_state.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/soc/amd/common/block/acpi/pm_state.c b/src/soc/amd/common/block/acpi/pm_state.c index ed97afbcf5..a0097185dc 100644 --- a/src/soc/amd/common/block/acpi/pm_state.c +++ b/src/soc/amd/common/block/acpi/pm_state.c @@ -29,12 +29,9 @@ static int get_index_bit(uint32_t value, uint16_t limit) return i; } -static void pm_fill_gnvs(const struct acpi_pm_gpe_state *state) +static void pm_fill_gnvs(struct global_nvs *gnvs, const struct acpi_pm_gpe_state *state) { int index; - struct global_nvs *gnvs = acpi_get_gnvs(); - if (gnvs == NULL) - return; index = get_index_bit(state->pm1_sts & state->pm1_en, PM1_LIMIT); if (index < 0) @@ -49,15 +46,17 @@ static void pm_fill_gnvs(const struct acpi_pm_gpe_state *state) gnvs->gpei = index; } -static void set_nvs_sws(void *unused) +static void acpi_save_wake_source(void *unused) { - struct chipset_power_state *state; + const struct chipset_power_state *ps; + struct global_nvs *gnvs = acpi_get_gnvs(); + if (!gnvs) + return; - state = acpi_get_pm_state(); - if (state == NULL) + if (acpi_pm_state_for_wake(&ps) < 0) return; - pm_fill_gnvs(&state->gpe_state); + pm_fill_gnvs(gnvs, &ps->gpe_state); } -BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, set_nvs_sws, NULL); +BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, acpi_save_wake_source, NULL); |