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

[Xen-changelog] [xen master] hvmloader: decide which SSDTs to install in hvmloader



commit 653d8fb95adc81dc2fbc3594bd63519f68271dc2
Author:     Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
AuthorDate: Tue Aug 9 17:30:56 2016 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Aug 9 17:30:56 2016 +0200

    hvmloader: decide which SSDTs to install in hvmloader
    
    With that, xenstore_read() won't need to be done in ACPI code
    
    Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 tools/firmware/hvmloader/acpi/build.c   | 15 ++++++---------
 tools/firmware/hvmloader/acpi/libacpi.h |  4 ++++
 tools/firmware/hvmloader/util.c         | 12 ++++++++++++
 3 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/tools/firmware/hvmloader/acpi/build.c 
b/tools/firmware/hvmloader/acpi/build.c
index daa9248..e5a63bc 100644
--- a/tools/firmware/hvmloader/acpi/build.c
+++ b/tools/firmware/hvmloader/acpi/build.c
@@ -72,11 +72,6 @@ static void set_checksum(
     p[checksum_offset] = -sum;
 }
 
-static uint8_t battery_port_exists(void)
-{
-    return (inb(0x88) == 0x1F);
-}
-
 static struct acpi_20_madt *construct_madt(struct acpi_info *info)
 {
     struct acpi_20_madt           *madt;
@@ -338,6 +333,7 @@ static int construct_passthrough_tables(unsigned long 
*table_ptrs,
 }
 
 static int construct_secondary_tables(unsigned long *table_ptrs,
+                                      struct acpi_config *config,
                                       struct acpi_info *info)
 {
     int nr_tables = 0;
@@ -371,7 +367,7 @@ static int construct_secondary_tables(unsigned long 
*table_ptrs,
     if (!waet) return -1;
     table_ptrs[nr_tables++] = (unsigned long)waet;
 
-    if ( battery_port_exists() )
+    if ( config->table_flags & ACPI_HAS_SSDT_PM )
     {
         ssdt = mem_alloc(sizeof(ssdt_pm), 16);
         if (!ssdt) return -1;
@@ -379,7 +375,7 @@ static int construct_secondary_tables(unsigned long 
*table_ptrs,
         table_ptrs[nr_tables++] = (unsigned long)ssdt;
     }
 
-    if ( !strncmp(xenstore_read("platform/acpi_s3", "1"), "1", 1) )
+    if ( config->table_flags & ACPI_HAS_SSDT_S3 )
     {
         ssdt = mem_alloc(sizeof(ssdt_s3), 16);
         if (!ssdt) return -1;
@@ -389,7 +385,7 @@ static int construct_secondary_tables(unsigned long 
*table_ptrs,
         printf("S3 disabled\n");
     }
 
-    if ( !strncmp(xenstore_read("platform/acpi_s4", "1"), "1", 1) )
+    if ( config->table_flags & ACPI_HAS_SSDT_S4 )
     {
         ssdt = mem_alloc(sizeof(ssdt_s4), 16);
         if (!ssdt) return -1;
@@ -574,7 +570,8 @@ void acpi_build_tables(const struct acpi_config *config)
                  offsetof(struct acpi_header, checksum),
                  sizeof(struct acpi_20_fadt));
 
-    nr_secondaries = construct_secondary_tables(secondary_tables, acpi_info);
+    nr_secondaries = construct_secondary_tables(secondary_tables,
+                 config, acpi_info);
     if ( nr_secondaries < 0 )
         goto oom;
 
diff --git a/tools/firmware/hvmloader/acpi/libacpi.h 
b/tools/firmware/hvmloader/acpi/libacpi.h
index 05ee6f9..c2da152 100644
--- a/tools/firmware/hvmloader/acpi/libacpi.h
+++ b/tools/firmware/hvmloader/acpi/libacpi.h
@@ -24,6 +24,10 @@
 #define ACPI_HAS_COM2        (1<<1)
 #define ACPI_HAS_LPT1        (1<<2)
 #define ACPI_HAS_HPET        (1<<3)
+#define ACPI_HAS_SSDT_PM     (1<<4)
+#define ACPI_HAS_SSDT_S3     (1<<5)
+#define ACPI_HAS_SSDT_S4     (1<<6)
+
 
 struct acpi_config {
     const unsigned char *dsdt_anycpu;
diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c
index 0bfb372..f01a3fd 100644
--- a/tools/firmware/hvmloader/util.c
+++ b/tools/firmware/hvmloader/util.c
@@ -859,6 +859,11 @@ int hpet_exists(unsigned long hpet_base)
     return ((hpet_id >> 16) == 0x8086);
 }
 
+static uint8_t battery_port_exists(void)
+{
+    return (inb(0x88) == 0x1F);
+}
+
 void hvmloader_acpi_build_tables(struct acpi_config *config,
                                  unsigned int physical)
 {
@@ -895,6 +900,13 @@ void hvmloader_acpi_build_tables(struct acpi_config 
*config,
             config->vm_gid[1] = strtoll(end+1, NULL, 0);
     }
 
+    if ( battery_port_exists() )
+        config->table_flags |= ACPI_HAS_SSDT_PM;
+    if ( !strncmp(xenstore_read("platform/acpi_s3", "1"), "1", 1)  )
+        config->table_flags |= ACPI_HAS_SSDT_S3;
+    if ( !strncmp(xenstore_read("platform/acpi_s4", "1"), "1", 1)  )
+        config->table_flags |= ACPI_HAS_SSDT_S4;
+
     config->rsdp = physical;
     config->infop = ACPI_INFO_PHYSICAL_ADDRESS;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

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

 


Rackspace

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