aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel
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 /src/soc/intel
parent10f7f997ad439681b959962682cafc1993677c56 (diff)
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>
Diffstat (limited to 'src/soc/intel')
-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
19 files changed, 50 insertions, 79 deletions
diff --git a/src/soc/intel/alderlake/pmutil.c b/src/soc/intel/alderlake/pmutil.c
index 79088dd781..43d5084356 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 d17d407413..47b68f1489 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 6e96b57a07..1d4a55835e 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 7e92e9037d..b299c37218 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 cc1dd42fc5..7ab61ac7cf 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 1e7cc089a0..0c955e3073 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 7e92e9037d..b299c37218 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 de90cb7b61..f49c760588 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 1d4d773fcd..3f625560dc 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 418e469828..93bc01dda0 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 785283cee2..b2dbfbe6d0 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 65e5f44685..cbc6a58a38 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 09af749073..3b7aa0a169 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 4d5c04d02d..b969ba5200 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 66cc73e46f..263bfa2e34 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 ebe46b1d0e..7a42d771ae 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 99a52d15f1..3545a9425e 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 c9b719fadf..d325a93013 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 f2ff483af1..39fc36b46d 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);
}