aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/x86/lib/acpi_table.c26
-rw-r--r--include/dm/acpi.h2
-rw-r--r--lib/acpi/Makefile1
-rw-r--r--lib/acpi/facs.c33
4 files changed, 38 insertions, 24 deletions
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index e6aa3c5..22f34a4 100644
--- a/arch/x86/lib/acpi_table.c
+++ b/arch/x86/lib/acpi_table.c
@@ -38,21 +38,6 @@ extern const unsigned char AmlCode[];
/* ACPI RSDP address to be used in boot parameters */
static ulong acpi_rsdp_addr;
-static void acpi_create_facs(struct acpi_facs *facs)
-{
- 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;
-}
-
static int acpi_create_madt_lapic(struct acpi_madt_lapic *lapic,
u8 cpu, u8 apic)
{
@@ -507,7 +492,6 @@ static int write_acpi_tables_x86(struct acpi_ctx *ctx,
const struct acpi_writer *entry)
{
const int thl = sizeof(struct acpi_table_header);
- struct acpi_facs *facs;
struct acpi_table_header *dsdt;
struct acpi_fadt *fadt;
struct acpi_table_header *ssdt;
@@ -521,12 +505,6 @@ static int write_acpi_tables_x86(struct acpi_ctx *ctx,
int ret;
int i;
- debug("ACPI: * FACS\n");
- facs = ctx->current;
- acpi_inc_align(ctx, sizeof(struct acpi_facs));
-
- acpi_create_facs(facs);
-
debug("ACPI: * DSDT\n");
dsdt = ctx->current;
@@ -599,7 +577,7 @@ static int write_acpi_tables_x86(struct acpi_ctx *ctx,
debug("ACPI: * FADT\n");
fadt = ctx->current;
acpi_inc_align(ctx, sizeof(struct acpi_fadt));
- acpi_create_fadt(fadt, facs, dsdt);
+ acpi_create_fadt(fadt, ctx->facs, dsdt);
acpi_add_table(ctx, fadt);
debug("ACPI: * SSDT\n");
@@ -666,7 +644,7 @@ static int write_acpi_tables_x86(struct acpi_ctx *ctx,
return 0;
}
-ACPI_WRITER(x86, NULL, write_acpi_tables_x86, 0);
+ACPI_WRITER(2x86, NULL, write_acpi_tables_x86, 0);
ulong acpi_get_rsdp_addr(void)
{
diff --git a/include/dm/acpi.h b/include/dm/acpi.h
index 2021a69..c4baeb6 100644
--- a/include/dm/acpi.h
+++ b/include/dm/acpi.h
@@ -52,6 +52,7 @@ enum acpi_dump_option {
* adding a new table. The RSDP holds pointers to the RSDT and XSDT.
* @rsdt: Pointer to the Root System Description Table
* @xsdt: Pointer to the Extended System Description Table
+ * @facs: Pointer to the Firmware ACPI Control Structure
* @nhlt: Intel Non-High-Definition-Audio Link Table (NHLT) pointer, used to
* build up information that audio codecs need to provide in the NHLT ACPI
* table
@@ -65,6 +66,7 @@ struct acpi_ctx {
struct acpi_rsdp *rsdp;
struct acpi_rsdt *rsdt;
struct acpi_xsdt *xsdt;
+ struct acpi_facs *facs;
struct nhlt *nhlt;
char *len_stack[ACPIGEN_LENSTACK_SIZE];
int ltop;
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);