[SeaBIOS] [PATCH v7 3/3] acpi: load and link tables through romfile loader

Michael S. Tsirkin mst at redhat.com
Thu Oct 3 15:30:41 CEST 2013


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 at redhat.com>
---
 src/fw/acpi.c | 21 +++++++++++++++++++++
 src/Kconfig   | 11 +++++++++++
 2 files changed, 32 insertions(+)

diff --git a/src/fw/acpi.c b/src/fw/acpi.c
index 0497d9b..c29425c 100644
--- a/src/fw/acpi.c
+++ b/src/fw/acpi.c
@@ -32,6 +32,7 @@
 #include "string.h" // memset
 #include "util.h" // MaxCountCPUs
 #include "x86.h" // readl
+#include "romfile_loader.h" // romfile_loader_execute
 
 #include "src/fw/acpi-dsdt.hex"
 
@@ -610,6 +611,26 @@ struct rsdp_descriptor *RsdpAddr;
 void
 acpi_setup(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;
 
diff --git a/src/Kconfig b/src/Kconfig
index c40cc61..5780885 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -424,6 +424,17 @@ menu "BIOS Tables"
             This option can be disabled for QEMU 1.4 and newer
             to save some space in the ROM file.
             If unsure, say Y.
+    config FW_ROMFILE_LOAD
+        bool "Load BIOS tables from ROM files"
+        depends on QEMU_HARDWARE
+        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
-- 
MST




More information about the SeaBIOS mailing list