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

[Xen-devel] [PATCH v1 05/20] acpi/hvmloader: Move passthrough initialization from ACPI code



Initialize it in hvmloader, avoiding ACPI code's use of xenstore_read()

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
---

Changes in v1:
* Rename acpi_pt_length/addr to pt_length/addr

 tools/firmware/hvmloader/acpi/build.c   |   22 +++++++---------------
 tools/firmware/hvmloader/acpi/libacpi.h |    5 +++++
 tools/firmware/hvmloader/util.c         |   11 +++++++++++
 3 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/tools/firmware/hvmloader/acpi/build.c 
b/tools/firmware/hvmloader/acpi/build.c
index 0bcb185..95f6cf8 100644
--- a/tools/firmware/hvmloader/acpi/build.c
+++ b/tools/firmware/hvmloader/acpi/build.c
@@ -269,10 +269,10 @@ static struct acpi_20_slit *construct_slit(void)
 }
 
 static int construct_passthrough_tables(unsigned long *table_ptrs,
-                                        int nr_tables)
+                                        int nr_tables,
+                                        struct acpi_config *config)
 {
-    const char *s;
-    uint8_t *acpi_pt_addr;
+    unsigned long acpi_pt_addr;
     uint32_t acpi_pt_length;
     struct acpi_header *header;
     int nr_added;
@@ -280,19 +280,11 @@ static int construct_passthrough_tables(unsigned long 
*table_ptrs,
     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 )
+    if ( config->pt.pt_addr == 0 )
         return 0;
 
-    acpi_pt_length = (uint32_t)strtoll(s, NULL, 0);
+    acpi_pt_addr = config->pt.pt_addr;
+    acpi_pt_length = config->pt.pt_length;
 
     for ( nr_added = 0; nr_added < nr_max; nr_added++ )
     {        
@@ -428,7 +420,7 @@ static int construct_secondary_tables(unsigned long 
*table_ptrs,
     }
 
     /* Load any additional tables passed through. */
-    nr_tables += construct_passthrough_tables(table_ptrs, nr_tables);
+    nr_tables += construct_passthrough_tables(table_ptrs, nr_tables, config);
 
     table_ptrs[nr_tables] = 0;
     return nr_tables;
diff --git a/tools/firmware/hvmloader/acpi/libacpi.h 
b/tools/firmware/hvmloader/acpi/libacpi.h
index 5454bc2..05e6c69 100644
--- a/tools/firmware/hvmloader/acpi/libacpi.h
+++ b/tools/firmware/hvmloader/acpi/libacpi.h
@@ -61,6 +61,11 @@ struct acpi_config {
 
     uint32_t table_flags;
 
+    struct {
+        uint32_t pt_addr;
+        uint32_t pt_length;
+    } pt;
+
     /* May have some fields updated by acpi_build_table() */
     struct acpi_info ainfo;
     /*
diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c
index 1ccb38c..1864d7a 100644
--- a/tools/firmware/hvmloader/util.c
+++ b/tools/firmware/hvmloader/util.c
@@ -27,6 +27,7 @@
 #include <xen/xen.h>
 #include <xen/memory.h>
 #include <xen/sched.h>
+#include <xen/hvm/hvm_xs_strings.h>
 #include <xen/hvm/params.h>
 
 /*
@@ -895,6 +896,16 @@ void hvmloader_acpi_build_tables(struct acpi_config 
*config,
             config->vm_gid[1] = strtoll(end+1, NULL, 0);
     }
 
+    s = xenstore_read(HVM_XS_ACPI_PT_ADDRESS, NULL);
+    if ( s )
+    {
+        config->pt.pt_addr = strtoll(s, NULL, 0);
+
+        s = xenstore_read(HVM_XS_ACPI_PT_LENGTH, NULL);
+        if ( s  )
+            config->pt.pt_length = strtoll(s, NULL, 0);
+    }
+
     if ( battery_port_exists() )
         config->table_flags |= ACPI_BUILD_SSDT_PM;
     if ( !strncmp(xenstore_read("platform/acpi_s3", "1"), "1", 1)  )
-- 
1.7.1


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

 


Rackspace

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