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>
This commit is contained in:
parent
10f7f997ad
commit
2787237dd5
|
@ -3,7 +3,6 @@
|
||||||
ifeq ($(CONFIG_HAVE_ACPI_TABLES),y)
|
ifeq ($(CONFIG_HAVE_ACPI_TABLES),y)
|
||||||
|
|
||||||
ramstage-y += acpi.c
|
ramstage-y += acpi.c
|
||||||
ramstage-y += acpi_pm.c
|
|
||||||
ramstage-y += acpigen.c
|
ramstage-y += acpigen.c
|
||||||
ramstage-y += acpigen_dptf.c
|
ramstage-y += acpigen_dptf.c
|
||||||
ramstage-y += acpigen_dsm.c
|
ramstage-y += acpigen_dsm.c
|
||||||
|
@ -17,7 +16,8 @@ ramstage-y += pld.c
|
||||||
ramstage-y += sata.c
|
ramstage-y += sata.c
|
||||||
ramstage-y += soundwire.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),)
|
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/acpi_tables.c),)
|
||||||
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/acpi_tables.c
|
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/acpi_tables.c
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
|
#include <acpi/acpi_pm.h>
|
||||||
|
#include <cbmem.h>
|
||||||
|
#include <console/console.h>
|
||||||
#include <smbios.h>
|
#include <smbios.h>
|
||||||
|
|
||||||
void __weak mainboard_suspend_resume(void)
|
void __weak mainboard_suspend_resume(void)
|
||||||
|
@ -24,3 +27,43 @@ uint8_t acpi_get_preferred_pm_profile(void)
|
||||||
return PM_UNSPECIFIED;
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -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
|
|
@ -1,8 +1,8 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
|
||||||
#include <acpi/acpi_gnvs.h>
|
#include <acpi/acpi_gnvs.h>
|
||||||
|
#include <acpi/acpi_pm.h>
|
||||||
#include <bootstate.h>
|
#include <bootstate.h>
|
||||||
#include <cbmem.h>
|
|
||||||
#include <soc/acpi.h>
|
#include <soc/acpi.h>
|
||||||
#include <soc/nvs.h>
|
#include <soc/nvs.h>
|
||||||
#include <soc/southbridge.h>
|
#include <soc/southbridge.h>
|
||||||
|
@ -53,7 +53,7 @@ static void set_nvs_sws(void *unused)
|
||||||
{
|
{
|
||||||
struct chipset_power_state *state;
|
struct chipset_power_state *state;
|
||||||
|
|
||||||
state = cbmem_find(CBMEM_ID_POWER_STATE);
|
state = acpi_get_pm_state();
|
||||||
if (state == NULL)
|
if (state == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
|
||||||
|
#include <acpi/acpi_gnvs.h>
|
||||||
|
#include <acpi/acpi_pm.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <device/mmio.h>
|
#include <device/mmio.h>
|
||||||
#include <bootstate.h>
|
#include <bootstate.h>
|
||||||
|
@ -9,8 +11,6 @@
|
||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
#include <device/pci.h>
|
#include <device/pci.h>
|
||||||
#include <device/pci_ops.h>
|
#include <device/pci_ops.h>
|
||||||
#include <cbmem.h>
|
|
||||||
#include <acpi/acpi_gnvs.h>
|
|
||||||
#include <amdblocks/amd_pci_util.h>
|
#include <amdblocks/amd_pci_util.h>
|
||||||
#include <amdblocks/reset.h>
|
#include <amdblocks/reset.h>
|
||||||
#include <amdblocks/acpimmio.h>
|
#include <amdblocks/acpimmio.h>
|
||||||
|
@ -210,7 +210,7 @@ void southbridge_init(void *chip_info)
|
||||||
i2c_soc_init();
|
i2c_soc_init();
|
||||||
sb_init_acpi_ports();
|
sb_init_acpi_ports();
|
||||||
|
|
||||||
state = cbmem_find(CBMEM_ID_POWER_STATE);
|
state = acpi_get_pm_state();
|
||||||
if (state) {
|
if (state) {
|
||||||
acpi_pm_gpe_add_events_print_events(&state->gpe_state);
|
acpi_pm_gpe_add_events_print_events(&state->gpe_state);
|
||||||
gpio_add_events(&state->gpio_state);
|
gpio_add_events(&state->gpio_state);
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
|
|
||||||
#define __SIMPLE_DEVICE__
|
#define __SIMPLE_DEVICE__
|
||||||
|
|
||||||
|
#include <acpi/acpi_pm.h>
|
||||||
#include <device/mmio.h>
|
#include <device/mmio.h>
|
||||||
#include <cbmem.h>
|
|
||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
#include <device/pci.h>
|
#include <device/pci.h>
|
||||||
#include <device/pci_def.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)
|
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) {
|
if (acpi_pm_state_for_rtc(&ps) < 0)
|
||||||
printk(BIOS_ERR, "Could not find power state in cbmem, RTC init aborted\n");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
|
|
||||||
return rtc_failed(ps->gen_pmcon_b);
|
return rtc_failed(ps->gen_pmcon_b);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
|
||||||
#include <cbmem.h>
|
#include <acpi/acpi_pm.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <device/pci_type.h>
|
#include <device/pci_type.h>
|
||||||
#include <elog.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)
|
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) {
|
if (acpi_pm_state_for_elog(&ps) < 0)
|
||||||
printk(BIOS_ERR,
|
|
||||||
"Not logging power state information. "
|
|
||||||
"Power state not found in cbmem.\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* Power and Reset */
|
/* Power and Reset */
|
||||||
pch_log_power_and_resets(ps);
|
pch_log_power_and_resets(ps);
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
#define __SIMPLE_DEVICE__
|
#define __SIMPLE_DEVICE__
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
|
#include <acpi/acpi_pm.h>
|
||||||
#include <arch/io.h>
|
#include <arch/io.h>
|
||||||
#include <device/mmio.h>
|
#include <device/mmio.h>
|
||||||
#include <cbmem.h>
|
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <cpu/x86/msr.h>
|
#include <cpu/x86/msr.h>
|
||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
|
@ -185,12 +185,10 @@ static int rtc_failed(uint32_t gen_pmcon1)
|
||||||
|
|
||||||
int soc_get_rtc_failed(void)
|
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) {
|
if (acpi_pm_state_for_rtc(&ps) < 0)
|
||||||
printk(BIOS_ERR, "Could not find power state in cbmem, RTC init aborted\n");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
|
|
||||||
return rtc_failed(ps->gen_pmcon1);
|
return rtc_failed(ps->gen_pmcon1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <cbmem.h>
|
#include <acpi/acpi_pm.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
#include <device/pci.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)
|
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) {
|
if (acpi_pm_state_for_elog(&ps) < 0)
|
||||||
printk(BIOS_DEBUG,
|
|
||||||
"Not logging power state information. Power state not found in cbmem.\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
log_power_and_resets(ps);
|
log_power_and_resets(ps);
|
||||||
log_wake_events(ps);
|
log_wake_events(ps);
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
|
#include <acpi/acpi_pm.h>
|
||||||
#include <arch/io.h>
|
#include <arch/io.h>
|
||||||
#include <bootmode.h>
|
#include <bootmode.h>
|
||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
#include <device/mmio.h>
|
#include <device/mmio.h>
|
||||||
#include <device/pci.h>
|
#include <device/pci.h>
|
||||||
#include <device/pci_ops.h>
|
#include <device/pci_ops.h>
|
||||||
#include <cbmem.h>
|
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
|
|
||||||
#include <soc/iomap.h>
|
#include <soc/iomap.h>
|
||||||
|
@ -349,7 +349,7 @@ int rtc_failure(void)
|
||||||
{
|
{
|
||||||
uint32_t gen_pmcon1;
|
uint32_t gen_pmcon1;
|
||||||
int rtc_fail;
|
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)
|
if (ps != NULL)
|
||||||
gen_pmcon1 = ps->gen_pmcon1;
|
gen_pmcon1 = ps->gen_pmcon1;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <arch/cpu.h>
|
#include <arch/cpu.h>
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acpi_gnvs.h>
|
#include <acpi/acpi_gnvs.h>
|
||||||
#include <cbmem.h>
|
#include <acpi/acpi_pm.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <cpu/intel/microcode.h>
|
#include <cpu/intel/microcode.h>
|
||||||
#include <cpu/x86/cr.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 */
|
/* Save bit index for first enabled event in PM1_STS for \_SB._SWS */
|
||||||
static void save_acpi_wake_source(void)
|
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();
|
struct global_nvs *gnvs = acpi_get_gnvs();
|
||||||
uint16_t pm1;
|
uint16_t pm1;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <cbmem.h>
|
#include <acpi/acpi_pm.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
#include <device/pci.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)
|
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) {
|
if (acpi_pm_state_for_elog(&ps) < 0)
|
||||||
printk(BIOS_DEBUG,
|
|
||||||
"Not logging power state information. Power state not found in cbmem.\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
log_power_and_resets(ps);
|
log_power_and_resets(ps);
|
||||||
log_wake_events(ps);
|
log_wake_events(ps);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <arch/cpu.h>
|
#include <arch/cpu.h>
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <cbmem.h>
|
#include <acpi/acpi_pm.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <cpu/intel/microcode.h>
|
#include <cpu/intel/microcode.h>
|
||||||
#include <cpu/x86/cr.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 */
|
/* Save wake source information for calculating ACPI _SWS values */
|
||||||
int soc_fill_acpi_wake(uint32_t *pm1, uint32_t **gpe0)
|
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;
|
static uint32_t gpe0_sts;
|
||||||
|
|
||||||
if (!ps)
|
if (!ps)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
|
||||||
|
#include <acpi/acpi_pm.h>
|
||||||
#include <bootstate.h>
|
#include <bootstate.h>
|
||||||
#include <cbmem.h>
|
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <elog.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)
|
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) {
|
if (acpi_pm_state_for_elog(&ps) < 0)
|
||||||
printk(BIOS_ERR, "Not logging power state information. "
|
|
||||||
"Power state not found in cbmem.\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* Power and Reset */
|
/* Power and Reset */
|
||||||
pch_log_power_and_resets(ps);
|
pch_log_power_and_resets(ps);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acpi_gnvs.h>
|
#include <acpi/acpi_gnvs.h>
|
||||||
#include <cbmem.h>
|
#include <acpi/acpi_pm.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
/* Save bit index for PM1_STS and GPE_STS for ACPI _SWS */
|
/* Save bit index for PM1_STS and GPE_STS for ACPI _SWS */
|
||||||
static void save_acpi_wake_source(void)
|
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();
|
struct global_nvs *gnvs = acpi_get_gnvs();
|
||||||
uint16_t pm1;
|
uint16_t pm1;
|
||||||
int gpe_reg;
|
int gpe_reg;
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
#define __SIMPLE_DEVICE__
|
#define __SIMPLE_DEVICE__
|
||||||
|
|
||||||
|
#include <acpi/acpi_pm.h>
|
||||||
#include <device/mmio.h>
|
#include <device/mmio.h>
|
||||||
#include <cbmem.h>
|
|
||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
#include <device/pci.h>
|
#include <device/pci.h>
|
||||||
#include <device/pci_def.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)
|
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) {
|
if (acpi_pm_state_for_rtc(&ps) < 0)
|
||||||
printk(BIOS_ERR, "Could not find power state in cbmem, RTC init aborted\n");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
|
|
||||||
return rtc_failed(ps->gen_pmcon_b);
|
return rtc_failed(ps->gen_pmcon_b);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||||
|
|
||||||
#include <acpi/acpi_gnvs.h>
|
#include <acpi/acpi_gnvs.h>
|
||||||
|
#include <acpi/acpi_pm.h>
|
||||||
#include <acpi/acpigen.h>
|
#include <acpi/acpigen.h>
|
||||||
#include <arch/cpu.h>
|
#include <arch/cpu.h>
|
||||||
#include <arch/ioapic.h>
|
#include <arch/ioapic.h>
|
||||||
#include <arch/smp/mpspec.h>
|
#include <arch/smp/mpspec.h>
|
||||||
#include <bootstate.h>
|
#include <bootstate.h>
|
||||||
#include <cbmem.h>
|
|
||||||
#include <cf9_reset.h>
|
#include <cf9_reset.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <cpu/intel/turbo.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;
|
uint32_t pm1_en;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ps = cbmem_find(CBMEM_ID_POWER_STATE);
|
ps = acpi_get_pm_state();
|
||||||
if (ps == NULL)
|
if (ps == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
|
||||||
|
#include <acpi/acpi_pm.h>
|
||||||
#include <arch/io.h>
|
#include <arch/io.h>
|
||||||
#include <bootmode.h>
|
#include <bootmode.h>
|
||||||
#include <device/mmio.h>
|
#include <device/mmio.h>
|
||||||
|
@ -56,7 +57,7 @@ struct chipset_power_state *pmc_get_power_state(void)
|
||||||
struct chipset_power_state *ptr = NULL;
|
struct chipset_power_state *ptr = NULL;
|
||||||
|
|
||||||
if (cbmem_possibly_online())
|
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 */
|
/* cbmem is online but ptr is not populated yet */
|
||||||
if (ptr == NULL && !(ENV_RAMSTAGE || ENV_POSTCAR))
|
if (ptr == NULL && !(ENV_RAMSTAGE || ENV_POSTCAR))
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#define __SIMPLE_DEVICE__
|
#define __SIMPLE_DEVICE__
|
||||||
|
|
||||||
#include <cbmem.h>
|
#include <acpi/acpi_pm.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
#include <device/mmio.h>
|
#include <device/mmio.h>
|
||||||
|
@ -180,12 +180,10 @@ static int rtc_failed(uint32_t gen_pmcon_b)
|
||||||
|
|
||||||
int soc_get_rtc_failed(void)
|
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) {
|
if (acpi_pm_state_for_rtc(&ps) < 0)
|
||||||
printk(BIOS_ERR, "Could not find power state in cbmem, RTC init aborted\n");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
|
|
||||||
return rtc_failed(ps->gen_pmcon_b);
|
return rtc_failed(ps->gen_pmcon_b);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
#define __SIMPLE_DEVICE__
|
#define __SIMPLE_DEVICE__
|
||||||
|
|
||||||
|
#include <acpi/acpi_pm.h>
|
||||||
#include <device/mmio.h>
|
#include <device/mmio.h>
|
||||||
#include <cbmem.h>
|
|
||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
#include <device/pci.h>
|
#include <device/pci.h>
|
||||||
#include <device/pci_def.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)
|
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) {
|
if (acpi_pm_state_for_rtc(&ps) < 0)
|
||||||
printk(BIOS_ERR, "Could not find power state in cbmem, RTC init aborted\n");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
|
|
||||||
return rtc_failed(ps->gen_pmcon_b);
|
return rtc_failed(ps->gen_pmcon_b);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
#define __SIMPLE_DEVICE__
|
#define __SIMPLE_DEVICE__
|
||||||
|
|
||||||
|
#include <acpi/acpi_pm.h>
|
||||||
#include <device/mmio.h>
|
#include <device/mmio.h>
|
||||||
#include <cbmem.h>
|
|
||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
#include <device/pci.h>
|
#include <device/pci.h>
|
||||||
#include <device/pci_def.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)
|
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) {
|
if (acpi_pm_state_for_rtc(&ps) < 0)
|
||||||
printk(BIOS_ERR, "Could not find power state in cbmem, RTC init aborted\n");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
|
|
||||||
return rtc_failed(ps->gen_pmcon_b);
|
return rtc_failed(ps->gen_pmcon_b);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acpi_gnvs.h>
|
#include <acpi/acpi_gnvs.h>
|
||||||
|
#include <acpi/acpi_pm.h>
|
||||||
#include <acpi/acpigen.h>
|
#include <acpi/acpigen.h>
|
||||||
#include <arch/cpu.h>
|
#include <arch/cpu.h>
|
||||||
#include <arch/ioapic.h>
|
#include <arch/ioapic.h>
|
||||||
#include <arch/smp/mpspec.h>
|
#include <arch/smp/mpspec.h>
|
||||||
#include <cbmem.h>
|
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <cpu/x86/smm.h>
|
#include <cpu/x86/smm.h>
|
||||||
#include <cpu/x86/msr.h>
|
#include <cpu/x86/msr.h>
|
||||||
|
@ -530,7 +530,7 @@ int soc_fill_acpi_wake(uint32_t *pm1, uint32_t **gpe0)
|
||||||
int i;
|
int i;
|
||||||
const int last_index = GPE0_REG_MAX - 1;
|
const int last_index = GPE0_REG_MAX - 1;
|
||||||
|
|
||||||
ps = cbmem_find(CBMEM_ID_POWER_STATE);
|
ps = acpi_get_pm_state();
|
||||||
if (ps == NULL)
|
if (ps == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
|
||||||
|
#include <acpi/acpi_pm.h>
|
||||||
#include <bootstate.h>
|
#include <bootstate.h>
|
||||||
#include <cbmem.h>
|
|
||||||
#include <commonlib/helpers.h>
|
#include <commonlib/helpers.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <device/mmio.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)
|
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) {
|
if (acpi_pm_state_for_elog(&ps) < 0)
|
||||||
printk(BIOS_ERR,
|
|
||||||
"Not logging power state information. Power state not found in cbmem.\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* Power and Reset */
|
/* Power and Reset */
|
||||||
pch_log_power_and_resets(ps);
|
pch_log_power_and_resets(ps);
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
|
|
||||||
#define __SIMPLE_DEVICE__
|
#define __SIMPLE_DEVICE__
|
||||||
|
|
||||||
|
#include <acpi/acpi_pm.h>
|
||||||
#include <device/mmio.h>
|
#include <device/mmio.h>
|
||||||
#include <cbmem.h>
|
|
||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
#include <device/pci.h>
|
#include <device/pci.h>
|
||||||
#include <device/pci_def.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)
|
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) {
|
if (acpi_pm_state_for_rtc(&ps) < 0)
|
||||||
printk(BIOS_ERR, "Could not find power state in cbmem, RTC init aborted\n");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
|
|
||||||
return rtc_failed(ps->gen_pmcon_b);
|
return rtc_failed(ps->gen_pmcon_b);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue