2017-04-21 23:24:37 +09:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2017, Bin Meng <bmeng.cn@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <asm/acpi_s3.h>
|
2017-04-21 23:24:44 +09:00
|
|
|
#include <asm/acpi_table.h>
|
2017-04-21 23:24:37 +09:00
|
|
|
#include <asm/post.h>
|
|
|
|
|
|
|
|
static void asmlinkage (*acpi_do_wakeup)(void *vector) = (void *)WAKEUP_BASE;
|
|
|
|
|
|
|
|
static void acpi_jump_to_wakeup(void *vector)
|
|
|
|
{
|
|
|
|
/* Copy wakeup trampoline in place */
|
|
|
|
memcpy((void *)WAKEUP_BASE, __wakeup, __wakeup_size);
|
|
|
|
|
|
|
|
printf("Jumping to OS waking vector %p\n", vector);
|
|
|
|
acpi_do_wakeup(vector);
|
|
|
|
}
|
|
|
|
|
2017-04-21 23:24:44 +09:00
|
|
|
void acpi_resume(struct acpi_fadt *fadt)
|
2017-04-21 23:24:37 +09:00
|
|
|
{
|
2017-04-21 23:24:44 +09:00
|
|
|
void *wake_vec;
|
|
|
|
|
2017-04-21 23:24:45 +09:00
|
|
|
/* Turn on ACPI mode for S3 */
|
|
|
|
enter_acpi_mode(fadt->pm1a_cnt_blk);
|
|
|
|
|
2017-04-21 23:24:44 +09:00
|
|
|
wake_vec = acpi_find_wakeup_vector(fadt);
|
|
|
|
|
2017-04-21 23:24:37 +09:00
|
|
|
post_code(POST_OS_RESUME);
|
|
|
|
acpi_jump_to_wakeup(wake_vec);
|
|
|
|
}
|