Blob Blame History Raw
From 3abbb783be92edcc07a999d50eac4e7ff5b6c7ba Mon Sep 17 00:00:00 2001
Message-Id: <3abbb783be92edcc07a999d50eac4e7ff5b6c7ba.1387280747.git.minovotn@redhat.com>
In-Reply-To: <c2d55efd8a9a156fe14fd477924fadb765ac9438.1387280747.git.minovotn@redhat.com>
References: <c2d55efd8a9a156fe14fd477924fadb765ac9438.1387280747.git.minovotn@redhat.com>
From: Michal Novotny <minovotn@redhat.com>
Date: Tue, 17 Dec 2013 12:45:03 +0100
Subject: [PATCH 3/3] acpi: load and link tables through romfile loader

Load files through romfile loader and use for acpi tables.
We need the RSDP pointer to hang the rest of the tables off it,
to detect that we simply scan all memory in FSEG.

Add an option to disable this feature (useful for old QEMU versions).
This saves about 1Kbytes.

enabled:
Total size: 134932  Fixed: 61571  Free: 127212 (used 51.5% of 256KiB rom)

disabled:
Total size: 133836  Fixed: 61563  Free: 128308 (used 51.1% of 256KiB rom)

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry-picked from commit 11948748495841bd54721b250d68c7b3cb0475ef)
Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 src/Kconfig | 11 +++++++++++
 src/acpi.c  | 21 +++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/src/Kconfig b/src/Kconfig
index 0b112ed..9fa848c 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -365,6 +365,17 @@ menu "BIOS Tables"
         default y
         help
             Support generation of ACPI tables.
+    config FW_ROMFILE_LOAD
+        bool "Load BIOS tables from ROM files"
+        depends on QEMU
+        default y
+        help
+            Support loading BIOS firmware tables from ROM files.
+            At the moment, only ACPI tables can be loaded in this way.
+            Required for QEMU 1.7 and newer.
+            This option can be disabled for QEMU 1.6 and older
+            to save some space in the ROM file.
+            If unsure, say Y.
 endmenu

 source vgasrc/Kconfig
diff --git a/src/acpi.c b/src/acpi.c
index 6267d7b..c62fa3a 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -14,6 +14,7 @@
 #include "ioport.h" // inl
 #include "paravirt.h" // qemu_cfg_irq0_override
 #include "dev-q35.h" // qemu_cfg_irq0_override
+#include "romfile_loader.h" // romfile_loader_execute
 
 /****************************************************/
 /* ACPI tables init */
@@ -798,6 +799,26 @@ struct rsdp_descriptor *RsdpAddr;
 void
 acpi_bios_init(void)
 {
+    if (CONFIG_FW_ROMFILE_LOAD) {
+        int loader_err;
+
+        dprintf(3, "load ACPI tables\n");
+
+        loader_err = romfile_loader_execute("etc/table-loader");
+
+        RsdpAddr = find_acpi_rsdp();
+
+        if (RsdpAddr)
+            return;
+
+        /* If present, loader should have installed an RSDP.
+         * Not installed? We might still be able to continue
+         * using the builtin RSDP.
+         */
+        if (!loader_err)
+            warn_internalerror();
+    }
+
     if (! CONFIG_ACPI)
         return;
 
-- 
1.7.11.7