qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [seabios PATCH] install the MADT from the "etc/acpi/APIC" fw_cfg file if it's available
@ 2013-04-08 13:14 Laszlo Ersek
  0 siblings, 0 replies; only message in thread
From: Laszlo Ersek @ 2013-04-08 13:14 UTC (permalink / raw)
  To: seabios, qemu-devel


Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 src/acpi.c |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/src/acpi.c b/src/acpi.c
index bc4d8ea..9e128b2 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -393,6 +393,33 @@ build_madt(void)
     return madt;
 }
 
+static void*
+find_table(const char *sig, void *(*buildfn)(void))
+{
+    char buf[] = "etc/acpi/QUUX";
+    struct romfile_s *file;
+
+    snprintf(buf + (sizeof buf - 1 - 4), 4 + 1, "%s", sig);
+    file = romfile_find(buf);
+    if (file != NULL && file->size >= sizeof(struct acpi_table_header)) {
+        void *table;
+
+        table = malloc_high(file->size);
+        if (table == NULL)
+            warn_noalloc();
+        else {
+            if ((*file->copy)(file, table, file->size) == file->size) {
+                dprintf(4, "ACPI %s: using fw_cfg %s\n", sig, buf);
+                return table;
+            }
+            free(table);
+        }
+    }
+
+    dprintf(4, "ACPI %s: building default\n", sig);
+    return (*buildfn)();
+}
+
 // Encode a hex value
 static inline char getHex(u32 val) {
     val &= 0x0f;
@@ -792,7 +819,7 @@ acpi_setup(void)
     struct fadt_descriptor_rev1 *fadt = build_fadt(pci);
     ACPI_INIT_TABLE(fadt);
     ACPI_INIT_TABLE(build_ssdt());
-    ACPI_INIT_TABLE(build_madt());
+    ACPI_INIT_TABLE(find_table("APIC", build_madt));
     ACPI_INIT_TABLE(build_hpet());
     ACPI_INIT_TABLE(build_srat());
     if (pci->device == PCI_DEVICE_ID_INTEL_ICH9_LPC)
-- 
1.7.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-04-08 13:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-08 13:14 [Qemu-devel] [seabios PATCH] install the MADT from the "etc/acpi/APIC" fw_cfg file if it's available Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).