ACPI S3: Replace stashed acpi_slp_typ value
We currently have a mixture of calls used to determine global ACPI S3 state. Reduce the boilerplate, ultimately acpi_wakeup_is_s3() should be the only to keep. Change-Id: Iff950d2bcf7eacbbdd40865abf62c35a2e8c3c69 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/47694 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
540902ca47
commit
ac0dc4a840
|
@ -1,32 +1,8 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <console/console.h>
|
|
||||||
#include <romstage_handoff.h>
|
|
||||||
#include <smbios.h>
|
#include <smbios.h>
|
||||||
|
|
||||||
/* This is filled with acpi_handoff_wakeup_s3() call early in ramstage. */
|
|
||||||
static int acpi_slp_type = -1;
|
|
||||||
|
|
||||||
static void acpi_handoff_wakeup(void)
|
|
||||||
{
|
|
||||||
if (acpi_slp_type < 0) {
|
|
||||||
if (romstage_handoff_is_resume()) {
|
|
||||||
printk(BIOS_DEBUG, "S3 Resume\n");
|
|
||||||
acpi_slp_type = ACPI_S3;
|
|
||||||
} else {
|
|
||||||
printk(BIOS_DEBUG, "Normal boot\n");
|
|
||||||
acpi_slp_type = ACPI_S0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int acpi_handoff_wakeup_s3(void)
|
|
||||||
{
|
|
||||||
acpi_handoff_wakeup();
|
|
||||||
return (acpi_slp_type == ACPI_S3);
|
|
||||||
}
|
|
||||||
|
|
||||||
void __weak mainboard_suspend_resume(void)
|
void __weak mainboard_suspend_resume(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
#include <uuid.h>
|
#include <uuid.h>
|
||||||
#include <cper.h>
|
#include <cper.h>
|
||||||
|
#include <romstage_handoff.h>
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
#define RSDP_SIG "RSD PTR " /* RSDT pointer signature */
|
#define RSDP_SIG "RSD PTR " /* RSDT pointer signature */
|
||||||
|
@ -1078,7 +1079,6 @@ unsigned long acpi_create_lpi_desc_ncst(acpi_lpi_desc_ncst_t *lpi_desc, uint16_t
|
||||||
void __noreturn acpi_resume(void *wake_vec);
|
void __noreturn acpi_resume(void *wake_vec);
|
||||||
void mainboard_suspend_resume(void);
|
void mainboard_suspend_resume(void);
|
||||||
void *acpi_find_wakeup_vector(void);
|
void *acpi_find_wakeup_vector(void);
|
||||||
int acpi_handoff_wakeup_s3(void);
|
|
||||||
|
|
||||||
/* ACPI_Sn assignments are defined to always equal the sleep state numbers */
|
/* ACPI_Sn assignments are defined to always equal the sleep state numbers */
|
||||||
enum {
|
enum {
|
||||||
|
@ -1134,7 +1134,7 @@ static inline int acpi_is_wakeup_s3(void)
|
||||||
if (ENV_ROMSTAGE_OR_BEFORE)
|
if (ENV_ROMSTAGE_OR_BEFORE)
|
||||||
return (acpi_get_sleep_type() == ACPI_S3);
|
return (acpi_get_sleep_type() == ACPI_S3);
|
||||||
|
|
||||||
return acpi_handoff_wakeup_s3();
|
return romstage_handoff_is_resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uintptr_t acpi_align_current(uintptr_t current)
|
static inline uintptr_t acpi_align_current(uintptr_t current)
|
||||||
|
|
|
@ -55,12 +55,23 @@ int romstage_handoff_init(int is_s3_resume)
|
||||||
|
|
||||||
int romstage_handoff_is_resume(void)
|
int romstage_handoff_is_resume(void)
|
||||||
{
|
{
|
||||||
|
static int once, s3_resume;
|
||||||
struct romstage_handoff *handoff;
|
struct romstage_handoff *handoff;
|
||||||
|
|
||||||
handoff = cbmem_find(CBMEM_ID_ROMSTAGE_INFO);
|
if (once)
|
||||||
|
return s3_resume;
|
||||||
|
|
||||||
|
/* Only try evaluate handoff once for s3 resume state. */
|
||||||
|
once = 1;
|
||||||
|
handoff = cbmem_find(CBMEM_ID_ROMSTAGE_INFO);
|
||||||
if (handoff == NULL)
|
if (handoff == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return handoff->s3_resume;
|
s3_resume = handoff->s3_resume;
|
||||||
|
if (s3_resume)
|
||||||
|
printk(BIOS_DEBUG, "S3 Resume\n");
|
||||||
|
else
|
||||||
|
printk(BIOS_DEBUG, "Normal boot\n");
|
||||||
|
|
||||||
|
return s3_resume;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue