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

[Xen-devel] [PATCH v2 24/41] arm : acpi create efi node for DOM0



RSDP and memory map will be passed via
efi table. DTB wil contain the address of
EFI table, starting address of memory
map desctiption table and description
size.

Address of EFI table and memory map description
is not available at the time creation of DT.
Create stub entries which will be fixed later

Signed-off-by: Parth Dixit <parth.dixit@xxxxxxxxxx>
---
 xen/arch/arm/domain_build.c | 50 +++++++++++++++++++++++++++++++++++++++++++++
 xen/include/xen/efi.h       | 11 +++++++++-
 2 files changed, 60 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index e688a78..865b81a 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -10,6 +10,7 @@
 #include <xen/errno.h>
 #include <xen/device_tree.h>
 #include <xen/acpi.h>
+#include <xen/efi.h>
 #include <xen/libfdt/libfdt.h>
 #include <xen/guest_access.h>
 #include <xen/iocap.h>
@@ -1219,6 +1220,51 @@ static int handle_node(struct domain *d, struct 
kernel_info *kinfo,
     return res;
 }
 #ifdef CONFIG_ACPI
+/*
+ * Create place holder for efi values.
+ * Actual values will be replaced later
+ */
+static int make_efi_nodes(struct domain *d,void *fdt,
+                           const struct kernel_info *kinfo)
+{
+    u64 fdt_val64;
+    u32 fdt_val32;
+    int desc_size = sizeof(struct efi_memory_desc);
+    int desc_ver = EFI_MEM_DESC_V1;
+    int res;
+    u64 addr = 0;
+
+    fdt_val64 = cpu_to_fdt64((u64)(uintptr_t)addr);
+    res = fdt_property(fdt, "linux,uefi-system-table",
+                       &fdt_val64, sizeof(fdt_val64));
+    if ( res )
+        return res;
+
+    fdt_val64 = cpu_to_fdt64((u64)(uintptr_t)addr);
+    res = fdt_property(fdt, "linux,uefi-mmap-start",
+                       &fdt_val64,  sizeof(fdt_val64));
+    if ( res )
+        return res;
+
+    fdt_val32 = cpu_to_fdt32(desc_size);
+    res = fdt_property(fdt, "linux,uefi-mmap-size",
+                       &fdt_val32,  sizeof(fdt_val32));
+    if ( res )
+        return res;
+
+    fdt_val32 = cpu_to_fdt32(desc_size);
+    res = fdt_property(fdt, "linux,uefi-mmap-desc-size",
+                         &fdt_val32, sizeof(fdt_val32));
+     if ( res )
+        return res;
+
+    fdt_val32 = cpu_to_fdt32(desc_ver);
+    res = fdt_property(fdt, "linux,uefi-mmap-desc-ver",
+                         &fdt_val32, sizeof(fdt_val32));
+
+    return res;
+}
+
 static int make_chosen_node(struct domain *d, const struct kernel_info *kinfo)
 {
     int res = 0;
@@ -1255,6 +1301,10 @@ static int make_chosen_node(struct domain *d, const 
struct kernel_info *kinfo)
             return res;
     }
 
+    res = make_efi_nodes(d, fdt, kinfo);
+    if ( res )
+        return res;
+
     res = fdt_end_node(fdt);
 
     return res;
diff --git a/xen/include/xen/efi.h b/xen/include/xen/efi.h
index 48de8e0..26b2f45 100644
--- a/xen/include/xen/efi.h
+++ b/xen/include/xen/efi.h
@@ -8,7 +8,7 @@
 extern const bool_t efi_enabled;
 
 #define EFI_INVALID_TABLE_ADDR (~0UL)
-
+#define EFI_MEM_DESC_V1 1
 /* Add fields here only if they need to be referenced from non-EFI code. */
 struct efi {
     unsigned long mps;          /* MPS table */
@@ -20,6 +20,15 @@ struct efi {
 
 extern struct efi efi;
 
+struct efi_memory_desc {
+    u32 type;
+    u32 pad;
+    u64 phys_addr;
+    u64 virt_addr;
+    u64 num_pages;
+    u64 attribute;
+};
+
 #ifndef __ASSEMBLY__
 
 union xenpf_efi_info;
-- 
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®.