diff options
author | Huang, Ying <ying.huang@intel.com> | 2008-01-30 07:31:19 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:31:19 -0500 |
commit | 5b83683f32b113d07edfb67a33ce389fc624423d (patch) | |
tree | 03efde0750c9d7e477ab695aeee26173ffcc4abf /include | |
parent | 8c8b8859b64baf6d7c33900e8720c7bafe775b2c (diff) |
x86: EFI runtime service support
This patch adds basic runtime services support for EFI x86_64 system. The
main file of the patch is the addition of efi_64.c for x86_64. This file is
modeled after the EFI IA32 avatar. EFI runtime services initialization are
implemented in efi_64.c. Some x86_64 specifics are worth noting here. On
x86_64, parameters passed to EFI firmware services need to follow the EFI
calling convention. For this purpose, a set of functions named efi_call<x>
(<x> is the number of parameters) are implemented. EFI function calls are
wrapped before calling the firmware service. The duplicated code between
efi_32.c and efi_64.c is placed in efi.c to remove them from efi_32.c.
Signed-off-by: Chandramouli Narayanan <mouli@linux.intel.com>
Signed-off-by: Huang Ying <ying.huang@intel.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-x86/bootparam.h | 5 | ||||
-rw-r--r-- | include/asm-x86/efi.h | 70 | ||||
-rw-r--r-- | include/asm-x86/fixmap_64.h | 3 |
3 files changed, 76 insertions, 2 deletions
diff --git a/include/asm-x86/bootparam.h b/include/asm-x86/bootparam.h index 19f3ddf2df4b..51151356840f 100644 --- a/include/asm-x86/bootparam.h +++ b/include/asm-x86/bootparam.h | |||
@@ -54,13 +54,14 @@ struct sys_desc_table { | |||
54 | }; | 54 | }; |
55 | 55 | ||
56 | struct efi_info { | 56 | struct efi_info { |
57 | __u32 _pad1; | 57 | __u32 efi_loader_signature; |
58 | __u32 efi_systab; | 58 | __u32 efi_systab; |
59 | __u32 efi_memdesc_size; | 59 | __u32 efi_memdesc_size; |
60 | __u32 efi_memdesc_version; | 60 | __u32 efi_memdesc_version; |
61 | __u32 efi_memmap; | 61 | __u32 efi_memmap; |
62 | __u32 efi_memmap_size; | 62 | __u32 efi_memmap_size; |
63 | __u32 _pad2[2]; | 63 | __u32 efi_systab_hi; |
64 | __u32 efi_memmap_hi; | ||
64 | }; | 65 | }; |
65 | 66 | ||
66 | /* The so-called "zeropage" */ | 67 | /* The so-called "zeropage" */ |
diff --git a/include/asm-x86/efi.h b/include/asm-x86/efi.h new file mode 100644 index 000000000000..1459d3d58653 --- /dev/null +++ b/include/asm-x86/efi.h | |||
@@ -0,0 +1,70 @@ | |||
1 | #ifndef _ASM_X86_EFI_H | ||
2 | #define _ASM_X86_EFI_H | ||
3 | |||
4 | #ifdef CONFIG_X86_32 | ||
5 | #else /* !CONFIG_X86_32 */ | ||
6 | |||
7 | #define MAX_EFI_IO_PAGES 100 | ||
8 | |||
9 | extern u64 efi_call0(void *fp); | ||
10 | extern u64 efi_call1(void *fp, u64 arg1); | ||
11 | extern u64 efi_call2(void *fp, u64 arg1, u64 arg2); | ||
12 | extern u64 efi_call3(void *fp, u64 arg1, u64 arg2, u64 arg3); | ||
13 | extern u64 efi_call4(void *fp, u64 arg1, u64 arg2, u64 arg3, u64 arg4); | ||
14 | extern u64 efi_call5(void *fp, u64 arg1, u64 arg2, u64 arg3, | ||
15 | u64 arg4, u64 arg5); | ||
16 | extern u64 efi_call6(void *fp, u64 arg1, u64 arg2, u64 arg3, | ||
17 | u64 arg4, u64 arg5, u64 arg6); | ||
18 | |||
19 | #define efi_call_phys0(f) \ | ||
20 | efi_call0((void *)(f)) | ||
21 | #define efi_call_phys1(f, a1) \ | ||
22 | efi_call1((void *)(f), (u64)(a1)) | ||
23 | #define efi_call_phys2(f, a1, a2) \ | ||
24 | efi_call2((void *)(f), (u64)(a1), (u64)(a2)) | ||
25 | #define efi_call_phys3(f, a1, a2, a3) \ | ||
26 | efi_call3((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3)) | ||
27 | #define efi_call_phys4(f, a1, a2, a3, a4) \ | ||
28 | efi_call4((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3), \ | ||
29 | (u64)(a4)) | ||
30 | #define efi_call_phys5(f, a1, a2, a3, a4, a5) \ | ||
31 | efi_call5((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3), \ | ||
32 | (u64)(a4), (u64)(a5)) | ||
33 | #define efi_call_phys6(f, a1, a2, a3, a4, a5, a6) \ | ||
34 | efi_call6((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3), \ | ||
35 | (u64)(a4), (u64)(a5), (u64)(a6)) | ||
36 | |||
37 | #define efi_call_virt0(f) \ | ||
38 | efi_call0((void *)(efi.systab->runtime->f)) | ||
39 | #define efi_call_virt1(f, a1) \ | ||
40 | efi_call1((void *)(efi.systab->runtime->f), (u64)(a1)) | ||
41 | #define efi_call_virt2(f, a1, a2) \ | ||
42 | efi_call2((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2)) | ||
43 | #define efi_call_virt3(f, a1, a2, a3) \ | ||
44 | efi_call3((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ | ||
45 | (u64)(a3)) | ||
46 | #define efi_call_virt4(f, a1, a2, a3, a4) \ | ||
47 | efi_call4((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ | ||
48 | (u64)(a3), (u64)(a4)) | ||
49 | #define efi_call_virt5(f, a1, a2, a3, a4, a5) \ | ||
50 | efi_call5((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ | ||
51 | (u64)(a3), (u64)(a4), (u64)(a5)) | ||
52 | #define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \ | ||
53 | efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ | ||
54 | (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6)) | ||
55 | |||
56 | #define efi_early_ioremap(addr, size) early_ioremap(addr, size) | ||
57 | #define efi_early_iounmap(vaddr, size) early_iounmap(vaddr, size) | ||
58 | |||
59 | extern void *efi_ioremap(unsigned long offset, unsigned long size); | ||
60 | |||
61 | extern int efi_time; | ||
62 | |||
63 | #endif /* CONFIG_X86_32 */ | ||
64 | |||
65 | extern void efi_reserve_bootmem(void); | ||
66 | extern void efi_call_phys_prelog(void); | ||
67 | extern void efi_call_phys_epilog(void); | ||
68 | extern void runtime_code_page_mkexec(void); | ||
69 | |||
70 | #endif | ||
diff --git a/include/asm-x86/fixmap_64.h b/include/asm-x86/fixmap_64.h index cdfbe4a6ae6f..8f44782e5fe5 100644 --- a/include/asm-x86/fixmap_64.h +++ b/include/asm-x86/fixmap_64.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <asm/apicdef.h> | 15 | #include <asm/apicdef.h> |
16 | #include <asm/page.h> | 16 | #include <asm/page.h> |
17 | #include <asm/vsyscall.h> | 17 | #include <asm/vsyscall.h> |
18 | #include <asm/efi.h> | ||
18 | 19 | ||
19 | /* | 20 | /* |
20 | * Here we define all the compile-time 'special' virtual | 21 | * Here we define all the compile-time 'special' virtual |
@@ -41,6 +42,8 @@ enum fixed_addresses { | |||
41 | FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ | 42 | FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */ |
42 | FIX_IO_APIC_BASE_0, | 43 | FIX_IO_APIC_BASE_0, |
43 | FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1, | 44 | FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1, |
45 | FIX_EFI_IO_MAP_LAST_PAGE, | ||
46 | FIX_EFI_IO_MAP_FIRST_PAGE = FIX_EFI_IO_MAP_LAST_PAGE+MAX_EFI_IO_PAGES-1, | ||
44 | __end_of_fixed_addresses | 47 | __end_of_fixed_addresses |
45 | }; | 48 | }; |
46 | 49 | ||