[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 02/10] xen/x86: move reusable EFI stub functions from x86 to common
Most of the functions in x86 EFI stub.c can be reused for other architectures. So we move them to common and keep the x86 specific function in stub-x86.c. Signed-off-by: Wei Chen <wei.chen@xxxxxxx> --- v1 -> v2: 1. Drop the copy of stub.c from Arm EFI. 2. Share common codes of x86 EFI stub for other architectures. --- xen/arch/x86/efi/Makefile | 4 +-- xen/arch/x86/efi/{stub.c => stub-x86.c} | 37 ------------------------ xen/common/efi/stub.c | 38 +++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 39 deletions(-) rename xen/arch/x86/efi/{stub.c => stub-x86.c} (71%) create mode 100644 xen/common/efi/stub.c diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile index 034ec87895..5ca3a0b4a4 100644 --- a/xen/arch/x86/efi/Makefile +++ b/xen/arch/x86/efi/Makefile @@ -11,8 +11,8 @@ $(obj)/boot.init.o: $(obj)/buildid.o $(call cc-option-add,cflags-stack-boundary,CC,-mpreferred-stack-boundary=4) $(addprefix $(obj)/,$(EFIOBJ-y)): CFLAGS_stack_boundary := $(cflags-stack-boundary) -obj-y := stub.o +obj-y := stub.o stub-x86.o obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ-y)) obj-bin-$(XEN_BUILD_EFI) := $(filter %.init.o,$(EFIOBJ-y)) extra-$(XEN_BUILD_EFI) += buildid.o relocs-dummy.o -nocov-$(XEN_BUILD_EFI) += stub.o +nocov-$(XEN_BUILD_EFI) += stub.o stub-x86.o diff --git a/xen/arch/x86/efi/stub.c b/xen/arch/x86/efi/stub-x86.c similarity index 71% rename from xen/arch/x86/efi/stub.c rename to xen/arch/x86/efi/stub-x86.c index 9984932626..2cd5c8d4dc 100644 --- a/xen/arch/x86/efi/stub.c +++ b/xen/arch/x86/efi/stub-x86.c @@ -1,7 +1,5 @@ #include <xen/efi.h> -#include <xen/errno.h> #include <xen/init.h> -#include <xen/lib.h> #include <asm/asm_defns.h> #include <asm/efibind.h> #include <asm/page.h> @@ -45,11 +43,6 @@ void __init noreturn efi_multiboot2(EFI_HANDLE ImageHandle, unreachable(); } -bool efi_enabled(unsigned int feature) -{ - return false; -} - void __init efi_init_memory(void) { } bool efi_boot_mem_unused(unsigned long *start, unsigned long *end) @@ -61,33 +54,3 @@ bool efi_boot_mem_unused(unsigned long *start, unsigned long *end) } void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t l4e) { } - -bool efi_rs_using_pgtables(void) -{ - return false; -} - -unsigned long efi_get_time(void) -{ - BUG(); - return 0; -} - -void efi_halt_system(void) { } -void efi_reset_system(bool warm) { } - -int efi_get_info(uint32_t idx, union xenpf_efi_info *info) -{ - return -ENOSYS; -} - -int efi_compat_get_info(uint32_t idx, union compat_pf_efi_info *) - __attribute__((__alias__("efi_get_info"))); - -int efi_runtime_call(struct xenpf_efi_runtime_call *op) -{ - return -ENOSYS; -} - -int efi_compat_runtime_call(struct compat_pf_efi_runtime_call *) - __attribute__((__alias__("efi_runtime_call"))); diff --git a/xen/common/efi/stub.c b/xen/common/efi/stub.c new file mode 100644 index 0000000000..6e4f4de9af --- /dev/null +++ b/xen/common/efi/stub.c @@ -0,0 +1,38 @@ +#include <xen/efi.h> +#include <xen/errno.h> +#include <xen/lib.h> + +bool efi_enabled(unsigned int feature) +{ + return false; +} + +bool efi_rs_using_pgtables(void) +{ + return false; +} + +unsigned long efi_get_time(void) +{ + BUG(); + return 0; +} + +void efi_halt_system(void) { } +void efi_reset_system(bool warm) { } + +int efi_get_info(uint32_t idx, union xenpf_efi_info *info) +{ + return -ENOSYS; +} + +int efi_compat_get_info(uint32_t idx, union compat_pf_efi_info *) + __attribute__((__alias__("efi_get_info"))); + +int efi_runtime_call(struct xenpf_efi_runtime_call *op) +{ + return -ENOSYS; +} + +int efi_compat_runtime_call(struct compat_pf_efi_runtime_call *) + __attribute__((__alias__("efi_runtime_call"))); -- 2.25.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |