Commit 09515706 authored by Juergen Gross's avatar Juergen Gross Committed by Boris Ostrovsky

xen/efi: have a common runtime setup function

Today the EFI runtime functions are setup in architecture specific
code (x86 and arm), with the functions themselves living in drivers/xen
as they are not architecture dependent.

As the setup is exactly the same for arm and x86 move the setup to
drivers/xen, too. This at once removes the need to make the single
functions global visible.
Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
[boris: "Dropped EXPORT_SYMBOL_GPL(xen_efi_runtime_setup)"]
Signed-off-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
parent ec066de1
#ifndef _ASM_XEN_OPS_H
#define _ASM_XEN_OPS_H
void xen_efi_runtime_setup(void);
#endif /* _ASM_XEN_OPS_H */
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
obj-y := enlighten.o hypercall.o grant-table.o p2m.o mm.o obj-y := enlighten.o hypercall.o grant-table.o p2m.o mm.o
obj-$(CONFIG_XEN_EFI) += efi.o
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2015, Linaro Limited, Shannon Zhao
*/
#include <linux/efi.h>
#include <xen/xen-ops.h>
#include <asm/xen/xen-ops.h>
/* Set XEN EFI runtime services function pointers. Other fields of struct efi,
* e.g. efi.systab, will be set like normal EFI.
*/
void __init xen_efi_runtime_setup(void)
{
efi.get_time = xen_efi_get_time;
efi.set_time = xen_efi_set_time;
efi.get_wakeup_time = xen_efi_get_wakeup_time;
efi.set_wakeup_time = xen_efi_set_wakeup_time;
efi.get_variable = xen_efi_get_variable;
efi.get_next_variable = xen_efi_get_next_variable;
efi.set_variable = xen_efi_set_variable;
efi.set_variable_nonblocking = xen_efi_set_variable;
efi.query_variable_info = xen_efi_query_variable_info;
efi.query_variable_info_nonblocking = xen_efi_query_variable_info;
efi.update_capsule = xen_efi_update_capsule;
efi.query_capsule_caps = xen_efi_query_capsule_caps;
efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count;
efi.reset_system = xen_efi_reset_system;
}
EXPORT_SYMBOL_GPL(xen_efi_runtime_setup);
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include <xen/xen-ops.h> #include <xen/xen-ops.h>
#include <asm/xen/hypervisor.h> #include <asm/xen/hypervisor.h>
#include <asm/xen/hypercall.h> #include <asm/xen/hypercall.h>
#include <asm/xen/xen-ops.h>
#include <asm/system_misc.h> #include <asm/system_misc.h>
#include <asm/efi.h> #include <asm/efi.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
......
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_XEN_OPS_H
#define _ASM_XEN_OPS_H
void xen_efi_runtime_setup(void);
#endif /* _ASM_XEN_OPS_H */
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
xen-arm-y += $(addprefix ../../arm/xen/, enlighten.o grant-table.o p2m.o mm.o) xen-arm-y += $(addprefix ../../arm/xen/, enlighten.o grant-table.o p2m.o mm.o)
obj-y := xen-arm.o hypercall.o obj-y := xen-arm.o hypercall.o
obj-$(CONFIG_XEN_EFI) += $(addprefix ../../arm/xen/, efi.o)
...@@ -57,21 +57,7 @@ static efi_system_table_t __init *xen_efi_probe(void) ...@@ -57,21 +57,7 @@ static efi_system_table_t __init *xen_efi_probe(void)
return NULL; return NULL;
/* Here we know that Xen runs on EFI platform. */ /* Here we know that Xen runs on EFI platform. */
xen_efi_runtime_setup();
efi.get_time = xen_efi_get_time;
efi.set_time = xen_efi_set_time;
efi.get_wakeup_time = xen_efi_get_wakeup_time;
efi.set_wakeup_time = xen_efi_set_wakeup_time;
efi.get_variable = xen_efi_get_variable;
efi.get_next_variable = xen_efi_get_next_variable;
efi.set_variable = xen_efi_set_variable;
efi.set_variable_nonblocking = xen_efi_set_variable;
efi.query_variable_info = xen_efi_query_variable_info;
efi.query_variable_info_nonblocking = xen_efi_query_variable_info;
efi.update_capsule = xen_efi_update_capsule;
efi.query_capsule_caps = xen_efi_query_capsule_caps;
efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count;
efi.reset_system = xen_efi_reset_system;
efi_systab_xen.tables = info->cfg.addr; efi_systab_xen.tables = info->cfg.addr;
efi_systab_xen.nr_tables = info->cfg.nent; efi_systab_xen.nr_tables = info->cfg.nent;
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#define efi_data(op) (op.u.efi_runtime_call) #define efi_data(op) (op.u.efi_runtime_call)
efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) static efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
{ {
struct xen_platform_op op = INIT_EFI_OP(get_time); struct xen_platform_op op = INIT_EFI_OP(get_time);
...@@ -61,9 +61,8 @@ efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) ...@@ -61,9 +61,8 @@ efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
return efi_data(op).status; return efi_data(op).status;
} }
EXPORT_SYMBOL_GPL(xen_efi_get_time);
efi_status_t xen_efi_set_time(efi_time_t *tm) static efi_status_t xen_efi_set_time(efi_time_t *tm)
{ {
struct xen_platform_op op = INIT_EFI_OP(set_time); struct xen_platform_op op = INIT_EFI_OP(set_time);
...@@ -75,9 +74,9 @@ efi_status_t xen_efi_set_time(efi_time_t *tm) ...@@ -75,9 +74,9 @@ efi_status_t xen_efi_set_time(efi_time_t *tm)
return efi_data(op).status; return efi_data(op).status;
} }
EXPORT_SYMBOL_GPL(xen_efi_set_time);
efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending, static efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled,
efi_bool_t *pending,
efi_time_t *tm) efi_time_t *tm)
{ {
struct xen_platform_op op = INIT_EFI_OP(get_wakeup_time); struct xen_platform_op op = INIT_EFI_OP(get_wakeup_time);
...@@ -98,9 +97,8 @@ efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending, ...@@ -98,9 +97,8 @@ efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending,
return efi_data(op).status; return efi_data(op).status;
} }
EXPORT_SYMBOL_GPL(xen_efi_get_wakeup_time);
efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) static efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
{ {
struct xen_platform_op op = INIT_EFI_OP(set_wakeup_time); struct xen_platform_op op = INIT_EFI_OP(set_wakeup_time);
...@@ -117,9 +115,8 @@ efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) ...@@ -117,9 +115,8 @@ efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
return efi_data(op).status; return efi_data(op).status;
} }
EXPORT_SYMBOL_GPL(xen_efi_set_wakeup_time);
efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor, static efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor,
u32 *attr, unsigned long *data_size, u32 *attr, unsigned long *data_size,
void *data) void *data)
{ {
...@@ -141,9 +138,8 @@ efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor, ...@@ -141,9 +138,8 @@ efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor,
return efi_data(op).status; return efi_data(op).status;
} }
EXPORT_SYMBOL_GPL(xen_efi_get_variable);
efi_status_t xen_efi_get_next_variable(unsigned long *name_size, static efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
efi_char16_t *name, efi_char16_t *name,
efi_guid_t *vendor) efi_guid_t *vendor)
{ {
...@@ -165,9 +161,8 @@ efi_status_t xen_efi_get_next_variable(unsigned long *name_size, ...@@ -165,9 +161,8 @@ efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
return efi_data(op).status; return efi_data(op).status;
} }
EXPORT_SYMBOL_GPL(xen_efi_get_next_variable);
efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor, static efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor,
u32 attr, unsigned long data_size, u32 attr, unsigned long data_size,
void *data) void *data)
{ {
...@@ -186,9 +181,8 @@ efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor, ...@@ -186,9 +181,8 @@ efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor,
return efi_data(op).status; return efi_data(op).status;
} }
EXPORT_SYMBOL_GPL(xen_efi_set_variable);
efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space, static efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space,
u64 *remaining_space, u64 *remaining_space,
u64 *max_variable_size) u64 *max_variable_size)
{ {
...@@ -208,9 +202,8 @@ efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space, ...@@ -208,9 +202,8 @@ efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space,
return efi_data(op).status; return efi_data(op).status;
} }
EXPORT_SYMBOL_GPL(xen_efi_query_variable_info);
efi_status_t xen_efi_get_next_high_mono_count(u32 *count) static efi_status_t xen_efi_get_next_high_mono_count(u32 *count)
{ {
struct xen_platform_op op = INIT_EFI_OP(get_next_high_monotonic_count); struct xen_platform_op op = INIT_EFI_OP(get_next_high_monotonic_count);
...@@ -221,9 +214,8 @@ efi_status_t xen_efi_get_next_high_mono_count(u32 *count) ...@@ -221,9 +214,8 @@ efi_status_t xen_efi_get_next_high_mono_count(u32 *count)
return efi_data(op).status; return efi_data(op).status;
} }
EXPORT_SYMBOL_GPL(xen_efi_get_next_high_mono_count);
efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, static efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
unsigned long count, unsigned long sg_list) unsigned long count, unsigned long sg_list)
{ {
struct xen_platform_op op = INIT_EFI_OP(update_capsule); struct xen_platform_op op = INIT_EFI_OP(update_capsule);
...@@ -241,11 +233,9 @@ efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, ...@@ -241,11 +233,9 @@ efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
return efi_data(op).status; return efi_data(op).status;
} }
EXPORT_SYMBOL_GPL(xen_efi_update_capsule);
efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, static efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
unsigned long count, u64 *max_size, unsigned long count, u64 *max_size, int *reset_type)
int *reset_type)
{ {
struct xen_platform_op op = INIT_EFI_OP(query_capsule_capabilities); struct xen_platform_op op = INIT_EFI_OP(query_capsule_capabilities);
...@@ -264,9 +254,8 @@ efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, ...@@ -264,9 +254,8 @@ efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
return efi_data(op).status; return efi_data(op).status;
} }
EXPORT_SYMBOL_GPL(xen_efi_query_capsule_caps);
void xen_efi_reset_system(int reset_type, efi_status_t status, static void xen_efi_reset_system(int reset_type, efi_status_t status,
unsigned long data_size, efi_char16_t *data) unsigned long data_size, efi_char16_t *data)
{ {
switch (reset_type) { switch (reset_type) {
...@@ -281,4 +270,25 @@ void xen_efi_reset_system(int reset_type, efi_status_t status, ...@@ -281,4 +270,25 @@ void xen_efi_reset_system(int reset_type, efi_status_t status,
BUG(); BUG();
} }
} }
EXPORT_SYMBOL_GPL(xen_efi_reset_system);
/*
* Set XEN EFI runtime services function pointers. Other fields of struct efi,
* e.g. efi.systab, will be set like normal EFI.
*/
void __init xen_efi_runtime_setup(void)
{
efi.get_time = xen_efi_get_time;
efi.set_time = xen_efi_set_time;
efi.get_wakeup_time = xen_efi_get_wakeup_time;
efi.set_wakeup_time = xen_efi_set_wakeup_time;
efi.get_variable = xen_efi_get_variable;
efi.get_next_variable = xen_efi_get_next_variable;
efi.set_variable = xen_efi_set_variable;
efi.set_variable_nonblocking = xen_efi_set_variable;
efi.query_variable_info = xen_efi_query_variable_info;
efi.query_variable_info_nonblocking = xen_efi_query_variable_info;
efi.update_capsule = xen_efi_update_capsule;
efi.query_capsule_caps = xen_efi_query_capsule_caps;
efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count;
efi.reset_system = xen_efi_reset_system;
}
...@@ -212,30 +212,7 @@ int xen_xlate_map_ballooned_pages(xen_pfn_t **pfns, void **vaddr, ...@@ -212,30 +212,7 @@ int xen_xlate_map_ballooned_pages(xen_pfn_t **pfns, void **vaddr,
bool xen_running_on_version_or_later(unsigned int major, unsigned int minor); bool xen_running_on_version_or_later(unsigned int major, unsigned int minor);
efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc); void xen_efi_runtime_setup(void);
efi_status_t xen_efi_set_time(efi_time_t *tm);
efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending,
efi_time_t *tm);
efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm);
efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor,
u32 *attr, unsigned long *data_size,
void *data);
efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
efi_char16_t *name, efi_guid_t *vendor);
efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor,
u32 attr, unsigned long data_size,
void *data);
efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space,
u64 *remaining_space,
u64 *max_variable_size);
efi_status_t xen_efi_get_next_high_mono_count(u32 *count);
efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
unsigned long count, unsigned long sg_list);
efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
unsigned long count, u64 *max_size,
int *reset_type);
void xen_efi_reset_system(int reset_type, efi_status_t status,
unsigned long data_size, efi_char16_t *data);
#ifdef CONFIG_PREEMPT #ifdef CONFIG_PREEMPT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment