summaryrefslogtreecommitdiff
path: root/arch/x86/lib/acpi_s3.c
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2017-04-21 17:24:37 +0300
committerBin Meng <bmeng.cn@gmail.com>2017-05-17 12:11:46 +0300
commit3a34cae01160d207d50db267585b963cf0a0018d (patch)
treea6fcaae9a38548e2900bc8e98c0223ff16e20aa9 /arch/x86/lib/acpi_s3.c
parente76bf38f180b0c9325b17506f1518329d82cbed8 (diff)
downloadu-boot-3a34cae01160d207d50db267585b963cf0a0018d.tar.xz
x86: acpi: Resume OS if resume vector is found
In an S3 resume path, U-Boot does everything like a cold boot except in the last_stage_init() it jumps to the OS resume vector. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'arch/x86/lib/acpi_s3.c')
-rw-r--r--arch/x86/lib/acpi_s3.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/x86/lib/acpi_s3.c b/arch/x86/lib/acpi_s3.c
new file mode 100644
index 0000000000..f679c06deb
--- /dev/null
+++ b/arch/x86/lib/acpi_s3.c
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2017, Bin Meng <bmeng.cn@gmail.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/acpi_s3.h>
+#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);
+}
+
+void acpi_resume(void *wake_vec)
+{
+ post_code(POST_OS_RESUME);
+ acpi_jump_to_wakeup(wake_vec);
+}