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

[Xen-changelog] [xen-unstable] HVM firmware passthrough ACPI processing


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Fri, 11 Jan 2013 03:33:10 +0000
  • Delivery-date: Fri, 11 Jan 2013 03:33:20 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Ross Philipson <ross.philipson@xxxxxxxxxx>
# Date 1357838323 0
# Node ID b9c38bea15b117552ecb51809779c7cfef82dd44
# Parent  a7ce196f40444fafbe8f13b2d80e4885d4321806
HVM firmware passthrough ACPI processing

ACPI table passthrough support allowing additional static tables and
SSDTs (AML code) to be loaded. These additional tables are added at
the end of the secondary table list in the RSDT/XSDT tables.

Signed-off-by: Ross Philipson <ross.philipson@xxxxxxxxxx>
Committed-by: Keir Fraser <keir@xxxxxxx>
---


diff -r a7ce196f4044 -r b9c38bea15b1 tools/firmware/hvmloader/acpi/build.c
--- a/tools/firmware/hvmloader/acpi/build.c     Thu Jan 10 17:18:10 2013 +0000
+++ b/tools/firmware/hvmloader/acpi/build.c     Thu Jan 10 17:18:43 2013 +0000
@@ -23,6 +23,9 @@
 #include "ssdt_pm.h"
 #include "../config.h"
 #include "../util.h"
+#include <xen/hvm/hvm_xs_strings.h>
+
+#define ACPI_MAX_SECONDARY_TABLES 16
 
 #define align16(sz)        (((sz) + 15) & ~15)
 #define fixed_strcpy(d, s) strncpy((d), (s), sizeof(d))
@@ -198,6 +201,52 @@ static struct acpi_20_waet *construct_wa
     return waet;
 }
 
+static int construct_passthrough_tables(unsigned long *table_ptrs,
+                                        int nr_tables)
+{
+    const char *s;
+    uint8_t *acpi_pt_addr;
+    uint32_t acpi_pt_length;
+    struct acpi_header *header;
+    int nr_added;
+    int nr_max = (ACPI_MAX_SECONDARY_TABLES - nr_tables - 1);
+    uint32_t total = 0;
+    uint8_t *buffer;
+
+    s = xenstore_read(HVM_XS_ACPI_PT_ADDRESS, NULL);
+    if ( s == NULL )
+        return 0;    
+
+    acpi_pt_addr = (uint8_t*)(uint32_t)strtoll(s, NULL, 0);
+    if ( acpi_pt_addr == NULL )
+        return 0;
+
+    s = xenstore_read(HVM_XS_ACPI_PT_LENGTH, NULL);
+    if ( s == NULL )
+        return 0;
+
+    acpi_pt_length = (uint32_t)strtoll(s, NULL, 0);
+
+    for ( nr_added = 0; nr_added < nr_max; nr_added++ )
+    {        
+        if ( (acpi_pt_length - total) < sizeof(struct acpi_header) )
+            break;
+
+        header = (struct acpi_header*)acpi_pt_addr;
+
+        buffer = mem_alloc(header->length, 16);
+        if ( buffer == NULL )
+            break;
+        memcpy(buffer, header, header->length);
+
+        table_ptrs[nr_tables++] = (unsigned long)buffer;
+        total += header->length;
+        acpi_pt_addr += header->length;
+    }
+
+    return nr_added;
+}
+
 static int construct_secondary_tables(unsigned long *table_ptrs,
                                       struct acpi_info *info)
 {
@@ -293,6 +342,9 @@ static int construct_secondary_tables(un
         }
     }
 
+    /* Load any additional tables passed through. */
+    nr_tables += construct_passthrough_tables(table_ptrs, nr_tables);
+
     table_ptrs[nr_tables] = 0;
     return nr_tables;
 }
@@ -327,7 +379,7 @@ void acpi_build_tables(struct acpi_confi
     struct acpi_10_fadt *fadt_10;
     struct acpi_20_facs *facs;
     unsigned char       *dsdt;
-    unsigned long        secondary_tables[16];
+    unsigned long        secondary_tables[ACPI_MAX_SECONDARY_TABLES];
     int                  nr_secondaries, i;
     unsigned long        vm_gid_addr;
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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