1 #include <xen/efi.h>
2 #include <xen/errno.h>
3 #include <xen/init.h>
4 #include <xen/lib.h>
5 #include <asm/page.h>
6 #include <asm/efibind.h>
7 #include <efi/efidef.h>
8 #include <efi/eficapsule.h>
9 #include <efi/eficon.h>
10 #include <efi/efidevp.h>
11 #include <efi/efiapi.h>
12 
13 /*
14  * Here we are in EFI stub. EFI calls are not supported due to lack
15  * of relevant functionality in compiler and/or linker.
16  *
17  * efi_multiboot2() is an exception. Please look below for more details.
18  */
19 
efi_multiboot2(EFI_HANDLE ImageHandle,EFI_SYSTEM_TABLE * SystemTable)20 void __init noreturn efi_multiboot2(EFI_HANDLE ImageHandle,
21                                     EFI_SYSTEM_TABLE *SystemTable)
22 {
23     static const CHAR16 __initconst err[] =
24         L"Xen does not have EFI code build in!\r\nSystem halted!\r\n";
25     SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr;
26 
27     StdErr = SystemTable->StdErr ? SystemTable->StdErr : SystemTable->ConOut;
28 
29     /*
30      * Print error message and halt the system.
31      *
32      * We have to open code MS x64 calling convention
33      * in assembly because here this convention may
34      * not be directly supported by C compiler.
35      */
36     asm volatile(
37     "    call *%3                     \n"
38     "0:  hlt                          \n"
39     "    jmp  0b                      \n"
40        : "+c" (StdErr), "=d" (StdErr) : "1" (err), "rm" (StdErr->OutputString)
41        : "rax", "r8", "r9", "r10", "r11", "memory");
42 
43     unreachable();
44 }
45 
efi_enabled(unsigned int feature)46 bool efi_enabled(unsigned int feature)
47 {
48     return false;
49 }
50 
efi_init_memory(void)51 void __init efi_init_memory(void) { }
52 
efi_update_l4_pgtable(unsigned int l4idx,l4_pgentry_t l4e)53 void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t l4e) { }
54 
efi_rs_using_pgtables(void)55 bool efi_rs_using_pgtables(void)
56 {
57     return false;
58 }
59 
efi_get_time(void)60 unsigned long efi_get_time(void)
61 {
62     BUG();
63     return 0;
64 }
65 
efi_halt_system(void)66 void efi_halt_system(void) { }
efi_reset_system(bool warm)67 void efi_reset_system(bool warm) { }
68 
efi_get_info(uint32_t idx,union xenpf_efi_info * info)69 int efi_get_info(uint32_t idx, union xenpf_efi_info *info)
70 {
71     return -ENOSYS;
72 }
73 
74 int efi_compat_get_info(uint32_t idx, union compat_pf_efi_info *)
75     __attribute__((__alias__("efi_get_info")));
76 
efi_runtime_call(struct xenpf_efi_runtime_call * op)77 int efi_runtime_call(struct xenpf_efi_runtime_call *op)
78 {
79     return -ENOSYS;
80 }
81 
82 int efi_compat_runtime_call(struct compat_pf_efi_runtime_call *)
83     __attribute__((__alias__("efi_runtime_call")));
84