aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-12-01 09:02:51 -0700
committerSimon Glass <sjg@chromium.org>2022-01-25 11:44:36 -0700
commita53d38f80a1b7833a7efad6412fbd0b17cc33a99 (patch)
tree85eff932833cf3db206f243458ef1530d80d427c /lib
parent94ba15a3f13ff5b510d426d13854014bb9cb4713 (diff)
downloadu-boot-a53d38f80a1b7833a7efad6412fbd0b17cc33a99.zip
u-boot-a53d38f80a1b7833a7efad6412fbd0b17cc33a99.tar.gz
u-boot-a53d38f80a1b7833a7efad6412fbd0b17cc33a99.tar.bz2
x86: Move FACS table to a writer function
Move this table over to use a writer function, moving the code from the x86 implementation. Add a pointer to the DSDT in struct acpi_ctx so we can reference it later. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/acpi/Makefile1
-rw-r--r--lib/acpi/facs.c33
2 files changed, 34 insertions, 0 deletions
diff --git a/lib/acpi/Makefile b/lib/acpi/Makefile
index 4674a92..9f70fe6 100644
--- a/lib/acpi/Makefile
+++ b/lib/acpi/Makefile
@@ -10,4 +10,5 @@ obj-y += acpi_writer.o
# With QEMU the ACPI tables come from there, not from U-Boot
ifndef CONFIG_QEMU
obj-y += base.o
+obj-y += facs.o
endif
diff --git a/lib/acpi/facs.c b/lib/acpi/facs.c
new file mode 100644
index 0000000..8a1568f
--- /dev/null
+++ b/lib/acpi/facs.c
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Write an ACPI Firmware ACPI Control Structure (FACS) table
+ *
+ * Copyright 2021 Google LLC
+ */
+
+#include <common.h>
+#include <acpi/acpi_table.h>
+#include <dm/acpi.h>
+
+int acpi_write_facs(struct acpi_ctx *ctx, const struct acpi_writer *entry)
+{
+ struct acpi_facs *facs = ctx->current;
+
+ memset((void *)facs, '\0', sizeof(struct acpi_facs));
+
+ memcpy(facs->signature, "FACS", 4);
+ facs->length = sizeof(struct acpi_facs);
+ facs->hardware_signature = 0;
+ facs->firmware_waking_vector = 0;
+ facs->global_lock = 0;
+ facs->flags = 0;
+ facs->x_firmware_waking_vector_l = 0;
+ facs->x_firmware_waking_vector_h = 0;
+ facs->version = 1;
+
+ ctx->facs = facs;
+ acpi_inc(ctx, sizeof(struct acpi_facs));
+
+ return 0;
+}
+ACPI_WRITER(1facs, "FACS", acpi_write_facs, 0);