2020-03-04 15:10:45 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2016-06-18 08:19:18 +02:00
|
|
|
|
|
|
|
#include <console/console.h>
|
|
|
|
#include <string.h>
|
2020-05-02 19:24:23 +02:00
|
|
|
#include <acpi/acpi.h>
|
2018-10-27 09:41:02 +02:00
|
|
|
#include <arch/cpu.h>
|
2019-06-21 07:06:50 +02:00
|
|
|
#include <commonlib/helpers.h>
|
2016-12-11 12:31:17 +01:00
|
|
|
#include <fallback.h>
|
2016-06-18 08:19:18 +02:00
|
|
|
#include <timestamp.h>
|
2016-06-20 19:40:32 +02:00
|
|
|
|
2016-06-18 08:19:18 +02:00
|
|
|
#define WAKEUP_BASE 0x600
|
|
|
|
|
2018-06-03 22:04:28 +02:00
|
|
|
asmlinkage void (*acpi_do_wakeup)(uintptr_t vector) = (void *)WAKEUP_BASE;
|
2016-06-18 08:19:18 +02:00
|
|
|
|
|
|
|
extern unsigned char __wakeup;
|
|
|
|
extern unsigned int __wakeup_size;
|
|
|
|
|
2020-06-18 07:28:12 +02:00
|
|
|
void __noreturn acpi_resume(void *wake_vec)
|
2016-06-18 08:19:18 +02:00
|
|
|
{
|
|
|
|
/* Call mainboard resume handler first, if defined. */
|
|
|
|
mainboard_suspend_resume();
|
|
|
|
|
2020-06-18 11:24:06 +02:00
|
|
|
/* Copy wakeup trampoline in place. */
|
|
|
|
memcpy((void *)WAKEUP_BASE, &__wakeup, __wakeup_size);
|
|
|
|
|
|
|
|
set_boot_successful();
|
|
|
|
|
|
|
|
timestamp_add_now(TS_ACPI_WAKE_JUMP);
|
|
|
|
|
2016-06-18 08:19:18 +02:00
|
|
|
post_code(POST_OS_RESUME);
|
2020-06-18 11:24:06 +02:00
|
|
|
acpi_do_wakeup((uintptr_t)wake_vec);
|
2020-06-18 07:28:12 +02:00
|
|
|
|
|
|
|
die("Failed the jump to wakeup vector\n");
|
2016-06-18 08:19:18 +02:00
|
|
|
}
|