WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 5/5] hvmloader: Load DSDT table from parametter

To: Xen Devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 5/5] hvmloader: Load DSDT table from parametter
From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Date: Thu, 27 Oct 2011 16:12:37 +0100
Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Delivery-date: Thu, 27 Oct 2011 08:30:26 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1319728357-18112-1-git-send-email-anthony.perard@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1319728357-18112-1-git-send-email-anthony.perard@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
In order to have two different DSDT tables for rombios and SeaBIOS, this patch
introduce a new parameter to acpi_build_tables() which contain the DSDT table
to load.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
 tools/firmware/hvmloader/acpi/acpi2_0.h |    9 ++++++++-
 tools/firmware/hvmloader/acpi/build.c   |   31 ++++++++++++++-----------------
 tools/firmware/hvmloader/rombios.c      |   12 +++++++++++-
 tools/firmware/hvmloader/seabios.c      |   12 +++++++++++-
 4 files changed, 44 insertions(+), 20 deletions(-)

diff --git a/tools/firmware/hvmloader/acpi/acpi2_0.h 
b/tools/firmware/hvmloader/acpi/acpi2_0.h
index 7fa8f5b..b281ec0 100644
--- a/tools/firmware/hvmloader/acpi/acpi2_0.h
+++ b/tools/firmware/hvmloader/acpi/acpi2_0.h
@@ -391,7 +391,14 @@ struct acpi_20_madt_intsrcovr {
 
 #pragma pack ()
 
-void acpi_build_tables(unsigned int physical);
+struct acpi_config {
+    unsigned char *dsdt_anycpu;
+    int dsdt_anycpu_len;
+    unsigned char *dsdt_15cpu;
+    int dsdt_15cpu_len;
+};
+
+void acpi_build_tables(struct acpi_config *config, unsigned int physical);
 
 #endif /* _ACPI_2_0_H_ */
 
diff --git a/tools/firmware/hvmloader/acpi/build.c 
b/tools/firmware/hvmloader/acpi/build.c
index d8222b1..c902885 100644
--- a/tools/firmware/hvmloader/acpi/build.c
+++ b/tools/firmware/hvmloader/acpi/build.c
@@ -47,17 +47,6 @@ struct acpi_info {
     uint32_t madt_lapic0_addr;  /* 16   - Address of first MADT LAPIC struct */
 };
 
-/*
- * Alternative DSDTs we get linked against. A cover-all DSDT for up to the
- * implementation-defined maximum number of VCPUs, and an alternative for use
- * when a guest can only have up to 15 VCPUs.
- * 
- * The latter is required for Windows 2000, which experiences a BSOD of
- * KMODE_EXCEPTION_NOT_HANDLED if it sees more than 15 processor objects.
- */
-extern unsigned char dsdt_anycpu[], dsdt_15cpu;
-extern int dsdt_anycpu_len, dsdt_15cpu_len;
-
 /* Number of processor objects in the chosen DSDT. */
 static unsigned int nr_processor_objects;
 
@@ -285,7 +274,7 @@ static int construct_secondary_tables(unsigned long 
*table_ptrs,
     return nr_tables;
 }
 
-void acpi_build_tables(unsigned int physical)
+void acpi_build_tables(struct acpi_config *config, unsigned int physical)
 {
     struct acpi_info *acpi_info = (struct acpi_info 
*)ACPI_INFO_PHYSICAL_ADDRESS;
     struct acpi_20_rsdp *rsdp;
@@ -308,18 +297,26 @@ void acpi_build_tables(unsigned int physical)
     if (!facs) goto oom;
     memcpy(facs, &Facs, sizeof(struct acpi_20_facs));
 
-    if ( hvm_info->nr_vcpus <= 15 )
+    /*
+     * Alternative DSDTs we get linked against. A cover-all DSDT for up to the
+     * implementation-defined maximum number of VCPUs, and an alternative for 
use
+     * when a guest can only have up to 15 VCPUs.
+     *
+     * The latter is required for Windows 2000, which experiences a BSOD of
+     * KMODE_EXCEPTION_NOT_HANDLED if it sees more than 15 processor objects.
+     */
+    if ( hvm_info->nr_vcpus <= 15 && config->dsdt_15cpu)
     {
-        dsdt = mem_alloc(dsdt_15cpu_len, 16);
+        dsdt = mem_alloc(config->dsdt_15cpu_len, 16);
         if (!dsdt) goto oom;
-        memcpy(dsdt, &dsdt_15cpu, dsdt_15cpu_len);
+        memcpy(dsdt, config->dsdt_15cpu, config->dsdt_15cpu_len);
         nr_processor_objects = 15;
     }
     else
     {
-        dsdt = mem_alloc(dsdt_anycpu_len, 16);
+        dsdt = mem_alloc(config->dsdt_anycpu_len, 16);
         if (!dsdt) goto oom;
-        memcpy(dsdt, &dsdt_anycpu, dsdt_anycpu_len);
+        memcpy(dsdt, config->dsdt_anycpu, config->dsdt_anycpu_len);
         nr_processor_objects = HVM_MAX_VCPUS;
     }
 
diff --git a/tools/firmware/hvmloader/rombios.c 
b/tools/firmware/hvmloader/rombios.c
index 017bd4c..fa38014 100644
--- a/tools/firmware/hvmloader/rombios.c
+++ b/tools/firmware/hvmloader/rombios.c
@@ -40,6 +40,9 @@
 #define ROMBIOS_MAXOFFSET      0x0000FFFF
 #define ROMBIOS_END            (ROMBIOS_BEGIN + ROMBIOS_SIZE)
 
+extern unsigned char dsdt_anycpu[], dsdt_15cpu[];
+extern int dsdt_anycpu_len, dsdt_15cpu_len;
+
 static void rombios_setup_e820(void)
 {
     /*
@@ -112,7 +115,14 @@ static void reset_bios_checksum(void)
 
 static void rombios_acpi_build_tables(void)
 {
-    acpi_build_tables(ACPI_PHYSICAL_ADDRESS);
+    struct acpi_config config = {
+        .dsdt_anycpu = dsdt_anycpu,
+        .dsdt_anycpu_len = dsdt_anycpu_len,
+        .dsdt_15cpu = dsdt_15cpu,
+        .dsdt_15cpu_len = dsdt_15cpu_len,
+    };
+
+    acpi_build_tables(&config, ACPI_PHYSICAL_ADDRESS);
 }
 
 static void rombios_create_mp_tables(void)
diff --git a/tools/firmware/hvmloader/seabios.c 
b/tools/firmware/hvmloader/seabios.c
index 8f4c0a4..3045157 100644
--- a/tools/firmware/hvmloader/seabios.c
+++ b/tools/firmware/hvmloader/seabios.c
@@ -31,6 +31,9 @@
 #define ROM_INCLUDE_SEABIOS
 #include "roms.inc"
 
+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 */
@@ -91,7 +94,14 @@ static void add_table(uint32_t t)
 static void seabios_acpi_build_tables(void)
 {
     uint32_t rsdp = (uint32_t)scratch_alloc(sizeof(struct acpi_20_rsdp), 0);
-    acpi_build_tables(rsdp);
+    struct acpi_config config = {
+        .dsdt_anycpu = dsdt_anycpu_qemu_xen,
+        .dsdt_anycpu_len = dsdt_anycpu_qemu_xen_len,
+        .dsdt_15cpu = NULL,
+        .dsdt_15cpu_len = 0,
+    };
+
+    acpi_build_tables(&config, rsdp);
     add_table(rsdp);
 }
 
-- 
Anthony PERARD


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel