xref: /aosp_15_r20/external/coreboot/src/arch/x86/acpi_s3.c (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
4 #include <string.h>
5 #include <acpi/acpi.h>
6 #include <arch/cpu.h>
7 #include <commonlib/helpers.h>
8 #include <fallback.h>
9 #include <timestamp.h>
10 
11 #define WAKEUP_BASE 0x600
12 
13 asmlinkage void (*acpi_do_wakeup)(uintptr_t vector) = (void *)WAKEUP_BASE;
14 
15 extern unsigned char __wakeup;
16 extern unsigned int __wakeup_size;
17 
acpi_resume(void * wake_vec)18 void __noreturn acpi_resume(void *wake_vec)
19 {
20 	/* Call mainboard resume handler first, if defined. */
21 	mainboard_suspend_resume();
22 
23 	/* Copy wakeup trampoline in place. */
24 	memcpy((void *)WAKEUP_BASE, &__wakeup, __wakeup_size);
25 
26 	set_boot_successful();
27 
28 	timestamp_add_now(TS_ACPI_WAKE_JUMP);
29 
30 	post_code(POSTCODE_OS_RESUME);
31 	acpi_do_wakeup((uintptr_t)wake_vec);
32 
33 	die("Failed the jump to wakeup vector\n");
34 }
35