ACPI S3: Split arch-agnostic parts
Change-Id: I9fc2d1cdbb280f781045882bc4ac98c67946953e Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/42614 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
parent
dc5539fe16
commit
4a3f67a9f2
|
@ -3,6 +3,7 @@
|
|||
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
|
||||
|
@ -15,6 +16,8 @@ ramstage-y += pld.c
|
|||
ramstage-y += sata.c
|
||||
ramstage-y += soundwire.c
|
||||
|
||||
postcar-y += acpi_pm.c
|
||||
|
||||
ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/acpi_tables.c),)
|
||||
ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/acpi_tables.c
|
||||
endif
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <console/console.h>
|
||||
#include <romstage_handoff.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)
|
||||
{
|
||||
}
|
|
@ -158,7 +158,6 @@ endif # CONFIG_ARCH_VERSTAGE_X86_32 / CONFIG_ARCH_VERSTAGE_X86_64
|
|||
|
||||
ifeq ($(CONFIG_ARCH_ROMSTAGE_X86_32)$(CONFIG_ARCH_ROMSTAGE_X86_64),y)
|
||||
|
||||
romstage-$(CONFIG_HAVE_ACPI_RESUME) += acpi_s3.c
|
||||
romstage-y += boot.c
|
||||
romstage-y += post.c
|
||||
# gdt_init.S is included by entry32.inc when romstage is the first C
|
||||
|
@ -202,7 +201,6 @@ $(eval $(call create_class_compiler,postcar,x86_64))
|
|||
endif
|
||||
postcar-generic-ccopts += -D__POSTCAR__
|
||||
|
||||
postcar-$(CONFIG_HAVE_ACPI_RESUME) += acpi_s3.c
|
||||
postcar-y += boot.c
|
||||
postcar-y += post.c
|
||||
postcar-y += gdt_init.S
|
||||
|
|
|
@ -8,33 +8,6 @@
|
|||
#include <cpu/x86/smm.h>
|
||||
#include <fallback.h>
|
||||
#include <timestamp.h>
|
||||
#include <romstage_handoff.h>
|
||||
|
||||
#if ENV_RAMSTAGE || ENV_POSTCAR
|
||||
|
||||
/* This is filled with acpi_is_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_is_wakeup_s3(void)
|
||||
{
|
||||
acpi_handoff_wakeup();
|
||||
return (acpi_slp_type == ACPI_S3);
|
||||
}
|
||||
|
||||
#endif /* ENV_RAMSTAGE */
|
||||
|
||||
#define WAKEUP_BASE 0x600
|
||||
|
||||
|
@ -43,10 +16,6 @@ asmlinkage void (*acpi_do_wakeup)(uintptr_t vector) = (void *)WAKEUP_BASE;
|
|||
extern unsigned char __wakeup;
|
||||
extern unsigned int __wakeup_size;
|
||||
|
||||
void __weak mainboard_suspend_resume(void)
|
||||
{
|
||||
}
|
||||
|
||||
void __noreturn acpi_resume(void *wake_vec)
|
||||
{
|
||||
/* Restore GNVS pointer in SMM if found. */
|
||||
|
|
|
@ -1017,6 +1017,7 @@ unsigned long acpi_create_hest_error_source(acpi_hest_t *hest,
|
|||
void __noreturn acpi_resume(void *wake_vec);
|
||||
void mainboard_suspend_resume(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 */
|
||||
enum {
|
||||
|
@ -1062,20 +1063,16 @@ static inline int acpi_s3_resume_allowed(void)
|
|||
return CONFIG(HAVE_ACPI_RESUME);
|
||||
}
|
||||
|
||||
#if CONFIG(HAVE_ACPI_RESUME)
|
||||
|
||||
#if ENV_ROMSTAGE_OR_BEFORE
|
||||
static inline int acpi_is_wakeup_s3(void)
|
||||
{
|
||||
return (acpi_get_sleep_type() == ACPI_S3);
|
||||
}
|
||||
#else
|
||||
int acpi_is_wakeup_s3(void);
|
||||
#endif
|
||||
if (!acpi_s3_resume_allowed())
|
||||
return 0;
|
||||
|
||||
#else
|
||||
static inline int acpi_is_wakeup_s3(void) { return 0; }
|
||||
#endif
|
||||
if (ENV_ROMSTAGE_OR_BEFORE)
|
||||
return (acpi_get_sleep_type() == ACPI_S3);
|
||||
|
||||
return acpi_handoff_wakeup_s3();
|
||||
}
|
||||
|
||||
static inline uintptr_t acpi_align_current(uintptr_t current)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue