summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2021-01-21 16:05:26 +0200
committerFelix Held <felix-coreboot@felixheld.de>2021-01-23 20:31:09 +0000
commit2787237dd52550b5d7e1dc3dabcf380126ff804c (patch)
tree33cbe7d7d77d20fa4c142c8af7a5ffb82d78cd56
parent10f7f997ad439681b959962682cafc1993677c56 (diff)
downloadcoreboot-2787237dd52550b5d7e1dc3dabcf380126ff804c.tar.gz
coreboot-2787237dd52550b5d7e1dc3dabcf380126ff804c.tar.bz2
coreboot-2787237dd52550b5d7e1dc3dabcf380126ff804c.zip
ACPI: Add helpers for CBMEM_ID_POWER_STATE
Create uniform logging for the (unlikely) case of a CBMEM entry disappearing. Change-Id: I7c5414a03d869423c8ae5192a990fde5f9582f2d Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/49817 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
-rw-r--r--src/acpi/Makefile.inc4
-rw-r--r--src/acpi/acpi_pm.c43
-rw-r--r--src/include/acpi/acpi_pm.h12
-rw-r--r--src/soc/amd/common/block/acpi/pm_state.c4
-rw-r--r--src/soc/amd/picasso/fch.c6
-rw-r--r--src/soc/intel/alderlake/pmutil.c8
-rw-r--r--src/soc/intel/apollolake/elog.c10
-rw-r--r--src/soc/intel/apollolake/pmutil.c8
-rw-r--r--src/soc/intel/baytrail/elog.c9
-rw-r--r--src/soc/intel/baytrail/pmutil.c4
-rw-r--r--src/soc/intel/baytrail/ramstage.c4
-rw-r--r--src/soc/intel/braswell/elog.c9
-rw-r--r--src/soc/intel/braswell/ramstage.c4
-rw-r--r--src/soc/intel/broadwell/pch/elog.c9
-rw-r--r--src/soc/intel/broadwell/ramstage.c4
-rw-r--r--src/soc/intel/cannonlake/pmutil.c8
-rw-r--r--src/soc/intel/common/block/acpi/acpi.c4
-rw-r--r--src/soc/intel/common/block/pmc/pmclib.c3
-rw-r--r--src/soc/intel/elkhartlake/pmutil.c8
-rw-r--r--src/soc/intel/icelake/pmutil.c8
-rw-r--r--src/soc/intel/jasperlake/pmutil.c8
-rw-r--r--src/soc/intel/skylake/acpi.c4
-rw-r--r--src/soc/intel/skylake/elog.c9
-rw-r--r--src/soc/intel/tigerlake/pmutil.c8
24 files changed, 112 insertions, 86 deletions
diff --git a/src/acpi/Makefile.inc b/src/acpi/Makefile.inc
index 1cd837dd884a..4d8f3ad89264 100644
--- a/src/acpi/Makefile.inc
+++ b/src/acpi/Makefile.inc
@@ -3,7 +3,6 @@
ifeq ($(CONFIG_HAVE_ACPI_TABLES),y)
ramstage-y += acpi.c
-ramstage-y += acpi_pm.c
ramstage-y += acpigen.c
ramstage-y += acpigen_dptf.c
ramstage-y += acpigen_dsm.c
@@ -17,7 +16,8 @@ ramstage-y += pld.c
ramstage-y += sata.c
ramstage-y += soundwire.c
-postcar-y += acpi_pm.c
+all-y += acpi_pm.c
+smm-y += acpi_pm.c
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/acpi_tables.c),)
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/acpi_tables.c
diff --git a/src/acpi/acpi_pm.c b/src/acpi/acpi_pm.c
index c1e99962a921..bee5616e57db 100644
--- a/src/acpi/acpi_pm.c
+++ b/src/acpi/acpi_pm.c
@@ -1,6 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi.h>
+#include <acpi/acpi_pm.h>
+#include <cbmem.h>
+#include <console/console.h>
#include <smbios.h>
void __weak mainboard_suspend_resume(void)
@@ -24,3 +27,43 @@ uint8_t acpi_get_preferred_pm_profile(void)
return PM_UNSPECIFIED;
}
}
+
+struct chipset_power_state *acpi_get_pm_state(void)
+{
+ static struct chipset_power_state *acpi_pm_state;
+ if (acpi_pm_state)
+ return acpi_pm_state;
+
+ acpi_pm_state = cbmem_find(CBMEM_ID_POWER_STATE);
+ return acpi_pm_state;
+}
+
+int acpi_pm_state_for_elog(const struct chipset_power_state **ps)
+{
+ *ps = acpi_get_pm_state();
+ if (!*ps) {
+ printk(BIOS_ERR, "No CBMEM_ID_POWER_STATE entry, no event recorded in ELOG.\n");
+ return -1;
+ }
+ return 0;
+}
+
+int acpi_pm_state_for_rtc(const struct chipset_power_state **ps)
+{
+ *ps = acpi_get_pm_state();
+ if (!*ps) {
+ printk(BIOS_ERR, "No CBMEM_ID_POWER_STATE entry, RTC init aborted.\n");
+ return -1;
+ }
+ return 0;
+}
+
+int acpi_pm_state_for_wake(const struct chipset_power_state **ps)
+{
+ *ps = acpi_get_pm_state();
+ if (!*ps) {
+ printk(BIOS_ERR, "No CBMEM_ID_POWER_STATE entry, wake source unknown.\n");
+ return -1;
+ }
+ return 0;
+}
diff --git a/src/include/acpi/acpi_pm.h b/src/include/acpi/acpi_pm.h
new file mode 100644
index 000000000000..48342a3ac870
--- /dev/null
+++ b/src/include/acpi/acpi_pm.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef ACPI_PM_H
+#define ACPI_PM_H
+
+struct chipset_power_state;
+struct chipset_power_state *acpi_get_pm_state(void);
+int acpi_pm_state_for_elog(const struct chipset_power_state **ps);
+int acpi_pm_state_for_rtc(const struct chipset_power_state **ps);
+int acpi_pm_state_for_wake(const struct chipset_power_state **ps);
+
+#endif
diff --git a/src/soc/amd/common/block/acpi/pm_state.c b/src/soc/amd/common/block/acpi/pm_state.c
index 1a1c9b218b9b..ed97afbcf55b 100644
--- a/src/soc/amd/common/block/acpi/pm_state.c
+++ b/src/soc/amd/common/block/acpi/pm_state.c
@@ -1,8 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi_gnvs.h>
+#include <acpi/acpi_pm.h>
#include <bootstate.h>
-#include <cbmem.h>
#include <soc/acpi.h>
#include <soc/nvs.h>
#include <soc/southbridge.h>
@@ -53,7 +53,7 @@ static void set_nvs_sws(void *unused)
{
struct chipset_power_state *state;
- state = cbmem_find(CBMEM_ID_POWER_STATE);
+ state = acpi_get_pm_state();
if (state == NULL)
return;
diff --git a/src/soc/amd/picasso/fch.c b/src/soc/amd/picasso/fch.c
index 730e636e57da..d9a18e1cd2b0 100644
--- a/src/soc/amd/picasso/fch.c
+++ b/src/soc/amd/picasso/fch.c
@@ -1,5 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+#include <acpi/acpi_gnvs.h>
+#include <acpi/acpi_pm.h>
#include <console/console.h>
#include <device/mmio.h>
#include <bootstate.h>
@@ -9,8 +11,6 @@
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ops.h>
-#include <cbmem.h>
-#include <acpi/acpi_gnvs.h>
#include <amdblocks/amd_pci_util.h>
#include <amdblocks/reset.h>
#include <amdblocks/acpimmio.h>
@@ -210,7 +210,7 @@ void southbridge_init(void *chip_info)
i2c_soc_init();
sb_init_acpi_ports();
- state = cbmem_find(CBMEM_ID_POWER_STATE);
+ state = acpi_get_pm_state();
if (state) {
acpi_pm_gpe_add_events_print_events(&state->gpe_state);
gpio_add_events(&state->gpio_state);
diff --git a/src/soc/intel/alderlake/pmutil.c b/src/soc/intel/alderlake/pmutil.c
index 79088dd78114..43d5084356b9 100644
--- a/src/soc/intel/alderlake/pmutil.c
+++ b/src/soc/intel/alderlake/pmutil.c
@@ -13,8 +13,8 @@
#define __SIMPLE_DEVICE__
+#include <acpi/acpi_pm.h>
#include <device/mmio.h>
-#include <cbmem.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_def.h>
@@ -187,12 +187,10 @@ static int rtc_failed(uint32_t gen_pmcon_b)
int soc_get_rtc_failed(void)
{
- const struct chipset_power_state *ps = cbmem_find(CBMEM_ID_POWER_STATE);
+ const struct chipset_power_state *ps;
- if (!ps) {
- printk(BIOS_ERR, "Could not find power state in cbmem, RTC init aborted\n");
+ if (acpi_pm_state_for_rtc(&ps) < 0)
return 1;
- }
return rtc_failed(ps->gen_pmcon_b);
}
diff --git a/src/soc/intel/apollolake/elog.c b/src/soc/intel/apollolake/elog.c
index d17d40741321..47b68f1489e4 100644
--- a/src/soc/intel/apollolake/elog.c
+++ b/src/soc/intel/apollolake/elog.c
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
-#include <cbmem.h>
+#include <acpi/acpi_pm.h>
#include <console/console.h>
#include <device/pci_type.h>
#include <elog.h>
@@ -88,14 +88,10 @@ static void pch_log_power_and_resets(const struct chipset_power_state *ps)
void pch_log_state(void)
{
- struct chipset_power_state *ps = cbmem_find(CBMEM_ID_POWER_STATE);
+ const struct chipset_power_state *ps;
- if (ps == NULL) {
- printk(BIOS_ERR,
- "Not logging power state information. "
- "Power state not found in cbmem.\n");
+ if (acpi_pm_state_for_elog(&ps) < 0)
return;
- }
/* Power and Reset */
pch_log_power_and_resets(ps);
diff --git a/src/soc/intel/apollolake/pmutil.c b/src/soc/intel/apollolake/pmutil.c
index 6e96b57a072e..1d4a55835eed 100644
--- a/src/soc/intel/apollolake/pmutil.c
+++ b/src/soc/intel/apollolake/pmutil.c
@@ -3,9 +3,9 @@
#define __SIMPLE_DEVICE__
#include <acpi/acpi.h>
+#include <acpi/acpi_pm.h>
#include <arch/io.h>
#include <device/mmio.h>
-#include <cbmem.h>
#include <console/console.h>
#include <cpu/x86/msr.h>
#include <device/device.h>
@@ -185,12 +185,10 @@ static int rtc_failed(uint32_t gen_pmcon1)
int soc_get_rtc_failed(void)
{
- const struct chipset_power_state *ps = cbmem_find(CBMEM_ID_POWER_STATE);
+ const struct chipset_power_state *ps;
- if (!ps) {
- printk(BIOS_ERR, "Could not find power state in cbmem, RTC init aborted\n");
+ if (acpi_pm_state_for_rtc(&ps) < 0)
return 1;
- }
return rtc_failed(ps->gen_pmcon1);
}
diff --git a/src/soc/intel/baytrail/elog.c b/src/soc/intel/baytrail/elog.c
index 7e92e9037d7a..b299c3721858 100644
--- a/src/soc/intel/baytrail/elog.c
+++ b/src/soc/intel/baytrail/elog.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi.h>
-#include <cbmem.h>
+#include <acpi/acpi_pm.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
@@ -76,13 +76,10 @@ static void log_wake_events(const struct chipset_power_state *ps)
void southcluster_log_state(void)
{
- struct chipset_power_state *ps = cbmem_find(CBMEM_ID_POWER_STATE);
+ const struct chipset_power_state *ps;
- if (ps == NULL) {
- printk(BIOS_DEBUG,
- "Not logging power state information. Power state not found in cbmem.\n");
+ if (acpi_pm_state_for_elog(&ps) < 0)
return;
- }
log_power_and_resets(ps);
log_wake_events(ps);
diff --git a/src/soc/intel/baytrail/pmutil.c b/src/soc/intel/baytrail/pmutil.c
index cc1dd42fc5f0..7ab61ac7cf20 100644
--- a/src/soc/intel/baytrail/pmutil.c
+++ b/src/soc/intel/baytrail/pmutil.c
@@ -2,13 +2,13 @@
#include <stdint.h>
#include <acpi/acpi.h>
+#include <acpi/acpi_pm.h>
#include <arch/io.h>
#include <bootmode.h>
#include <device/device.h>
#include <device/mmio.h>
#include <device/pci.h>
#include <device/pci_ops.h>
-#include <cbmem.h>
#include <console/console.h>
#include <soc/iomap.h>
@@ -349,7 +349,7 @@ int rtc_failure(void)
{
uint32_t gen_pmcon1;
int rtc_fail;
- struct chipset_power_state *ps = cbmem_find(CBMEM_ID_POWER_STATE);
+ struct chipset_power_state *ps = acpi_get_pm_state();
if (ps != NULL)
gen_pmcon1 = ps->gen_pmcon1;
diff --git a/src/soc/intel/baytrail/ramstage.c b/src/soc/intel/baytrail/ramstage.c
index 1e7cc089a08d..0c955e307350 100644
--- a/src/soc/intel/baytrail/ramstage.c
+++ b/src/soc/intel/baytrail/ramstage.c
@@ -3,7 +3,7 @@
#include <arch/cpu.h>
#include <acpi/acpi.h>
#include <acpi/acpi_gnvs.h>
-#include <cbmem.h>
+#include <acpi/acpi_pm.h>
#include <console/console.h>
#include <cpu/intel/microcode.h>
#include <cpu/x86/cr.h>
@@ -119,7 +119,7 @@ static void fill_in_pattrs(void)
/* Save bit index for first enabled event in PM1_STS for \_SB._SWS */
static void save_acpi_wake_source(void)
{
- struct chipset_power_state *ps = cbmem_find(CBMEM_ID_POWER_STATE);
+ struct chipset_power_state *ps = acpi_get_pm_state();
struct global_nvs *gnvs = acpi_get_gnvs();
uint16_t pm1;
diff --git a/src/soc/intel/braswell/elog.c b/src/soc/intel/braswell/elog.c
index 7e92e9037d7a..b299c3721858 100644
--- a/src/soc/intel/braswell/elog.c
+++ b/src/soc/intel/braswell/elog.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi.h>
-#include <cbmem.h>
+#include <acpi/acpi_pm.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
@@ -76,13 +76,10 @@ static void log_wake_events(const struct chipset_power_state *ps)
void southcluster_log_state(void)
{
- struct chipset_power_state *ps = cbmem_find(CBMEM_ID_POWER_STATE);
+ const struct chipset_power_state *ps;
- if (ps == NULL) {
- printk(BIOS_DEBUG,
- "Not logging power state information. Power state not found in cbmem.\n");
+ if (acpi_pm_state_for_elog(&ps) < 0)
return;
- }
log_power_and_resets(ps);
log_wake_events(ps);
diff --git a/src/soc/intel/braswell/ramstage.c b/src/soc/intel/braswell/ramstage.c
index de90cb7b610a..f49c760588eb 100644
--- a/src/soc/intel/braswell/ramstage.c
+++ b/src/soc/intel/braswell/ramstage.c
@@ -2,7 +2,7 @@
#include <arch/cpu.h>
#include <acpi/acpi.h>
-#include <cbmem.h>
+#include <acpi/acpi_pm.h>
#include <console/console.h>
#include <cpu/intel/microcode.h>
#include <cpu/x86/cr.h>
@@ -122,7 +122,7 @@ static void fill_in_pattrs(void)
/* Save wake source information for calculating ACPI _SWS values */
int soc_fill_acpi_wake(uint32_t *pm1, uint32_t **gpe0)
{
- struct chipset_power_state *ps = cbmem_find(CBMEM_ID_POWER_STATE);
+ struct chipset_power_state *ps = acpi_get_pm_state();
static uint32_t gpe0_sts;
if (!ps)
diff --git a/src/soc/intel/broadwell/pch/elog.c b/src/soc/intel/broadwell/pch/elog.c
index 1d4d773fcd5c..3f625560dc06 100644
--- a/src/soc/intel/broadwell/pch/elog.c
+++ b/src/soc/intel/broadwell/pch/elog.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+#include <acpi/acpi_pm.h>
#include <bootstate.h>
-#include <cbmem.h>
#include <console/console.h>
#include <stdint.h>
#include <elog.h>
@@ -106,13 +106,10 @@ static void pch_log_power_and_resets(const struct chipset_power_state *ps)
static void pch_log_state(void *unused)
{
- struct chipset_power_state *ps = cbmem_find(CBMEM_ID_POWER_STATE);
+ const struct chipset_power_state *ps;
- if (ps == NULL) {
- printk(BIOS_ERR, "Not logging power state information. "
- "Power state not found in cbmem.\n");
+ if (acpi_pm_state_for_elog(&ps) < 0)
return;
- }
/* Power and Reset */
pch_log_power_and_resets(ps);
diff --git a/src/soc/intel/broadwell/ramstage.c b/src/soc/intel/broadwell/ramstage.c
index 418e469828e3..93bc01dda08b 100644
--- a/src/soc/intel/broadwell/ramstage.c
+++ b/src/soc/intel/broadwell/ramstage.c
@@ -2,7 +2,7 @@
#include <acpi/acpi.h>
#include <acpi/acpi_gnvs.h>
-#include <cbmem.h>
+#include <acpi/acpi_pm.h>
#include <console/console.h>
#include <device/device.h>
#include <string.h>
@@ -14,7 +14,7 @@
/* Save bit index for PM1_STS and GPE_STS for ACPI _SWS */
static void save_acpi_wake_source(void)
{
- struct chipset_power_state *ps = cbmem_find(CBMEM_ID_POWER_STATE);
+ struct chipset_power_state *ps = acpi_get_pm_state();
struct global_nvs *gnvs = acpi_get_gnvs();
uint16_t pm1;
int gpe_reg;
diff --git a/src/soc/intel/cannonlake/pmutil.c b/src/soc/intel/cannonlake/pmutil.c
index 785283cee258..b2dbfbe6d023 100644
--- a/src/soc/intel/cannonlake/pmutil.c
+++ b/src/soc/intel/cannonlake/pmutil.c
@@ -7,8 +7,8 @@
#define __SIMPLE_DEVICE__
+#include <acpi/acpi_pm.h>
#include <device/mmio.h>
-#include <cbmem.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_def.h>
@@ -180,12 +180,10 @@ static int rtc_failed(uint32_t gen_pmcon_b)
int soc_get_rtc_failed(void)
{
- const struct chipset_power_state *ps = cbmem_find(CBMEM_ID_POWER_STATE);
+ const struct chipset_power_state *ps;
- if (!ps) {
- printk(BIOS_ERR, "Could not find power state in cbmem, RTC init aborted\n");
+ if (acpi_pm_state_for_rtc(&ps) < 0)
return 1;
- }
return rtc_failed(ps->gen_pmcon_b);
}
diff --git a/src/soc/intel/common/block/acpi/acpi.c b/src/soc/intel/common/block/acpi/acpi.c
index 65e5f44685b9..cbc6a58a38ad 100644
--- a/src/soc/intel/common/block/acpi/acpi.c
+++ b/src/soc/intel/common/block/acpi/acpi.c
@@ -1,12 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <acpi/acpi_gnvs.h>
+#include <acpi/acpi_pm.h>
#include <acpi/acpigen.h>
#include <arch/cpu.h>
#include <arch/ioapic.h>
#include <arch/smp/mpspec.h>
#include <bootstate.h>
-#include <cbmem.h>
#include <cf9_reset.h>
#include <console/console.h>
#include <cpu/intel/turbo.h>
@@ -213,7 +213,7 @@ static int acpi_fill_wake(uint32_t *pm1, uint32_t **gpe0)
uint32_t pm1_en;
int i;
- ps = cbmem_find(CBMEM_ID_POWER_STATE);
+ ps = acpi_get_pm_state();
if (ps == NULL)
return -1;
diff --git a/src/soc/intel/common/block/pmc/pmclib.c b/src/soc/intel/common/block/pmc/pmclib.c
index 09af749073b1..3b7aa0a1693e 100644
--- a/src/soc/intel/common/block/pmc/pmclib.c
+++ b/src/soc/intel/common/block/pmc/pmclib.c
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+#include <acpi/acpi_pm.h>
#include <arch/io.h>
#include <bootmode.h>
#include <device/mmio.h>
@@ -56,7 +57,7 @@ struct chipset_power_state *pmc_get_power_state(void)
struct chipset_power_state *ptr = NULL;
if (cbmem_possibly_online())
- ptr = cbmem_find(CBMEM_ID_POWER_STATE);
+ ptr = acpi_get_pm_state();
/* cbmem is online but ptr is not populated yet */
if (ptr == NULL && !(ENV_RAMSTAGE || ENV_POSTCAR))
diff --git a/src/soc/intel/elkhartlake/pmutil.c b/src/soc/intel/elkhartlake/pmutil.c
index 4d5c04d02d3a..b969ba5200b4 100644
--- a/src/soc/intel/elkhartlake/pmutil.c
+++ b/src/soc/intel/elkhartlake/pmutil.c
@@ -7,7 +7,7 @@
#define __SIMPLE_DEVICE__
-#include <cbmem.h>
+#include <acpi/acpi_pm.h>
#include <console/console.h>
#include <device/device.h>
#include <device/mmio.h>
@@ -180,12 +180,10 @@ static int rtc_failed(uint32_t gen_pmcon_b)
int soc_get_rtc_failed(void)
{
- const struct chipset_power_state *ps = cbmem_find(CBMEM_ID_POWER_STATE);
+ const struct chipset_power_state *ps;
- if (!ps) {
- printk(BIOS_ERR, "Could not find power state in cbmem, RTC init aborted\n");
+ if (acpi_pm_state_for_rtc(&ps) < 0)
return 1;
- }
return rtc_failed(ps->gen_pmcon_b);
}
diff --git a/src/soc/intel/icelake/pmutil.c b/src/soc/intel/icelake/pmutil.c
index 66cc73e46f99..263bfa2e341e 100644
--- a/src/soc/intel/icelake/pmutil.c
+++ b/src/soc/intel/icelake/pmutil.c
@@ -7,8 +7,8 @@
#define __SIMPLE_DEVICE__
+#include <acpi/acpi_pm.h>
#include <device/mmio.h>
-#include <cbmem.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_def.h>
@@ -180,12 +180,10 @@ static int rtc_failed(uint32_t gen_pmcon_b)
int soc_get_rtc_failed(void)
{
- const struct chipset_power_state *ps = cbmem_find(CBMEM_ID_POWER_STATE);
+ const struct chipset_power_state *ps;
- if (!ps) {
- printk(BIOS_ERR, "Could not find power state in cbmem, RTC init aborted\n");
+ if (acpi_pm_state_for_rtc(&ps) < 0)
return 1;
- }
return rtc_failed(ps->gen_pmcon_b);
}
diff --git a/src/soc/intel/jasperlake/pmutil.c b/src/soc/intel/jasperlake/pmutil.c
index ebe46b1d0e6d..7a42d771ae78 100644
--- a/src/soc/intel/jasperlake/pmutil.c
+++ b/src/soc/intel/jasperlake/pmutil.c
@@ -7,8 +7,8 @@
#define __SIMPLE_DEVICE__
+#include <acpi/acpi_pm.h>
#include <device/mmio.h>
-#include <cbmem.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_def.h>
@@ -180,12 +180,10 @@ static int rtc_failed(uint32_t gen_pmcon_b)
int soc_get_rtc_failed(void)
{
- const struct chipset_power_state *ps = cbmem_find(CBMEM_ID_POWER_STATE);
+ const struct chipset_power_state *ps;
- if (!ps) {
- printk(BIOS_ERR, "Could not find power state in cbmem, RTC init aborted\n");
+ if (acpi_pm_state_for_rtc(&ps) < 0)
return 1;
- }
return rtc_failed(ps->gen_pmcon_b);
}
diff --git a/src/soc/intel/skylake/acpi.c b/src/soc/intel/skylake/acpi.c
index 99a52d15f17b..3545a9425ed5 100644
--- a/src/soc/intel/skylake/acpi.c
+++ b/src/soc/intel/skylake/acpi.c
@@ -2,11 +2,11 @@
#include <acpi/acpi.h>
#include <acpi/acpi_gnvs.h>
+#include <acpi/acpi_pm.h>
#include <acpi/acpigen.h>
#include <arch/cpu.h>
#include <arch/ioapic.h>
#include <arch/smp/mpspec.h>
-#include <cbmem.h>
#include <console/console.h>
#include <cpu/x86/smm.h>
#include <cpu/x86/msr.h>
@@ -530,7 +530,7 @@ int soc_fill_acpi_wake(uint32_t *pm1, uint32_t **gpe0)
int i;
const int last_index = GPE0_REG_MAX - 1;
- ps = cbmem_find(CBMEM_ID_POWER_STATE);
+ ps = acpi_get_pm_state();
if (ps == NULL)
return -1;
diff --git a/src/soc/intel/skylake/elog.c b/src/soc/intel/skylake/elog.c
index c9b719fadf5f..d325a9301344 100644
--- a/src/soc/intel/skylake/elog.c
+++ b/src/soc/intel/skylake/elog.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+#include <acpi/acpi_pm.h>
#include <bootstate.h>
-#include <cbmem.h>
#include <commonlib/helpers.h>
#include <console/console.h>
#include <device/mmio.h>
@@ -231,13 +231,10 @@ static void pch_log_power_and_resets(const struct chipset_power_state *ps)
static void pch_log_state(void *unused)
{
- struct chipset_power_state *ps = cbmem_find(CBMEM_ID_POWER_STATE);
+ const struct chipset_power_state *ps;
- if (ps == NULL) {
- printk(BIOS_ERR,
- "Not logging power state information. Power state not found in cbmem.\n");
+ if (acpi_pm_state_for_elog(&ps) < 0)
return;
- }
/* Power and Reset */
pch_log_power_and_resets(ps);
diff --git a/src/soc/intel/tigerlake/pmutil.c b/src/soc/intel/tigerlake/pmutil.c
index f2ff483af170..39fc36b46d1a 100644
--- a/src/soc/intel/tigerlake/pmutil.c
+++ b/src/soc/intel/tigerlake/pmutil.c
@@ -13,8 +13,8 @@
#define __SIMPLE_DEVICE__
+#include <acpi/acpi_pm.h>
#include <device/mmio.h>
-#include <cbmem.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_def.h>
@@ -186,12 +186,10 @@ static int rtc_failed(uint32_t gen_pmcon_b)
int soc_get_rtc_failed(void)
{
- const struct chipset_power_state *ps = cbmem_find(CBMEM_ID_POWER_STATE);
+ const struct chipset_power_state *ps;
- if (!ps) {
- printk(BIOS_ERR, "Could not find power state in cbmem, RTC init aborted\n");
+ if (acpi_pm_state_for_rtc(&ps) < 0)
return 1;
- }
return rtc_failed(ps->gen_pmcon_b);
}