H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 1 | #ifndef _ASM_X86_EFI_H |
| 2 | #define _ASM_X86_EFI_H |
Huang, Ying | 5b83683 | 2008-01-30 13:31:19 +0100 | [diff] [blame] | 3 | |
| 4 | #ifdef CONFIG_X86_32 |
Huang, Ying | e429795 | 2008-01-30 13:31:19 +0100 | [diff] [blame] | 5 | |
| 6 | extern unsigned long asmlinkage efi_call_phys(void *, ...); |
| 7 | |
| 8 | #define efi_call_phys0(f) efi_call_phys(f) |
| 9 | #define efi_call_phys1(f, a1) efi_call_phys(f, a1) |
| 10 | #define efi_call_phys2(f, a1, a2) efi_call_phys(f, a1, a2) |
| 11 | #define efi_call_phys3(f, a1, a2, a3) efi_call_phys(f, a1, a2, a3) |
| 12 | #define efi_call_phys4(f, a1, a2, a3, a4) \ |
| 13 | efi_call_phys(f, a1, a2, a3, a4) |
| 14 | #define efi_call_phys5(f, a1, a2, a3, a4, a5) \ |
| 15 | efi_call_phys(f, a1, a2, a3, a4, a5) |
| 16 | #define efi_call_phys6(f, a1, a2, a3, a4, a5, a6) \ |
| 17 | efi_call_phys(f, a1, a2, a3, a4, a5, a6) |
| 18 | /* |
| 19 | * Wrap all the virtual calls in a way that forces the parameters on the stack. |
| 20 | */ |
| 21 | |
| 22 | #define efi_call_virt(f, args...) \ |
Joe Perches | 0c6f6ab | 2008-03-23 01:02:07 -0700 | [diff] [blame] | 23 | ((efi_##f##_t __attribute__((regparm(0)))*)efi.systab->runtime->f)(args) |
Huang, Ying | e429795 | 2008-01-30 13:31:19 +0100 | [diff] [blame] | 24 | |
| 25 | #define efi_call_virt0(f) efi_call_virt(f) |
| 26 | #define efi_call_virt1(f, a1) efi_call_virt(f, a1) |
| 27 | #define efi_call_virt2(f, a1, a2) efi_call_virt(f, a1, a2) |
| 28 | #define efi_call_virt3(f, a1, a2, a3) efi_call_virt(f, a1, a2, a3) |
| 29 | #define efi_call_virt4(f, a1, a2, a3, a4) \ |
| 30 | efi_call_virt(f, a1, a2, a3, a4) |
| 31 | #define efi_call_virt5(f, a1, a2, a3, a4, a5) \ |
| 32 | efi_call_virt(f, a1, a2, a3, a4, a5) |
| 33 | #define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \ |
| 34 | efi_call_virt(f, a1, a2, a3, a4, a5, a6) |
Huang, Ying | e429795 | 2008-01-30 13:31:19 +0100 | [diff] [blame] | 35 | |
Huang, Ying | 5b83683 | 2008-01-30 13:31:19 +0100 | [diff] [blame] | 36 | #else /* !CONFIG_X86_32 */ |
| 37 | |
Huang, Ying | 5b83683 | 2008-01-30 13:31:19 +0100 | [diff] [blame] | 38 | extern u64 efi_call0(void *fp); |
| 39 | extern u64 efi_call1(void *fp, u64 arg1); |
| 40 | extern u64 efi_call2(void *fp, u64 arg1, u64 arg2); |
| 41 | extern u64 efi_call3(void *fp, u64 arg1, u64 arg2, u64 arg3); |
| 42 | extern u64 efi_call4(void *fp, u64 arg1, u64 arg2, u64 arg3, u64 arg4); |
| 43 | extern u64 efi_call5(void *fp, u64 arg1, u64 arg2, u64 arg3, |
| 44 | u64 arg4, u64 arg5); |
| 45 | extern u64 efi_call6(void *fp, u64 arg1, u64 arg2, u64 arg3, |
| 46 | u64 arg4, u64 arg5, u64 arg6); |
| 47 | |
| 48 | #define efi_call_phys0(f) \ |
| 49 | efi_call0((void *)(f)) |
| 50 | #define efi_call_phys1(f, a1) \ |
| 51 | efi_call1((void *)(f), (u64)(a1)) |
| 52 | #define efi_call_phys2(f, a1, a2) \ |
| 53 | efi_call2((void *)(f), (u64)(a1), (u64)(a2)) |
| 54 | #define efi_call_phys3(f, a1, a2, a3) \ |
| 55 | efi_call3((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3)) |
| 56 | #define efi_call_phys4(f, a1, a2, a3, a4) \ |
| 57 | efi_call4((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3), \ |
| 58 | (u64)(a4)) |
| 59 | #define efi_call_phys5(f, a1, a2, a3, a4, a5) \ |
| 60 | efi_call5((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3), \ |
| 61 | (u64)(a4), (u64)(a5)) |
| 62 | #define efi_call_phys6(f, a1, a2, a3, a4, a5, a6) \ |
| 63 | efi_call6((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3), \ |
| 64 | (u64)(a4), (u64)(a5), (u64)(a6)) |
| 65 | |
| 66 | #define efi_call_virt0(f) \ |
| 67 | efi_call0((void *)(efi.systab->runtime->f)) |
| 68 | #define efi_call_virt1(f, a1) \ |
| 69 | efi_call1((void *)(efi.systab->runtime->f), (u64)(a1)) |
| 70 | #define efi_call_virt2(f, a1, a2) \ |
| 71 | efi_call2((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2)) |
| 72 | #define efi_call_virt3(f, a1, a2, a3) \ |
| 73 | efi_call3((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ |
| 74 | (u64)(a3)) |
| 75 | #define efi_call_virt4(f, a1, a2, a3, a4) \ |
| 76 | efi_call4((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ |
| 77 | (u64)(a3), (u64)(a4)) |
| 78 | #define efi_call_virt5(f, a1, a2, a3, a4, a5) \ |
| 79 | efi_call5((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ |
| 80 | (u64)(a3), (u64)(a4), (u64)(a5)) |
| 81 | #define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \ |
| 82 | efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ |
| 83 | (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6)) |
| 84 | |
Huang, Ying | 5b83683 | 2008-01-30 13:31:19 +0100 | [diff] [blame] | 85 | #endif /* CONFIG_X86_32 */ |
| 86 | |
Jaswinder Singh Rajput | cbafbc8 | 2008-12-29 20:36:40 +0530 | [diff] [blame] | 87 | extern int add_efi_memmap; |
Matthew Garrett | 9cd2b07 | 2011-05-05 15:19:43 -0400 | [diff] [blame] | 88 | extern void efi_set_executable(efi_memory_desc_t *md, bool executable); |
Yinghai Lu | a9ce6bc | 2010-08-25 13:39:17 -0700 | [diff] [blame] | 89 | extern void efi_memblock_x86_reserve_range(void); |
Huang, Ying | 5b83683 | 2008-01-30 13:31:19 +0100 | [diff] [blame] | 90 | extern void efi_call_phys_prelog(void); |
| 91 | extern void efi_call_phys_epilog(void); |
Huang, Ying | 5b83683 | 2008-01-30 13:31:19 +0100 | [diff] [blame] | 92 | |
Russ Anderson | 7f59423 | 2008-10-03 11:59:15 -0500 | [diff] [blame] | 93 | #ifndef CONFIG_EFI |
| 94 | /* |
| 95 | * IF EFI is not configured, have the EFI calls return -ENOSYS. |
| 96 | */ |
| 97 | #define efi_call0(_f) (-ENOSYS) |
| 98 | #define efi_call1(_f, _a1) (-ENOSYS) |
| 99 | #define efi_call2(_f, _a1, _a2) (-ENOSYS) |
| 100 | #define efi_call3(_f, _a1, _a2, _a3) (-ENOSYS) |
| 101 | #define efi_call4(_f, _a1, _a2, _a3, _a4) (-ENOSYS) |
| 102 | #define efi_call5(_f, _a1, _a2, _a3, _a4, _a5) (-ENOSYS) |
| 103 | #define efi_call6(_f, _a1, _a2, _a3, _a4, _a5, _a6) (-ENOSYS) |
| 104 | #endif /* CONFIG_EFI */ |
| 105 | |
H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 106 | #endif /* _ASM_X86_EFI_H */ |