summaryrefslogtreecommitdiff
path: root/src/soc/intel/common/block
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2021-01-22 19:59:07 +0200
committerKyösti Mälkki <kyosti.malkki@gmail.com>2021-01-28 08:47:47 +0000
commitf67e67510b4d165e66e28c5ec60cec356a6497c2 (patch)
tree9207e73674bf2f37cd43b9c1e4dfe1eee97c8975 /src/soc/intel/common/block
parent1476f6992a438ef540c0c1d997d3cd316d3179da (diff)
soc/intel: Refactor fill_acpi_wake()
Change-Id: I7fcc2b36cfe57adf8ae3a6acf8b54e19504202a5 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/49878 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/intel/common/block')
-rw-r--r--src/soc/intel/common/block/acpi/acpi.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/soc/intel/common/block/acpi/acpi.c b/src/soc/intel/common/block/acpi/acpi.c
index cbc6a58a38..e5d3fee33f 100644
--- a/src/soc/intel/common/block/acpi/acpi.c
+++ b/src/soc/intel/common/block/acpi/acpi.c
@@ -202,21 +202,15 @@ uint32_t acpi_fill_soc_wake(uint32_t generic_pm1_en,
* @pm1: PM1_STS register with only enabled events set
* @gpe0: GPE0_STS registers with only enabled events set
*
- * return the number of registers in the gpe0 array or -1 if nothing
- * is provided by this function.
+ * return the number of registers in the gpe0 array
*/
-static int acpi_fill_wake(uint32_t *pm1, uint32_t **gpe0)
+static int acpi_fill_wake(const struct chipset_power_state *ps, uint32_t *pm1, uint32_t **gpe0)
{
- struct chipset_power_state *ps;
static uint32_t gpe0_sts[GPE0_REG_MAX];
uint32_t pm1_en;
int i;
- ps = acpi_get_pm_state();
- if (ps == NULL)
- return -1;
-
/*
* PM1_EN to check the basic wake events which can happen through
* powerbtn or any other wake source like lidopen, key board press etc.
@@ -462,7 +456,11 @@ static void acpi_save_wake_source(void *unused)
gnvs->pm1i = -1;
gnvs->gpei = -1;
- gpe_reg_count = acpi_fill_wake(&pm1, &gpe0);
+ const struct chipset_power_state *ps = acpi_get_pm_state();
+ if (!ps)
+ return;
+
+ gpe_reg_count = acpi_fill_wake(ps, &pm1, &gpe0);
if (gpe_reg_count < 0)
return;