[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v3 13/16] hvmloader: Load ACPI tables from hvm_start_info module



... and use it with both SeaBIOS and OVMF.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>

---
Changes in V3:
- handle rombios
---
 tools/firmware/hvmloader/config.h    |  2 +-
 tools/firmware/hvmloader/hvmloader.c | 20 +++++++++++++++++++-
 tools/firmware/hvmloader/ovmf.c      |  9 +++------
 tools/firmware/hvmloader/rombios.c   |  3 ++-
 tools/firmware/hvmloader/seabios.c   |  9 +++------
 5 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/tools/firmware/hvmloader/config.h 
b/tools/firmware/hvmloader/config.h
index 4c6d8ad..2c39637 100644
--- a/tools/firmware/hvmloader/config.h
+++ b/tools/firmware/hvmloader/config.h
@@ -29,7 +29,7 @@ struct bios_config {
 
     void (*e820_setup)(void);
 
-    void (*acpi_build_tables)(void);
+    void (*acpi_build_tables)(void* addr, uint32_t size);
     void (*create_mp_tables)(void);
     void (*create_smbios_tables)(void);
     void (*create_pir_tables)(void);
diff --git a/tools/firmware/hvmloader/hvmloader.c 
b/tools/firmware/hvmloader/hvmloader.c
index cc52302..e7b0139 100644
--- a/tools/firmware/hvmloader/hvmloader.c
+++ b/tools/firmware/hvmloader/hvmloader.c
@@ -365,8 +365,26 @@ int main(void)
 
         if ( bios->acpi_build_tables )
         {
+            const struct hvm_modlist_entry *acpi_module;
+            acpi_module = get_module_entry(hvm_start_info, "acpi");
             printf("Loading ACPI ...\n");
-            bios->acpi_build_tables();
+            if ( acpi_module )
+            {
+                uint32_t paddr = acpi_module->paddr;
+                bios->acpi_build_tables((void*)paddr,
+                                        acpi_module->size);
+            }
+#ifdef ENABLE_ROMBIOS
+            else if ( bios == &rombios_config )
+            {
+                bios->acpi_build_tables(0, 0);
+            }
+#endif
+            else
+            {
+                printf("no ACPI DSDT image found\n");
+                BUG();
+            }
         }
 
         acpi_enable_sci();
diff --git a/tools/firmware/hvmloader/ovmf.c b/tools/firmware/hvmloader/ovmf.c
index 89a005e..c1612ea 100644
--- a/tools/firmware/hvmloader/ovmf.c
+++ b/tools/firmware/hvmloader/ovmf.c
@@ -40,9 +40,6 @@
 #define LOWCHUNK_MAXOFFSET      0x0000FFFF
 #define OVMF_INFO_PHYSICAL_ADDRESS 0x00001000
 
-extern unsigned char dsdt_anycpu_qemu_xen[];
-extern int dsdt_anycpu_qemu_xen_len;
-
 #define OVMF_INFO_MAX_TABLES 4
 struct ovmf_info {
     char signature[14]; /* XenHVMOVMF\0\0\0\0 */
@@ -114,11 +111,11 @@ static void ovmf_load(const struct bios_config *config,
     memcpy((void *) ovmf_config.bios_address, bios_addr, bios_length);
 }
 
-static void ovmf_acpi_build_tables(void)
+static void ovmf_acpi_build_tables(void *addr, uint32_t length)
 {
     struct acpi_config config = {
-        .dsdt_anycpu = dsdt_anycpu_qemu_xen,
-        .dsdt_anycpu_len = dsdt_anycpu_qemu_xen_len,
+        .dsdt_anycpu = addr,
+        .dsdt_anycpu_len = length,
         .dsdt_15cpu = NULL, 
         .dsdt_15cpu_len = 0
     };
diff --git a/tools/firmware/hvmloader/rombios.c 
b/tools/firmware/hvmloader/rombios.c
index 2ded844..732a7ff 100644
--- a/tools/firmware/hvmloader/rombios.c
+++ b/tools/firmware/hvmloader/rombios.c
@@ -172,7 +172,8 @@ static void reset_bios_checksum(void)
     *((uint8_t *)(ROMBIOS_BEGIN + ROMBIOS_MAXOFFSET)) = -checksum;
 }
 
-static void rombios_acpi_build_tables(void)
+static void rombios_acpi_build_tables(void *unused_addr,
+                                      uint32_t unused_size)
 {
     struct acpi_config config = {
         .dsdt_anycpu = dsdt_anycpu,
diff --git a/tools/firmware/hvmloader/seabios.c 
b/tools/firmware/hvmloader/seabios.c
index 5d896e3..b55a7c9 100644
--- a/tools/firmware/hvmloader/seabios.c
+++ b/tools/firmware/hvmloader/seabios.c
@@ -27,9 +27,6 @@
 #include "smbios_types.h"
 #include "acpi/acpi2_0.h"
 
-extern unsigned char dsdt_anycpu_qemu_xen[];
-extern int dsdt_anycpu_qemu_xen_len;
-
 struct seabios_info {
     char signature[14]; /* XenHVMSeaBIOS\0 */
     uint8_t length;     /* Length of this struct */
@@ -87,12 +84,12 @@ static void add_table(uint32_t t)
     info->tables_nr++;
 }
 
-static void seabios_acpi_build_tables(void)
+static void seabios_acpi_build_tables(void *addr, uint32_t length)
 {
     uint32_t rsdp = (uint32_t)scratch_alloc(sizeof(struct acpi_20_rsdp), 0);
     struct acpi_config config = {
-        .dsdt_anycpu = dsdt_anycpu_qemu_xen,
-        .dsdt_anycpu_len = dsdt_anycpu_qemu_xen_len,
+        .dsdt_anycpu = addr,
+        .dsdt_anycpu_len = length,
         .dsdt_15cpu = NULL,
         .dsdt_15cpu_len = 0,
     };
-- 
Anthony PERARD


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.