| Huang, Ying | 5b83683 | 2008-01-30 13:31:19 +0100 | [diff] [blame] | 1 | #ifndef _ASM_X86_EFI_H | 
|  | 2 | #define _ASM_X86_EFI_H | 
|  | 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 | 1c083eb | 2008-02-04 16:48:06 +0100 | [diff] [blame] | 36 | #define efi_ioremap(addr, size)			ioremap_cache(addr, size) | 
| Huang, Ying | e429795 | 2008-01-30 13:31:19 +0100 | [diff] [blame] | 37 |  | 
| Huang, Ying | 5b83683 | 2008-01-30 13:31:19 +0100 | [diff] [blame] | 38 | #else /* !CONFIG_X86_32 */ | 
|  | 39 |  | 
|  | 40 | #define MAX_EFI_IO_PAGES	100 | 
|  | 41 |  | 
|  | 42 | extern u64 efi_call0(void *fp); | 
|  | 43 | extern u64 efi_call1(void *fp, u64 arg1); | 
|  | 44 | extern u64 efi_call2(void *fp, u64 arg1, u64 arg2); | 
|  | 45 | extern u64 efi_call3(void *fp, u64 arg1, u64 arg2, u64 arg3); | 
|  | 46 | extern u64 efi_call4(void *fp, u64 arg1, u64 arg2, u64 arg3, u64 arg4); | 
|  | 47 | extern u64 efi_call5(void *fp, u64 arg1, u64 arg2, u64 arg3, | 
|  | 48 | u64 arg4, u64 arg5); | 
|  | 49 | extern u64 efi_call6(void *fp, u64 arg1, u64 arg2, u64 arg3, | 
|  | 50 | u64 arg4, u64 arg5, u64 arg6); | 
|  | 51 |  | 
|  | 52 | #define efi_call_phys0(f)			\ | 
|  | 53 | efi_call0((void *)(f)) | 
|  | 54 | #define efi_call_phys1(f, a1)			\ | 
|  | 55 | efi_call1((void *)(f), (u64)(a1)) | 
|  | 56 | #define efi_call_phys2(f, a1, a2)			\ | 
|  | 57 | efi_call2((void *)(f), (u64)(a1), (u64)(a2)) | 
|  | 58 | #define efi_call_phys3(f, a1, a2, a3)				\ | 
|  | 59 | efi_call3((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3)) | 
|  | 60 | #define efi_call_phys4(f, a1, a2, a3, a4)				\ | 
|  | 61 | efi_call4((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3),		\ | 
|  | 62 | (u64)(a4)) | 
|  | 63 | #define efi_call_phys5(f, a1, a2, a3, a4, a5)				\ | 
|  | 64 | efi_call5((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3),		\ | 
|  | 65 | (u64)(a4), (u64)(a5)) | 
|  | 66 | #define efi_call_phys6(f, a1, a2, a3, a4, a5, a6)			\ | 
|  | 67 | efi_call6((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3),		\ | 
|  | 68 | (u64)(a4), (u64)(a5), (u64)(a6)) | 
|  | 69 |  | 
|  | 70 | #define efi_call_virt0(f)				\ | 
|  | 71 | efi_call0((void *)(efi.systab->runtime->f)) | 
|  | 72 | #define efi_call_virt1(f, a1)					\ | 
|  | 73 | efi_call1((void *)(efi.systab->runtime->f), (u64)(a1)) | 
|  | 74 | #define efi_call_virt2(f, a1, a2)					\ | 
|  | 75 | efi_call2((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2)) | 
|  | 76 | #define efi_call_virt3(f, a1, a2, a3)					\ | 
|  | 77 | efi_call3((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ | 
|  | 78 | (u64)(a3)) | 
|  | 79 | #define efi_call_virt4(f, a1, a2, a3, a4)				\ | 
|  | 80 | efi_call4((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ | 
|  | 81 | (u64)(a3), (u64)(a4)) | 
|  | 82 | #define efi_call_virt5(f, a1, a2, a3, a4, a5)				\ | 
|  | 83 | efi_call5((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ | 
|  | 84 | (u64)(a3), (u64)(a4), (u64)(a5)) | 
|  | 85 | #define efi_call_virt6(f, a1, a2, a3, a4, a5, a6)			\ | 
|  | 86 | efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ | 
|  | 87 | (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6)) | 
|  | 88 |  | 
| Randy Dunlap | b0fbaa6 | 2008-08-07 15:12:39 -0700 | [diff] [blame] | 89 | extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size); | 
| Huang, Ying | 5b83683 | 2008-01-30 13:31:19 +0100 | [diff] [blame] | 90 |  | 
| Huang, Ying | 5b83683 | 2008-01-30 13:31:19 +0100 | [diff] [blame] | 91 | #endif /* CONFIG_X86_32 */ | 
|  | 92 |  | 
| Huang, Ying | ecacf09 | 2008-06-02 14:26:21 +0800 | [diff] [blame] | 93 | extern void efi_reserve_early(void); | 
| Huang, Ying | 5b83683 | 2008-01-30 13:31:19 +0100 | [diff] [blame] | 94 | extern void efi_call_phys_prelog(void); | 
|  | 95 | extern void efi_call_phys_epilog(void); | 
| Huang, Ying | 5b83683 | 2008-01-30 13:31:19 +0100 | [diff] [blame] | 96 |  | 
|  | 97 | #endif |