]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
x86: Move acpi_get_rsdp_addr() ACPI tables to the writer
authorSimon Glass <sjg@chromium.org>
Wed, 1 Dec 2021 16:03:03 +0000 (09:03 -0700)
committerSimon Glass <sjg@chromium.org>
Tue, 25 Jan 2022 18:44:36 +0000 (11:44 -0700)
Move this over to use a writer file, moving the code from the x86
implementation.

There is no need to store a separate variable since we can simply access
the ACPI context.

With this, the original monolithic x86 function for writing ACPI tables
is gone.

Note that QEMU has its own implementation.

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/x86/lib/acpi_table.c
lib/acpi/acpi_writer.c

index 8275c36ad3159a34082f1e055d6090364c6a158b..c0534343f1f8ec2d8dd7a6a75aaedeb8bed8ac6c 100644 (file)
@@ -29,9 +29,6 @@
 #include <dm/acpi.h>
 #include <linux/err.h>
 
-/* ACPI RSDP address to be used in boot parameters */
-static ulong acpi_rsdp_addr;
-
 static int acpi_create_madt_lapic(struct acpi_madt_lapic *lapic,
                                  u8 cpu, u8 apic)
 {
@@ -513,24 +510,6 @@ int acpi_write_mcfg(struct acpi_ctx *ctx, const struct acpi_writer *entry)
 }
 ACPI_WRITER(5mcfg, "MCFG", acpi_write_mcfg, 0);
 
-/*
- * QEMU's version of write_acpi_tables is defined in drivers/misc/qfw.c
- */
-int write_acpi_tables_x86(struct acpi_ctx *ctx,
-                         const struct acpi_writer *entry)
-{
-       acpi_rsdp_addr = (unsigned long)ctx->rsdp;
-       debug("ACPI: done\n");
-
-       return 0;
-}
-ACPI_WRITER(9x86, NULL, write_acpi_tables_x86, 0);
-
-ulong acpi_get_rsdp_addr(void)
-{
-       return acpi_rsdp_addr;
-}
-
 /**
  * acpi_write_hpet() - Write out a HPET table
  *
index 59f951cba45ccd7144550ecb56d6995d9f2d2ea9..9b0aa23fd78f5433504f7e76ec698c85a84ec097 100644 (file)
@@ -102,6 +102,14 @@ int write_dev_tables(struct acpi_ctx *ctx, const struct acpi_writer *entry)
        return 0;
 }
 ACPI_WRITER(8dev, NULL, write_dev_tables, 0);
+
+ulong acpi_get_rsdp_addr(void)
+{
+       if (!gd->acpi_ctx)
+               return 0;
+
+       return map_to_sysmem(gd->acpi_ctx->rsdp);
+}
 #endif /* QEMU */
 
 void acpi_setup_ctx(struct acpi_ctx *ctx, ulong start)