[SeaBIOS] [PATCH v5 4/4] acpi: load and link tables through romfile loader

Michael S. Tsirkin mst at redhat.com
Wed Sep 25 11:54:47 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 | 29 +++++++++++++++++++++++++++++
 src/Kconfig   | 11 +++++++++++
 2 files changed, 40 insertions(+)

diff --git a/src/fw/acpi.c b/src/fw/acpi.c
index 0497d9b..1a1e23c 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"
 
@@ -606,10 +607,38 @@ static const struct pci_device_id acpi_find_tbl[] = {
 
 struct rsdp_descriptor *RsdpAddr;
 
+/* Look for RSDP signature in FSEG memory */
+static struct rsdp_descriptor *
+acpi_find_rsdp_rom(void)
+{
+    u64 rsdp = cpu_to_le64(RSDP_SIGNATURE);
+    return malloc_find_fseg_pattern(&rsdp, sizeof(rsdp));
+}
+
 #define MAX_ACPI_TABLES 20
 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 = acpi_find_rsdp_rom();
+
+        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