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;
x86-EFI-runtime-2.0.patch
Description: Text document
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|