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

[Xen-changelog] [xen-unstable] x86-64/EFI: 2.0 hypercall extensions



# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1316273256 -3600
# Node ID 3af7c715a79dc20a63b63d84727d1cf14a422ab8
# Parent  bf4be96e2de92d91212a52cc9d368e87a5b7e971
x86-64/EFI: 2.0 hypercall extensions

Flesh out the interface to EFI 2.0 runtime calls and implement what
can reasonably be without actually having active call paths getting
there (i.e. without actual debugging possible: The capsule interfaces
certainly require an environment where an initial implementation can
actually be tested).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r bf4be96e2de9 -r 3af7c715a79d xen/arch/x86/efi/runtime.c
--- a/xen/arch/x86/efi/runtime.c        Sat Sep 17 16:27:06 2011 +0100
+++ b/xen/arch/x86/efi/runtime.c        Sat Sep 17 16:27:36 2011 +0100
@@ -130,6 +130,14 @@
     case XEN_FW_EFI_VERSION:
         info->version = efi_version;
         break;
+    case XEN_FW_EFI_RT_VERSION:
+    {
+        unsigned long cr3 = efi_rs_enter();
+
+        info->version = efi_rs->Hdr.Revision;
+        efi_rs_leave(cr3);
+        break;
+    }
     case XEN_FW_EFI_CONFIG_TABLE:
         info->cfg.addr = __pa(efi_ct);
         info->cfg.nent = efi_num_ct;
@@ -418,7 +426,12 @@
         name.raw = xmalloc_bytes(size);
         if ( !name.raw )
             return -ENOMEM;
-        copy_from_guest(name.raw, op->u.get_next_variable_name.name, size);
+        if ( copy_from_guest(name.raw, op->u.get_next_variable_name.name,
+                             size) )
+        {
+            xfree(name.raw);
+            return -EFAULT;
+        }
 
         cr3 = efi_rs_enter();
         status = efi_rs->GetNextVariableName(
@@ -435,6 +448,31 @@
     }
     break;
 
+    case XEN_EFI_query_variable_info:
+        cr3 = efi_rs_enter();
+        if ( (efi_rs->Hdr.Revision >> 16) < 2 )
+        {
+            efi_rs_leave(cr3);
+            return -EOPNOTSUPP;
+        }
+        status = efi_rs->QueryVariableInfo(
+            op->u.query_variable_info.attr,
+            &op->u.query_variable_info.max_store_size,
+            &op->u.query_variable_info.remain_store_size,
+            &op->u.query_variable_info.max_size);
+        efi_rs_leave(cr3);
+        break;
+
+    case XEN_EFI_query_capsule_capabilities:
+    case XEN_EFI_update_capsule:
+        cr3 = efi_rs_enter();
+        if ( (efi_rs->Hdr.Revision >> 16) < 2 )
+        {
+            efi_rs_leave(cr3);
+            return -EOPNOTSUPP;
+        }
+        efi_rs_leave(cr3);
+        /* XXX fall through for now */
     default:
         return -ENOSYS;
     }
diff -r bf4be96e2de9 -r 3af7c715a79d xen/include/public/platform.h
--- a/xen/include/public/platform.h     Sat Sep 17 16:27:06 2011 +0100
+++ b/xen/include/public/platform.h     Sat Sep 17 16:27:36 2011 +0100
@@ -123,6 +123,9 @@
 #define XEN_EFI_get_variable                  6
 #define XEN_EFI_set_variable                  7
 #define XEN_EFI_get_next_variable_name        8
+#define XEN_EFI_query_variable_info           9
+#define XEN_EFI_query_capsule_capabilities   10
+#define XEN_EFI_update_capsule               11
 struct xenpf_efi_runtime_call {
     uint32_t function;
     /*
@@ -180,6 +183,26 @@
             XEN_GUEST_HANDLE(void) name;  /* UCS-2/UTF-16 string */
             struct xenpf_efi_guid vendor_guid;
         } get_next_variable_name;
+
+        struct {
+            uint32_t attr;
+            uint64_t max_store_size;
+            uint64_t remain_store_size;
+            uint64_t max_size;
+        } query_variable_info;
+
+        struct {
+            XEN_GUEST_HANDLE(void) capsule_header_array;
+            unsigned long capsule_count;
+            uint64_t max_capsule_size;
+            unsigned int reset_type;
+        } query_capsule_capabilities;
+
+        struct {
+            XEN_GUEST_HANDLE(void) capsule_header_array;
+            unsigned long capsule_count;
+            uint64_t sg_list; /* machine address */
+        } update_capsule;
     } u;
 };
 typedef struct xenpf_efi_runtime_call xenpf_efi_runtime_call_t;
@@ -194,6 +217,7 @@
 #define  XEN_FW_EFI_CONFIG_TABLE   1
 #define  XEN_FW_EFI_VENDOR         2
 #define  XEN_FW_EFI_MEM_INFO       3
+#define  XEN_FW_EFI_RT_VERSION     4
 struct xenpf_firmware_info {
     /* IN variables. */
     uint32_t type;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.