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

Michael S. Tsirkin mst at redhat.com
Sun Sep 22 15:17:26 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.

Signed-off-by: Michael S. Tsirkin <mst at redhat.com>
---
 src/acpi.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/src/acpi.c b/src/acpi.c
index f305fa3..8ec7d8d 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -27,6 +27,7 @@
 #include "config.h" // CONFIG_*
 #include "paravirt.h" // RamSize
 #include "dev-q35.h"
+#include "romfile_loader.h"
 
 #include "acpi-dsdt.hex"
 
@@ -599,15 +600,40 @@ static const struct pci_device_id acpi_find_tbl[] = {
 
 struct rsdp_descriptor *RsdpAddr;
 
+/* Look for RSDP signature in FSEG memory */
+struct rsdp_descriptor *
+acpi_find_rsdp_rom(void)
+{
+    u64 rsdp = cpu_to_le64(RSDP_SIGNATURE);
+    return pmm_find_fseg_pattern(&rsdp, sizeof(rsdp));
+}
+
 #define MAX_ACPI_TABLES 20
 void
 acpi_setup(void)
 {
+    int loader_err;
     if (! CONFIG_ACPI)
         return;
 
     dprintf(3, "init 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();
+
+    dprintf(3, "generate ACPI tables\n");
+
     // This code is hardcoded for PIIX4 Power Management device.
     struct pci_device *pci = pci_find_init_device(acpi_find_tbl, NULL);
     if (!pci)
-- 
MST




More information about the SeaBIOS mailing list