mirror of
https://github.com/xen-project/xen.git
synced 2026-10-30 03:00:05 +01:00
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@suse.com>
This commit is contained in:
1 parent
f1f85ffbab
commit
5dfbbab17f
2 files changed
+63
-1
No files matched your search
@@ -130,6 +130,14 @@ int efi_get_info(uint32_t idx, union xenpf_efi_info *info)
|
||||
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_runtime_call *op)
|
||||
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_runtime_call *op)
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -123,6 +123,9 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_platform_quirk_t);
|
||||
#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_runtime_call_t);
|
||||
#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;
|
||||
|
||||