summaryrefslogtreecommitdiff
path: root/arch/x86/lib
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2017-04-21 07:24:44 -0700
committerBin Meng <bmeng.cn@gmail.com>2017-05-17 17:11:46 +0800
commit0f4e25887dfb3b54b21430340c511f7fd54bc955 (patch)
treecd9f590e8e6a7f075f0c223a23d9467a4b6d3551 /arch/x86/lib
parent995727850f8e54547bb26285ef9e2aa73a5c71a5 (diff)
x86: acpi: Refactor acpi_resume()
To do something more in acpi_resume() like turning on ACPI mode, we need locate ACPI FADT table pointer first. But currently this is done in acpi_find_wakeup_vector(). This changes acpi_resume() signature to accept ACPI FADT pointer as the parameter. A new API acpi_find_fadt() is introduced, and acpi_find_wakeup_vector() is updated to use FADT pointer as the parameter as well. 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')
-rw-r--r--arch/x86/lib/acpi_s3.c7
-rw-r--r--arch/x86/lib/acpi_table.c16
2 files changed, 17 insertions, 6 deletions
diff --git a/arch/x86/lib/acpi_s3.c b/arch/x86/lib/acpi_s3.c
index f679c06deb..e5cc3b0766 100644
--- a/arch/x86/lib/acpi_s3.c
+++ b/arch/x86/lib/acpi_s3.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <asm/acpi_s3.h>
+#include <asm/acpi_table.h>
#include <asm/post.h>
static void asmlinkage (*acpi_do_wakeup)(void *vector) = (void *)WAKEUP_BASE;
@@ -19,8 +20,12 @@ static void acpi_jump_to_wakeup(void *vector)
acpi_do_wakeup(vector);
}
-void acpi_resume(void *wake_vec)
+void acpi_resume(struct acpi_fadt *fadt)
{
+ void *wake_vec;
+
+ wake_vec = acpi_find_wakeup_vector(fadt);
+
post_code(POST_OS_RESUME);
acpi_jump_to_wakeup(wake_vec);
}
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index 87a71ca492..01d5b6fff0 100644
--- a/arch/x86/lib/acpi_table.c
+++ b/arch/x86/lib/acpi_table.c
@@ -460,18 +460,14 @@ static struct acpi_rsdp *acpi_valid_rsdp(struct acpi_rsdp *rsdp)
return rsdp;
}
-void *acpi_find_wakeup_vector(void)
+struct acpi_fadt *acpi_find_fadt(void)
{
char *p, *end;
struct acpi_rsdp *rsdp = NULL;
struct acpi_rsdt *rsdt;
struct acpi_fadt *fadt = NULL;
- struct acpi_facs *facs;
- void *wake_vec;
int i;
- debug("Trying to find the wakeup vector...\n");
-
/* Find RSDP */
for (p = (char *)ROM_TABLE_ADDR; p < (char *)ROM_TABLE_END; p += 16) {
rsdp = acpi_valid_rsdp((struct acpi_rsdp *)p);
@@ -499,6 +495,16 @@ void *acpi_find_wakeup_vector(void)
return NULL;
debug("FADT found at %p\n", fadt);
+ return fadt;
+}
+
+void *acpi_find_wakeup_vector(struct acpi_fadt *fadt)
+{
+ struct acpi_facs *facs;
+ void *wake_vec;
+
+ debug("Trying to find the wakeup vector...\n");
+
facs = (struct acpi_facs *)fadt->firmware_ctrl;
if (facs == NULL) {