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

[Xen-devel] [PATCH v2 33/41] arm : acpi prepare acpi tables for dom0



Map acpi tables described in uefi table to DOM0 address space

Signed-off-by: Parth Dixit <parth.dixit@xxxxxxxxxx>
---
 xen/arch/arm/domain_build.c | 59 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 58 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index f2ca525..90bdd01 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1225,6 +1225,50 @@ static int handle_node(struct domain *d, struct 
kernel_info *kinfo,
     return res;
 }
 #ifdef CONFIG_ACPI
+static int prepare_acpi(struct domain *d, struct kernel_info *kinfo, struct 
membank tbl_add[])
+{
+    unsigned long res;
+    u64 addr, size;
+    int i = 0;
+
+    addr = acpi_os_get_root_pointer();
+    if( !addr )
+        return -ENODEV;
+
+    size = sizeof(struct acpi_table_rsdp);
+
+    res = map_regions(d,
+                      paddr_to_pfn(addr & PAGE_MASK),
+                      DIV_ROUND_UP(size, PAGE_SIZE),
+                      paddr_to_pfn(addr & PAGE_MASK));
+    if ( res )
+    {
+         printk(XENLOG_ERR "Unable to map 0x%"PRIx64
+                " - 0x%"PRIx64" in domain \n",
+                addr & PAGE_MASK, PAGE_ALIGN(addr + size) - 1);
+         return res;
+    }
+
+    for( i = 0; i < acpi_gbl_root_table_list.count; i++ )
+    {
+        addr = acpi_gbl_root_table_list.tables[i].address;
+        size = acpi_gbl_root_table_list.tables[i].length;
+        res = map_regions(d,
+                          paddr_to_pfn(addr & PAGE_MASK),
+                          DIV_ROUND_UP(size, PAGE_SIZE),
+                          paddr_to_pfn(addr & PAGE_MASK));
+        if ( res )
+        {
+             printk(XENLOG_ERR "Unable to map 0x%"PRIx64
+                    " - 0x%"PRIx64" in domain \n",
+                    addr & PAGE_MASK, PAGE_ALIGN(addr + size) - 1);
+             return res;
+        }
+    }
+
+    return 0;
+}
+
 static int estimate_acpi_size(struct domain *d,struct kernel_info *kinfo, 
struct membank tbl_add[])
 {
     int size = 0;
@@ -1429,6 +1473,10 @@ static int create_acpi_dtb(struct domain *d, struct 
kernel_info *kinfo, struct m
 {
     return -EINVAL;
 }
+static int prepare_acpi(struct domain *d, struct kernel_info *kinfo, struct 
membank tbl_add[])
+{
+    return -EINVAL;
+}
 #endif
 static int prepare_dtb(struct domain *d, struct kernel_info *kinfo)
 {
@@ -1647,10 +1695,19 @@ int construct_dom0(struct domain *d)
      * as the initrd & fdt in RAM, so call it first.
      */
     kernel_load(&kinfo);
+
+    if ( !acpi_disabled )
+    {
+        rc = prepare_acpi(d, &kinfo, tbl_add);
+        if ( rc < 0 )
+            return rc;
+    }
+
     /* initrd_load will fix up the fdt, so call it before dtb_load */
     initrd_load(&kinfo);
     /* Allocate the event channel IRQ and fix up the device tree */
-    evtchn_fixup(d, &kinfo);
+    if( acpi_disabled )
+        evtchn_fixup(d, &kinfo);
     dtb_load(&kinfo);
 
     /* Now that we are done restore the original p2m and current. */
-- 
1.9.1


_______________________________________________
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®.