WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 2/2] x86-64/EFI: 2.0 hypercall extensions

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 2/2] x86-64/EFI: 2.0 hypercall extensions
From: "Jan Beulich" <JBeulich@xxxxxxxx>
Date: Fri, 16 Sep 2011 11:29:43 +0100
Delivery-date: Fri, 16 Sep 2011 03:31:41 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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>

--- a/xen/arch/x86/efi/runtime.c
+++ b/xen/arch/x86/efi/runtime.c
@@ -130,6 +130,14 @@ int efi_get_info(uint32_t idx, union xen
     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 @@ int efi_runtime_call(struct xenpf_efi_ru
         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 @@ int efi_runtime_call(struct xenpf_efi_ru
     }
     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;
     }
--- a/xen/include/public/platform.h
+++ b/xen/include/public/platform.h
@@ -123,6 +123,9 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_platform_q
 #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 @@ struct xenpf_efi_runtime_call {
             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_GUEST_HANDLE(xenpf_efi_runtim
 #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;


Attachment: x86-EFI-runtime-2.0.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 2/2] x86-64/EFI: 2.0 hypercall extensions, Jan Beulich <=