blob: 8406ed7f99269f97c469bc9b03e0cb8d00276f84 [file] [log] [blame]
H. Peter Anvin1965aae2008-10-22 22:26:29 -07001#ifndef _ASM_X86_EFI_H
2#define _ASM_X86_EFI_H
Huang, Ying5b836832008-01-30 13:31:19 +01003
4#ifdef CONFIG_X86_32
Huang, Yinge4297952008-01-30 13:31:19 +01005
6extern 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 Perches0c6f6ab2008-03-23 01:02:07 -070023 ((efi_##f##_t __attribute__((regparm(0)))*)efi.systab->runtime->f)(args)
Huang, Yinge4297952008-01-30 13:31:19 +010024
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, Yinge4297952008-01-30 13:31:19 +010035
Paul Mackerras6a7bbd52009-08-03 22:38:10 +100036#define efi_ioremap(addr, size, type) ioremap_cache(addr, size)
Huang, Yinge4297952008-01-30 13:31:19 +010037
Huang, Ying5b836832008-01-30 13:31:19 +010038#else /* !CONFIG_X86_32 */
39
Huang, Ying5b836832008-01-30 13:31:19 +010040extern u64 efi_call0(void *fp);
41extern u64 efi_call1(void *fp, u64 arg1);
42extern u64 efi_call2(void *fp, u64 arg1, u64 arg2);
43extern u64 efi_call3(void *fp, u64 arg1, u64 arg2, u64 arg3);
44extern u64 efi_call4(void *fp, u64 arg1, u64 arg2, u64 arg3, u64 arg4);
45extern u64 efi_call5(void *fp, u64 arg1, u64 arg2, u64 arg3,
46 u64 arg4, u64 arg5);
47extern u64 efi_call6(void *fp, u64 arg1, u64 arg2, u64 arg3,
48 u64 arg4, u64 arg5, u64 arg6);
49
50#define efi_call_phys0(f) \
51 efi_call0((void *)(f))
52#define efi_call_phys1(f, a1) \
53 efi_call1((void *)(f), (u64)(a1))
54#define efi_call_phys2(f, a1, a2) \
55 efi_call2((void *)(f), (u64)(a1), (u64)(a2))
56#define efi_call_phys3(f, a1, a2, a3) \
57 efi_call3((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3))
58#define efi_call_phys4(f, a1, a2, a3, a4) \
59 efi_call4((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3), \
60 (u64)(a4))
61#define efi_call_phys5(f, a1, a2, a3, a4, a5) \
62 efi_call5((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3), \
63 (u64)(a4), (u64)(a5))
64#define efi_call_phys6(f, a1, a2, a3, a4, a5, a6) \
65 efi_call6((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3), \
66 (u64)(a4), (u64)(a5), (u64)(a6))
67
68#define efi_call_virt0(f) \
69 efi_call0((void *)(efi.systab->runtime->f))
70#define efi_call_virt1(f, a1) \
71 efi_call1((void *)(efi.systab->runtime->f), (u64)(a1))
72#define efi_call_virt2(f, a1, a2) \
73 efi_call2((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2))
74#define efi_call_virt3(f, a1, a2, a3) \
75 efi_call3((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
76 (u64)(a3))
77#define efi_call_virt4(f, a1, a2, a3, a4) \
78 efi_call4((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
79 (u64)(a3), (u64)(a4))
80#define efi_call_virt5(f, a1, a2, a3, a4, a5) \
81 efi_call5((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
82 (u64)(a3), (u64)(a4), (u64)(a5))
83#define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \
84 efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
85 (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6))
86
Paul Mackerras6a7bbd52009-08-03 22:38:10 +100087extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size,
88 u32 type);
Huang, Ying5b836832008-01-30 13:31:19 +010089
Huang, Ying5b836832008-01-30 13:31:19 +010090#endif /* CONFIG_X86_32 */
91
Jaswinder Singh Rajputcbafbc82008-12-29 20:36:40 +053092extern int add_efi_memmap;
Huang, Yingecacf092008-06-02 14:26:21 +080093extern void efi_reserve_early(void);
Huang, Ying5b836832008-01-30 13:31:19 +010094extern void efi_call_phys_prelog(void);
95extern void efi_call_phys_epilog(void);
Huang, Ying5b836832008-01-30 13:31:19 +010096
Russ Anderson7f594232008-10-03 11:59:15 -050097#ifndef CONFIG_EFI
98/*
99 * IF EFI is not configured, have the EFI calls return -ENOSYS.
100 */
101#define efi_call0(_f) (-ENOSYS)
102#define efi_call1(_f, _a1) (-ENOSYS)
103#define efi_call2(_f, _a1, _a2) (-ENOSYS)
104#define efi_call3(_f, _a1, _a2, _a3) (-ENOSYS)
105#define efi_call4(_f, _a1, _a2, _a3, _a4) (-ENOSYS)
106#define efi_call5(_f, _a1, _a2, _a3, _a4, _a5) (-ENOSYS)
107#define efi_call6(_f, _a1, _a2, _a3, _a4, _a5, _a6) (-ENOSYS)
108#endif /* CONFIG_EFI */
109
H. Peter Anvin1965aae2008-10-22 22:26:29 -0700110#endif /* _ASM_X86_EFI_H */