diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2010-10-16 04:19:54 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2010-10-27 08:30:01 -0400 |
commit | b17ed48040d9e8b6ae35bc492015bf0fe1c8bae4 (patch) | |
tree | 64c31f66a0fc65268d02b2cee14e7abd760121e9 /arch/x86/kernel | |
parent | 937f961a6539b0ac5ebf31472b90810bc1f02200 (diff) |
x86: Move efi to platform
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Huang Ying <ying.huang@intel.com>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/Makefile | 1 | ||||
-rw-r--r-- | arch/x86/kernel/efi.c | 613 | ||||
-rw-r--r-- | arch/x86/kernel/efi_32.c | 112 | ||||
-rw-r--r-- | arch/x86/kernel/efi_64.c | 114 | ||||
-rw-r--r-- | arch/x86/kernel/efi_stub_32.S | 123 | ||||
-rw-r--r-- | arch/x86/kernel/efi_stub_64.S | 116 |
6 files changed, 0 insertions, 1079 deletions
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index d9067d10c6af..b01c7b1ac1ba 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
@@ -81,7 +81,6 @@ obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o | |||
81 | obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o | 81 | obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o |
82 | obj-$(CONFIG_KPROBES) += kprobes.o | 82 | obj-$(CONFIG_KPROBES) += kprobes.o |
83 | obj-$(CONFIG_MODULES) += module.o | 83 | obj-$(CONFIG_MODULES) += module.o |
84 | obj-$(CONFIG_EFI) += efi.o efi_$(BITS).o efi_stub_$(BITS).o | ||
85 | obj-$(CONFIG_DOUBLEFAULT) += doublefault_32.o | 84 | obj-$(CONFIG_DOUBLEFAULT) += doublefault_32.o |
86 | obj-$(CONFIG_KGDB) += kgdb.o | 85 | obj-$(CONFIG_KGDB) += kgdb.o |
87 | obj-$(CONFIG_VM86) += vm86_32.o | 86 | obj-$(CONFIG_VM86) += vm86_32.o |
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c deleted file mode 100644 index 0fe27d7c6258..000000000000 --- a/arch/x86/kernel/efi.c +++ /dev/null | |||
@@ -1,613 +0,0 @@ | |||
1 | /* | ||
2 | * Common EFI (Extensible Firmware Interface) support functions | ||
3 | * Based on Extensible Firmware Interface Specification version 1.0 | ||
4 | * | ||
5 | * Copyright (C) 1999 VA Linux Systems | ||
6 | * Copyright (C) 1999 Walt Drummond <drummond@valinux.com> | ||
7 | * Copyright (C) 1999-2002 Hewlett-Packard Co. | ||
8 | * David Mosberger-Tang <davidm@hpl.hp.com> | ||
9 | * Stephane Eranian <eranian@hpl.hp.com> | ||
10 | * Copyright (C) 2005-2008 Intel Co. | ||
11 | * Fenghua Yu <fenghua.yu@intel.com> | ||
12 | * Bibo Mao <bibo.mao@intel.com> | ||
13 | * Chandramouli Narayanan <mouli@linux.intel.com> | ||
14 | * Huang Ying <ying.huang@intel.com> | ||
15 | * | ||
16 | * Copied from efi_32.c to eliminate the duplicated code between EFI | ||
17 | * 32/64 support code. --ying 2007-10-26 | ||
18 | * | ||
19 | * All EFI Runtime Services are not implemented yet as EFI only | ||
20 | * supports physical mode addressing on SoftSDV. This is to be fixed | ||
21 | * in a future version. --drummond 1999-07-20 | ||
22 | * | ||
23 | * Implemented EFI runtime services and virtual mode calls. --davidm | ||
24 | * | ||
25 | * Goutham Rao: <goutham.rao@intel.com> | ||
26 | * Skip non-WB memory and ignore empty memory ranges. | ||
27 | */ | ||
28 | |||
29 | #include <linux/kernel.h> | ||
30 | #include <linux/init.h> | ||
31 | #include <linux/efi.h> | ||
32 | #include <linux/bootmem.h> | ||
33 | #include <linux/memblock.h> | ||
34 | #include <linux/spinlock.h> | ||
35 | #include <linux/uaccess.h> | ||
36 | #include <linux/time.h> | ||
37 | #include <linux/io.h> | ||
38 | #include <linux/reboot.h> | ||
39 | #include <linux/bcd.h> | ||
40 | |||
41 | #include <asm/setup.h> | ||
42 | #include <asm/efi.h> | ||
43 | #include <asm/time.h> | ||
44 | #include <asm/cacheflush.h> | ||
45 | #include <asm/tlbflush.h> | ||
46 | #include <asm/x86_init.h> | ||
47 | |||
48 | #define EFI_DEBUG 1 | ||
49 | #define PFX "EFI: " | ||
50 | |||
51 | int efi_enabled; | ||
52 | EXPORT_SYMBOL(efi_enabled); | ||
53 | |||
54 | struct efi efi; | ||
55 | EXPORT_SYMBOL(efi); | ||
56 | |||
57 | struct efi_memory_map memmap; | ||
58 | |||
59 | static struct efi efi_phys __initdata; | ||
60 | static efi_system_table_t efi_systab __initdata; | ||
61 | |||
62 | static int __init setup_noefi(char *arg) | ||
63 | { | ||
64 | efi_enabled = 0; | ||
65 | return 0; | ||
66 | } | ||
67 | early_param("noefi", setup_noefi); | ||
68 | |||
69 | int add_efi_memmap; | ||
70 | EXPORT_SYMBOL(add_efi_memmap); | ||
71 | |||
72 | static int __init setup_add_efi_memmap(char *arg) | ||
73 | { | ||
74 | add_efi_memmap = 1; | ||
75 | return 0; | ||
76 | } | ||
77 | early_param("add_efi_memmap", setup_add_efi_memmap); | ||
78 | |||
79 | |||
80 | static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) | ||
81 | { | ||
82 | return efi_call_virt2(get_time, tm, tc); | ||
83 | } | ||
84 | |||
85 | static efi_status_t virt_efi_set_time(efi_time_t *tm) | ||
86 | { | ||
87 | return efi_call_virt1(set_time, tm); | ||
88 | } | ||
89 | |||
90 | static efi_status_t virt_efi_get_wakeup_time(efi_bool_t *enabled, | ||
91 | efi_bool_t *pending, | ||
92 | efi_time_t *tm) | ||
93 | { | ||
94 | return efi_call_virt3(get_wakeup_time, | ||
95 | enabled, pending, tm); | ||
96 | } | ||
97 | |||
98 | static efi_status_t virt_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm) | ||
99 | { | ||
100 | return efi_call_virt2(set_wakeup_time, | ||
101 | enabled, tm); | ||
102 | } | ||
103 | |||
104 | static efi_status_t virt_efi_get_variable(efi_char16_t *name, | ||
105 | efi_guid_t *vendor, | ||
106 | u32 *attr, | ||
107 | unsigned long *data_size, | ||
108 | void *data) | ||
109 | { | ||
110 | return efi_call_virt5(get_variable, | ||
111 | name, vendor, attr, | ||
112 | data_size, data); | ||
113 | } | ||
114 | |||
115 | static efi_status_t virt_efi_get_next_variable(unsigned long *name_size, | ||
116 | efi_char16_t *name, | ||
117 | efi_guid_t *vendor) | ||
118 | { | ||
119 | return efi_call_virt3(get_next_variable, | ||
120 | name_size, name, vendor); | ||
121 | } | ||
122 | |||
123 | static efi_status_t virt_efi_set_variable(efi_char16_t *name, | ||
124 | efi_guid_t *vendor, | ||
125 | unsigned long attr, | ||
126 | unsigned long data_size, | ||
127 | void *data) | ||
128 | { | ||
129 | return efi_call_virt5(set_variable, | ||
130 | name, vendor, attr, | ||
131 | data_size, data); | ||
132 | } | ||
133 | |||
134 | static efi_status_t virt_efi_get_next_high_mono_count(u32 *count) | ||
135 | { | ||
136 | return efi_call_virt1(get_next_high_mono_count, count); | ||
137 | } | ||
138 | |||
139 | static void virt_efi_reset_system(int reset_type, | ||
140 | efi_status_t status, | ||
141 | unsigned long data_size, | ||
142 | efi_char16_t *data) | ||
143 | { | ||
144 | efi_call_virt4(reset_system, reset_type, status, | ||
145 | data_size, data); | ||
146 | } | ||
147 | |||
148 | static efi_status_t virt_efi_set_virtual_address_map( | ||
149 | unsigned long memory_map_size, | ||
150 | unsigned long descriptor_size, | ||
151 | u32 descriptor_version, | ||
152 | efi_memory_desc_t *virtual_map) | ||
153 | { | ||
154 | return efi_call_virt4(set_virtual_address_map, | ||
155 | memory_map_size, descriptor_size, | ||
156 | descriptor_version, virtual_map); | ||
157 | } | ||
158 | |||
159 | static efi_status_t __init phys_efi_set_virtual_address_map( | ||
160 | unsigned long memory_map_size, | ||
161 | unsigned long descriptor_size, | ||
162 | u32 descriptor_version, | ||
163 | efi_memory_desc_t *virtual_map) | ||
164 | { | ||
165 | efi_status_t status; | ||
166 | |||
167 | efi_call_phys_prelog(); | ||
168 | status = efi_call_phys4(efi_phys.set_virtual_address_map, | ||
169 | memory_map_size, descriptor_size, | ||
170 | descriptor_version, virtual_map); | ||
171 | efi_call_phys_epilog(); | ||
172 | return status; | ||
173 | } | ||
174 | |||
175 | static efi_status_t __init phys_efi_get_time(efi_time_t *tm, | ||
176 | efi_time_cap_t *tc) | ||
177 | { | ||
178 | efi_status_t status; | ||
179 | |||
180 | efi_call_phys_prelog(); | ||
181 | status = efi_call_phys2(efi_phys.get_time, tm, tc); | ||
182 | efi_call_phys_epilog(); | ||
183 | return status; | ||
184 | } | ||
185 | |||
186 | int efi_set_rtc_mmss(unsigned long nowtime) | ||
187 | { | ||
188 | int real_seconds, real_minutes; | ||
189 | efi_status_t status; | ||
190 | efi_time_t eft; | ||
191 | efi_time_cap_t cap; | ||
192 | |||
193 | status = efi.get_time(&eft, &cap); | ||
194 | if (status != EFI_SUCCESS) { | ||
195 | printk(KERN_ERR "Oops: efitime: can't read time!\n"); | ||
196 | return -1; | ||
197 | } | ||
198 | |||
199 | real_seconds = nowtime % 60; | ||
200 | real_minutes = nowtime / 60; | ||
201 | if (((abs(real_minutes - eft.minute) + 15)/30) & 1) | ||
202 | real_minutes += 30; | ||
203 | real_minutes %= 60; | ||
204 | eft.minute = real_minutes; | ||
205 | eft.second = real_seconds; | ||
206 | |||
207 | status = efi.set_time(&eft); | ||
208 | if (status != EFI_SUCCESS) { | ||
209 | printk(KERN_ERR "Oops: efitime: can't write time!\n"); | ||
210 | return -1; | ||
211 | } | ||
212 | return 0; | ||
213 | } | ||
214 | |||
215 | unsigned long efi_get_time(void) | ||
216 | { | ||
217 | efi_status_t status; | ||
218 | efi_time_t eft; | ||
219 | efi_time_cap_t cap; | ||
220 | |||
221 | status = efi.get_time(&eft, &cap); | ||
222 | if (status != EFI_SUCCESS) | ||
223 | printk(KERN_ERR "Oops: efitime: can't read time!\n"); | ||
224 | |||
225 | return mktime(eft.year, eft.month, eft.day, eft.hour, | ||
226 | eft.minute, eft.second); | ||
227 | } | ||
228 | |||
229 | /* | ||
230 | * Tell the kernel about the EFI memory map. This might include | ||
231 | * more than the max 128 entries that can fit in the e820 legacy | ||
232 | * (zeropage) memory map. | ||
233 | */ | ||
234 | |||
235 | static void __init do_add_efi_memmap(void) | ||
236 | { | ||
237 | void *p; | ||
238 | |||
239 | for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { | ||
240 | efi_memory_desc_t *md = p; | ||
241 | unsigned long long start = md->phys_addr; | ||
242 | unsigned long long size = md->num_pages << EFI_PAGE_SHIFT; | ||
243 | int e820_type; | ||
244 | |||
245 | switch (md->type) { | ||
246 | case EFI_LOADER_CODE: | ||
247 | case EFI_LOADER_DATA: | ||
248 | case EFI_BOOT_SERVICES_CODE: | ||
249 | case EFI_BOOT_SERVICES_DATA: | ||
250 | case EFI_CONVENTIONAL_MEMORY: | ||
251 | if (md->attribute & EFI_MEMORY_WB) | ||
252 | e820_type = E820_RAM; | ||
253 | else | ||
254 | e820_type = E820_RESERVED; | ||
255 | break; | ||
256 | case EFI_ACPI_RECLAIM_MEMORY: | ||
257 | e820_type = E820_ACPI; | ||
258 | break; | ||
259 | case EFI_ACPI_MEMORY_NVS: | ||
260 | e820_type = E820_NVS; | ||
261 | break; | ||
262 | case EFI_UNUSABLE_MEMORY: | ||
263 | e820_type = E820_UNUSABLE; | ||
264 | break; | ||
265 | default: | ||
266 | /* | ||
267 | * EFI_RESERVED_TYPE EFI_RUNTIME_SERVICES_CODE | ||
268 | * EFI_RUNTIME_SERVICES_DATA EFI_MEMORY_MAPPED_IO | ||
269 | * EFI_MEMORY_MAPPED_IO_PORT_SPACE EFI_PAL_CODE | ||
270 | */ | ||
271 | e820_type = E820_RESERVED; | ||
272 | break; | ||
273 | } | ||
274 | e820_add_region(start, size, e820_type); | ||
275 | } | ||
276 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | ||
277 | } | ||
278 | |||
279 | void __init efi_memblock_x86_reserve_range(void) | ||
280 | { | ||
281 | unsigned long pmap; | ||
282 | |||
283 | #ifdef CONFIG_X86_32 | ||
284 | pmap = boot_params.efi_info.efi_memmap; | ||
285 | #else | ||
286 | pmap = (boot_params.efi_info.efi_memmap | | ||
287 | ((__u64)boot_params.efi_info.efi_memmap_hi<<32)); | ||
288 | #endif | ||
289 | memmap.phys_map = (void *)pmap; | ||
290 | memmap.nr_map = boot_params.efi_info.efi_memmap_size / | ||
291 | boot_params.efi_info.efi_memdesc_size; | ||
292 | memmap.desc_version = boot_params.efi_info.efi_memdesc_version; | ||
293 | memmap.desc_size = boot_params.efi_info.efi_memdesc_size; | ||
294 | memblock_x86_reserve_range(pmap, pmap + memmap.nr_map * memmap.desc_size, | ||
295 | "EFI memmap"); | ||
296 | } | ||
297 | |||
298 | #if EFI_DEBUG | ||
299 | static void __init print_efi_memmap(void) | ||
300 | { | ||
301 | efi_memory_desc_t *md; | ||
302 | void *p; | ||
303 | int i; | ||
304 | |||
305 | for (p = memmap.map, i = 0; | ||
306 | p < memmap.map_end; | ||
307 | p += memmap.desc_size, i++) { | ||
308 | md = p; | ||
309 | printk(KERN_INFO PFX "mem%02u: type=%u, attr=0x%llx, " | ||
310 | "range=[0x%016llx-0x%016llx) (%lluMB)\n", | ||
311 | i, md->type, md->attribute, md->phys_addr, | ||
312 | md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT), | ||
313 | (md->num_pages >> (20 - EFI_PAGE_SHIFT))); | ||
314 | } | ||
315 | } | ||
316 | #endif /* EFI_DEBUG */ | ||
317 | |||
318 | void __init efi_init(void) | ||
319 | { | ||
320 | efi_config_table_t *config_tables; | ||
321 | efi_runtime_services_t *runtime; | ||
322 | efi_char16_t *c16; | ||
323 | char vendor[100] = "unknown"; | ||
324 | int i = 0; | ||
325 | void *tmp; | ||
326 | |||
327 | #ifdef CONFIG_X86_32 | ||
328 | efi_phys.systab = (efi_system_table_t *)boot_params.efi_info.efi_systab; | ||
329 | #else | ||
330 | efi_phys.systab = (efi_system_table_t *) | ||
331 | (boot_params.efi_info.efi_systab | | ||
332 | ((__u64)boot_params.efi_info.efi_systab_hi<<32)); | ||
333 | #endif | ||
334 | |||
335 | efi.systab = early_ioremap((unsigned long)efi_phys.systab, | ||
336 | sizeof(efi_system_table_t)); | ||
337 | if (efi.systab == NULL) | ||
338 | printk(KERN_ERR "Couldn't map the EFI system table!\n"); | ||
339 | memcpy(&efi_systab, efi.systab, sizeof(efi_system_table_t)); | ||
340 | early_iounmap(efi.systab, sizeof(efi_system_table_t)); | ||
341 | efi.systab = &efi_systab; | ||
342 | |||
343 | /* | ||
344 | * Verify the EFI Table | ||
345 | */ | ||
346 | if (efi.systab->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE) | ||
347 | printk(KERN_ERR "EFI system table signature incorrect!\n"); | ||
348 | if ((efi.systab->hdr.revision >> 16) == 0) | ||
349 | printk(KERN_ERR "Warning: EFI system table version " | ||
350 | "%d.%02d, expected 1.00 or greater!\n", | ||
351 | efi.systab->hdr.revision >> 16, | ||
352 | efi.systab->hdr.revision & 0xffff); | ||
353 | |||
354 | /* | ||
355 | * Show what we know for posterity | ||
356 | */ | ||
357 | c16 = tmp = early_ioremap(efi.systab->fw_vendor, 2); | ||
358 | if (c16) { | ||
359 | for (i = 0; i < sizeof(vendor) - 1 && *c16; ++i) | ||
360 | vendor[i] = *c16++; | ||
361 | vendor[i] = '\0'; | ||
362 | } else | ||
363 | printk(KERN_ERR PFX "Could not map the firmware vendor!\n"); | ||
364 | early_iounmap(tmp, 2); | ||
365 | |||
366 | printk(KERN_INFO "EFI v%u.%.02u by %s\n", | ||
367 | efi.systab->hdr.revision >> 16, | ||
368 | efi.systab->hdr.revision & 0xffff, vendor); | ||
369 | |||
370 | /* | ||
371 | * Let's see what config tables the firmware passed to us. | ||
372 | */ | ||
373 | config_tables = early_ioremap( | ||
374 | efi.systab->tables, | ||
375 | efi.systab->nr_tables * sizeof(efi_config_table_t)); | ||
376 | if (config_tables == NULL) | ||
377 | printk(KERN_ERR "Could not map EFI Configuration Table!\n"); | ||
378 | |||
379 | printk(KERN_INFO); | ||
380 | for (i = 0; i < efi.systab->nr_tables; i++) { | ||
381 | if (!efi_guidcmp(config_tables[i].guid, MPS_TABLE_GUID)) { | ||
382 | efi.mps = config_tables[i].table; | ||
383 | printk(" MPS=0x%lx ", config_tables[i].table); | ||
384 | } else if (!efi_guidcmp(config_tables[i].guid, | ||
385 | ACPI_20_TABLE_GUID)) { | ||
386 | efi.acpi20 = config_tables[i].table; | ||
387 | printk(" ACPI 2.0=0x%lx ", config_tables[i].table); | ||
388 | } else if (!efi_guidcmp(config_tables[i].guid, | ||
389 | ACPI_TABLE_GUID)) { | ||
390 | efi.acpi = config_tables[i].table; | ||
391 | printk(" ACPI=0x%lx ", config_tables[i].table); | ||
392 | } else if (!efi_guidcmp(config_tables[i].guid, | ||
393 | SMBIOS_TABLE_GUID)) { | ||
394 | efi.smbios = config_tables[i].table; | ||
395 | printk(" SMBIOS=0x%lx ", config_tables[i].table); | ||
396 | #ifdef CONFIG_X86_UV | ||
397 | } else if (!efi_guidcmp(config_tables[i].guid, | ||
398 | UV_SYSTEM_TABLE_GUID)) { | ||
399 | efi.uv_systab = config_tables[i].table; | ||
400 | printk(" UVsystab=0x%lx ", config_tables[i].table); | ||
401 | #endif | ||
402 | } else if (!efi_guidcmp(config_tables[i].guid, | ||
403 | HCDP_TABLE_GUID)) { | ||
404 | efi.hcdp = config_tables[i].table; | ||
405 | printk(" HCDP=0x%lx ", config_tables[i].table); | ||
406 | } else if (!efi_guidcmp(config_tables[i].guid, | ||
407 | UGA_IO_PROTOCOL_GUID)) { | ||
408 | efi.uga = config_tables[i].table; | ||
409 | printk(" UGA=0x%lx ", config_tables[i].table); | ||
410 | } | ||
411 | } | ||
412 | printk("\n"); | ||
413 | early_iounmap(config_tables, | ||
414 | efi.systab->nr_tables * sizeof(efi_config_table_t)); | ||
415 | |||
416 | /* | ||
417 | * Check out the runtime services table. We need to map | ||
418 | * the runtime services table so that we can grab the physical | ||
419 | * address of several of the EFI runtime functions, needed to | ||
420 | * set the firmware into virtual mode. | ||
421 | */ | ||
422 | runtime = early_ioremap((unsigned long)efi.systab->runtime, | ||
423 | sizeof(efi_runtime_services_t)); | ||
424 | if (runtime != NULL) { | ||
425 | /* | ||
426 | * We will only need *early* access to the following | ||
427 | * two EFI runtime services before set_virtual_address_map | ||
428 | * is invoked. | ||
429 | */ | ||
430 | efi_phys.get_time = (efi_get_time_t *)runtime->get_time; | ||
431 | efi_phys.set_virtual_address_map = | ||
432 | (efi_set_virtual_address_map_t *) | ||
433 | runtime->set_virtual_address_map; | ||
434 | /* | ||
435 | * Make efi_get_time can be called before entering | ||
436 | * virtual mode. | ||
437 | */ | ||
438 | efi.get_time = phys_efi_get_time; | ||
439 | } else | ||
440 | printk(KERN_ERR "Could not map the EFI runtime service " | ||
441 | "table!\n"); | ||
442 | early_iounmap(runtime, sizeof(efi_runtime_services_t)); | ||
443 | |||
444 | /* Map the EFI memory map */ | ||
445 | memmap.map = early_ioremap((unsigned long)memmap.phys_map, | ||
446 | memmap.nr_map * memmap.desc_size); | ||
447 | if (memmap.map == NULL) | ||
448 | printk(KERN_ERR "Could not map the EFI memory map!\n"); | ||
449 | memmap.map_end = memmap.map + (memmap.nr_map * memmap.desc_size); | ||
450 | |||
451 | if (memmap.desc_size != sizeof(efi_memory_desc_t)) | ||
452 | printk(KERN_WARNING | ||
453 | "Kernel-defined memdesc doesn't match the one from EFI!\n"); | ||
454 | |||
455 | if (add_efi_memmap) | ||
456 | do_add_efi_memmap(); | ||
457 | |||
458 | #ifdef CONFIG_X86_32 | ||
459 | x86_platform.get_wallclock = efi_get_time; | ||
460 | x86_platform.set_wallclock = efi_set_rtc_mmss; | ||
461 | #endif | ||
462 | |||
463 | /* Setup for EFI runtime service */ | ||
464 | reboot_type = BOOT_EFI; | ||
465 | |||
466 | #if EFI_DEBUG | ||
467 | print_efi_memmap(); | ||
468 | #endif | ||
469 | } | ||
470 | |||
471 | static void __init runtime_code_page_mkexec(void) | ||
472 | { | ||
473 | efi_memory_desc_t *md; | ||
474 | void *p; | ||
475 | u64 addr, npages; | ||
476 | |||
477 | /* Make EFI runtime service code area executable */ | ||
478 | for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { | ||
479 | md = p; | ||
480 | |||
481 | if (md->type != EFI_RUNTIME_SERVICES_CODE) | ||
482 | continue; | ||
483 | |||
484 | addr = md->virt_addr; | ||
485 | npages = md->num_pages; | ||
486 | memrange_efi_to_native(&addr, &npages); | ||
487 | set_memory_x(addr, npages); | ||
488 | } | ||
489 | } | ||
490 | |||
491 | /* | ||
492 | * This function will switch the EFI runtime services to virtual mode. | ||
493 | * Essentially, look through the EFI memmap and map every region that | ||
494 | * has the runtime attribute bit set in its memory descriptor and update | ||
495 | * that memory descriptor with the virtual address obtained from ioremap(). | ||
496 | * This enables the runtime services to be called without having to | ||
497 | * thunk back into physical mode for every invocation. | ||
498 | */ | ||
499 | void __init efi_enter_virtual_mode(void) | ||
500 | { | ||
501 | efi_memory_desc_t *md; | ||
502 | efi_status_t status; | ||
503 | unsigned long size; | ||
504 | u64 end, systab, addr, npages, end_pfn; | ||
505 | void *p, *va; | ||
506 | |||
507 | efi.systab = NULL; | ||
508 | for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { | ||
509 | md = p; | ||
510 | if (!(md->attribute & EFI_MEMORY_RUNTIME)) | ||
511 | continue; | ||
512 | |||
513 | size = md->num_pages << EFI_PAGE_SHIFT; | ||
514 | end = md->phys_addr + size; | ||
515 | |||
516 | end_pfn = PFN_UP(end); | ||
517 | if (end_pfn <= max_low_pfn_mapped | ||
518 | || (end_pfn > (1UL << (32 - PAGE_SHIFT)) | ||
519 | && end_pfn <= max_pfn_mapped)) | ||
520 | va = __va(md->phys_addr); | ||
521 | else | ||
522 | va = efi_ioremap(md->phys_addr, size, md->type); | ||
523 | |||
524 | md->virt_addr = (u64) (unsigned long) va; | ||
525 | |||
526 | if (!va) { | ||
527 | printk(KERN_ERR PFX "ioremap of 0x%llX failed!\n", | ||
528 | (unsigned long long)md->phys_addr); | ||
529 | continue; | ||
530 | } | ||
531 | |||
532 | if (!(md->attribute & EFI_MEMORY_WB)) { | ||
533 | addr = md->virt_addr; | ||
534 | npages = md->num_pages; | ||
535 | memrange_efi_to_native(&addr, &npages); | ||
536 | set_memory_uc(addr, npages); | ||
537 | } | ||
538 | |||
539 | systab = (u64) (unsigned long) efi_phys.systab; | ||
540 | if (md->phys_addr <= systab && systab < end) { | ||
541 | systab += md->virt_addr - md->phys_addr; | ||
542 | efi.systab = (efi_system_table_t *) (unsigned long) systab; | ||
543 | } | ||
544 | } | ||
545 | |||
546 | BUG_ON(!efi.systab); | ||
547 | |||
548 | status = phys_efi_set_virtual_address_map( | ||
549 | memmap.desc_size * memmap.nr_map, | ||
550 | memmap.desc_size, | ||
551 | memmap.desc_version, | ||
552 | memmap.phys_map); | ||
553 | |||
554 | if (status != EFI_SUCCESS) { | ||
555 | printk(KERN_ALERT "Unable to switch EFI into virtual mode " | ||
556 | "(status=%lx)!\n", status); | ||
557 | panic("EFI call to SetVirtualAddressMap() failed!"); | ||
558 | } | ||
559 | |||
560 | /* | ||
561 | * Now that EFI is in virtual mode, update the function | ||
562 | * pointers in the runtime service table to the new virtual addresses. | ||
563 | * | ||
564 | * Call EFI services through wrapper functions. | ||
565 | */ | ||
566 | efi.get_time = virt_efi_get_time; | ||
567 | efi.set_time = virt_efi_set_time; | ||
568 | efi.get_wakeup_time = virt_efi_get_wakeup_time; | ||
569 | efi.set_wakeup_time = virt_efi_set_wakeup_time; | ||
570 | efi.get_variable = virt_efi_get_variable; | ||
571 | efi.get_next_variable = virt_efi_get_next_variable; | ||
572 | efi.set_variable = virt_efi_set_variable; | ||
573 | efi.get_next_high_mono_count = virt_efi_get_next_high_mono_count; | ||
574 | efi.reset_system = virt_efi_reset_system; | ||
575 | efi.set_virtual_address_map = virt_efi_set_virtual_address_map; | ||
576 | if (__supported_pte_mask & _PAGE_NX) | ||
577 | runtime_code_page_mkexec(); | ||
578 | early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size); | ||
579 | memmap.map = NULL; | ||
580 | } | ||
581 | |||
582 | /* | ||
583 | * Convenience functions to obtain memory types and attributes | ||
584 | */ | ||
585 | u32 efi_mem_type(unsigned long phys_addr) | ||
586 | { | ||
587 | efi_memory_desc_t *md; | ||
588 | void *p; | ||
589 | |||
590 | for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { | ||
591 | md = p; | ||
592 | if ((md->phys_addr <= phys_addr) && | ||
593 | (phys_addr < (md->phys_addr + | ||
594 | (md->num_pages << EFI_PAGE_SHIFT)))) | ||
595 | return md->type; | ||
596 | } | ||
597 | return 0; | ||
598 | } | ||
599 | |||
600 | u64 efi_mem_attributes(unsigned long phys_addr) | ||
601 | { | ||
602 | efi_memory_desc_t *md; | ||
603 | void *p; | ||
604 | |||
605 | for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { | ||
606 | md = p; | ||
607 | if ((md->phys_addr <= phys_addr) && | ||
608 | (phys_addr < (md->phys_addr + | ||
609 | (md->num_pages << EFI_PAGE_SHIFT)))) | ||
610 | return md->attribute; | ||
611 | } | ||
612 | return 0; | ||
613 | } | ||
diff --git a/arch/x86/kernel/efi_32.c b/arch/x86/kernel/efi_32.c deleted file mode 100644 index 5cab48ee61a4..000000000000 --- a/arch/x86/kernel/efi_32.c +++ /dev/null | |||
@@ -1,112 +0,0 @@ | |||
1 | /* | ||
2 | * Extensible Firmware Interface | ||
3 | * | ||
4 | * Based on Extensible Firmware Interface Specification version 1.0 | ||
5 | * | ||
6 | * Copyright (C) 1999 VA Linux Systems | ||
7 | * Copyright (C) 1999 Walt Drummond <drummond@valinux.com> | ||
8 | * Copyright (C) 1999-2002 Hewlett-Packard Co. | ||
9 | * David Mosberger-Tang <davidm@hpl.hp.com> | ||
10 | * Stephane Eranian <eranian@hpl.hp.com> | ||
11 | * | ||
12 | * All EFI Runtime Services are not implemented yet as EFI only | ||
13 | * supports physical mode addressing on SoftSDV. This is to be fixed | ||
14 | * in a future version. --drummond 1999-07-20 | ||
15 | * | ||
16 | * Implemented EFI runtime services and virtual mode calls. --davidm | ||
17 | * | ||
18 | * Goutham Rao: <goutham.rao@intel.com> | ||
19 | * Skip non-WB memory and ignore empty memory ranges. | ||
20 | */ | ||
21 | |||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/types.h> | ||
24 | #include <linux/ioport.h> | ||
25 | #include <linux/efi.h> | ||
26 | |||
27 | #include <asm/io.h> | ||
28 | #include <asm/page.h> | ||
29 | #include <asm/pgtable.h> | ||
30 | #include <asm/tlbflush.h> | ||
31 | #include <asm/efi.h> | ||
32 | |||
33 | /* | ||
34 | * To make EFI call EFI runtime service in physical addressing mode we need | ||
35 | * prelog/epilog before/after the invocation to disable interrupt, to | ||
36 | * claim EFI runtime service handler exclusively and to duplicate a memory in | ||
37 | * low memory space say 0 - 3G. | ||
38 | */ | ||
39 | |||
40 | static unsigned long efi_rt_eflags; | ||
41 | static pgd_t efi_bak_pg_dir_pointer[2]; | ||
42 | |||
43 | void efi_call_phys_prelog(void) | ||
44 | { | ||
45 | unsigned long cr4; | ||
46 | unsigned long temp; | ||
47 | struct desc_ptr gdt_descr; | ||
48 | |||
49 | local_irq_save(efi_rt_eflags); | ||
50 | |||
51 | /* | ||
52 | * If I don't have PAE, I should just duplicate two entries in page | ||
53 | * directory. If I have PAE, I just need to duplicate one entry in | ||
54 | * page directory. | ||
55 | */ | ||
56 | cr4 = read_cr4_safe(); | ||
57 | |||
58 | if (cr4 & X86_CR4_PAE) { | ||
59 | efi_bak_pg_dir_pointer[0].pgd = | ||
60 | swapper_pg_dir[pgd_index(0)].pgd; | ||
61 | swapper_pg_dir[0].pgd = | ||
62 | swapper_pg_dir[pgd_index(PAGE_OFFSET)].pgd; | ||
63 | } else { | ||
64 | efi_bak_pg_dir_pointer[0].pgd = | ||
65 | swapper_pg_dir[pgd_index(0)].pgd; | ||
66 | efi_bak_pg_dir_pointer[1].pgd = | ||
67 | swapper_pg_dir[pgd_index(0x400000)].pgd; | ||
68 | swapper_pg_dir[pgd_index(0)].pgd = | ||
69 | swapper_pg_dir[pgd_index(PAGE_OFFSET)].pgd; | ||
70 | temp = PAGE_OFFSET + 0x400000; | ||
71 | swapper_pg_dir[pgd_index(0x400000)].pgd = | ||
72 | swapper_pg_dir[pgd_index(temp)].pgd; | ||
73 | } | ||
74 | |||
75 | /* | ||
76 | * After the lock is released, the original page table is restored. | ||
77 | */ | ||
78 | __flush_tlb_all(); | ||
79 | |||
80 | gdt_descr.address = __pa(get_cpu_gdt_table(0)); | ||
81 | gdt_descr.size = GDT_SIZE - 1; | ||
82 | load_gdt(&gdt_descr); | ||
83 | } | ||
84 | |||
85 | void efi_call_phys_epilog(void) | ||
86 | { | ||
87 | unsigned long cr4; | ||
88 | struct desc_ptr gdt_descr; | ||
89 | |||
90 | gdt_descr.address = (unsigned long)get_cpu_gdt_table(0); | ||
91 | gdt_descr.size = GDT_SIZE - 1; | ||
92 | load_gdt(&gdt_descr); | ||
93 | |||
94 | cr4 = read_cr4_safe(); | ||
95 | |||
96 | if (cr4 & X86_CR4_PAE) { | ||
97 | swapper_pg_dir[pgd_index(0)].pgd = | ||
98 | efi_bak_pg_dir_pointer[0].pgd; | ||
99 | } else { | ||
100 | swapper_pg_dir[pgd_index(0)].pgd = | ||
101 | efi_bak_pg_dir_pointer[0].pgd; | ||
102 | swapper_pg_dir[pgd_index(0x400000)].pgd = | ||
103 | efi_bak_pg_dir_pointer[1].pgd; | ||
104 | } | ||
105 | |||
106 | /* | ||
107 | * After the lock is released, the original page table is restored. | ||
108 | */ | ||
109 | __flush_tlb_all(); | ||
110 | |||
111 | local_irq_restore(efi_rt_eflags); | ||
112 | } | ||
diff --git a/arch/x86/kernel/efi_64.c b/arch/x86/kernel/efi_64.c deleted file mode 100644 index ac0621a7ac3d..000000000000 --- a/arch/x86/kernel/efi_64.c +++ /dev/null | |||
@@ -1,114 +0,0 @@ | |||
1 | /* | ||
2 | * x86_64 specific EFI support functions | ||
3 | * Based on Extensible Firmware Interface Specification version 1.0 | ||
4 | * | ||
5 | * Copyright (C) 2005-2008 Intel Co. | ||
6 | * Fenghua Yu <fenghua.yu@intel.com> | ||
7 | * Bibo Mao <bibo.mao@intel.com> | ||
8 | * Chandramouli Narayanan <mouli@linux.intel.com> | ||
9 | * Huang Ying <ying.huang@intel.com> | ||
10 | * | ||
11 | * Code to convert EFI to E820 map has been implemented in elilo bootloader | ||
12 | * based on a EFI patch by Edgar Hucek. Based on the E820 map, the page table | ||
13 | * is setup appropriately for EFI runtime code. | ||
14 | * - mouli 06/14/2007. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <linux/kernel.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/mm.h> | ||
21 | #include <linux/types.h> | ||
22 | #include <linux/spinlock.h> | ||
23 | #include <linux/bootmem.h> | ||
24 | #include <linux/ioport.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/efi.h> | ||
27 | #include <linux/uaccess.h> | ||
28 | #include <linux/io.h> | ||
29 | #include <linux/reboot.h> | ||
30 | |||
31 | #include <asm/setup.h> | ||
32 | #include <asm/page.h> | ||
33 | #include <asm/e820.h> | ||
34 | #include <asm/pgtable.h> | ||
35 | #include <asm/tlbflush.h> | ||
36 | #include <asm/proto.h> | ||
37 | #include <asm/efi.h> | ||
38 | #include <asm/cacheflush.h> | ||
39 | #include <asm/fixmap.h> | ||
40 | |||
41 | static pgd_t save_pgd __initdata; | ||
42 | static unsigned long efi_flags __initdata; | ||
43 | |||
44 | static void __init early_mapping_set_exec(unsigned long start, | ||
45 | unsigned long end, | ||
46 | int executable) | ||
47 | { | ||
48 | unsigned long num_pages; | ||
49 | |||
50 | start &= PMD_MASK; | ||
51 | end = (end + PMD_SIZE - 1) & PMD_MASK; | ||
52 | num_pages = (end - start) >> PAGE_SHIFT; | ||
53 | if (executable) | ||
54 | set_memory_x((unsigned long)__va(start), num_pages); | ||
55 | else | ||
56 | set_memory_nx((unsigned long)__va(start), num_pages); | ||
57 | } | ||
58 | |||
59 | static void __init early_runtime_code_mapping_set_exec(int executable) | ||
60 | { | ||
61 | efi_memory_desc_t *md; | ||
62 | void *p; | ||
63 | |||
64 | if (!(__supported_pte_mask & _PAGE_NX)) | ||
65 | return; | ||
66 | |||
67 | /* Make EFI runtime service code area executable */ | ||
68 | for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { | ||
69 | md = p; | ||
70 | if (md->type == EFI_RUNTIME_SERVICES_CODE) { | ||
71 | unsigned long end; | ||
72 | end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT); | ||
73 | early_mapping_set_exec(md->phys_addr, end, executable); | ||
74 | } | ||
75 | } | ||
76 | } | ||
77 | |||
78 | void __init efi_call_phys_prelog(void) | ||
79 | { | ||
80 | unsigned long vaddress; | ||
81 | |||
82 | early_runtime_code_mapping_set_exec(1); | ||
83 | local_irq_save(efi_flags); | ||
84 | vaddress = (unsigned long)__va(0x0UL); | ||
85 | save_pgd = *pgd_offset_k(0x0UL); | ||
86 | set_pgd(pgd_offset_k(0x0UL), *pgd_offset_k(vaddress)); | ||
87 | __flush_tlb_all(); | ||
88 | } | ||
89 | |||
90 | void __init efi_call_phys_epilog(void) | ||
91 | { | ||
92 | /* | ||
93 | * After the lock is released, the original page table is restored. | ||
94 | */ | ||
95 | set_pgd(pgd_offset_k(0x0UL), save_pgd); | ||
96 | __flush_tlb_all(); | ||
97 | local_irq_restore(efi_flags); | ||
98 | early_runtime_code_mapping_set_exec(0); | ||
99 | } | ||
100 | |||
101 | void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size, | ||
102 | u32 type) | ||
103 | { | ||
104 | unsigned long last_map_pfn; | ||
105 | |||
106 | if (type == EFI_MEMORY_MAPPED_IO) | ||
107 | return ioremap(phys_addr, size); | ||
108 | |||
109 | last_map_pfn = init_memory_mapping(phys_addr, phys_addr + size); | ||
110 | if ((last_map_pfn << PAGE_SHIFT) < phys_addr + size) | ||
111 | return NULL; | ||
112 | |||
113 | return (void __iomem *)__va(phys_addr); | ||
114 | } | ||
diff --git a/arch/x86/kernel/efi_stub_32.S b/arch/x86/kernel/efi_stub_32.S deleted file mode 100644 index fbe66e626c09..000000000000 --- a/arch/x86/kernel/efi_stub_32.S +++ /dev/null | |||
@@ -1,123 +0,0 @@ | |||
1 | /* | ||
2 | * EFI call stub for IA32. | ||
3 | * | ||
4 | * This stub allows us to make EFI calls in physical mode with interrupts | ||
5 | * turned off. | ||
6 | */ | ||
7 | |||
8 | #include <linux/linkage.h> | ||
9 | #include <asm/page_types.h> | ||
10 | |||
11 | /* | ||
12 | * efi_call_phys(void *, ...) is a function with variable parameters. | ||
13 | * All the callers of this function assure that all the parameters are 4-bytes. | ||
14 | */ | ||
15 | |||
16 | /* | ||
17 | * In gcc calling convention, EBX, ESP, EBP, ESI and EDI are all callee save. | ||
18 | * So we'd better save all of them at the beginning of this function and restore | ||
19 | * at the end no matter how many we use, because we can not assure EFI runtime | ||
20 | * service functions will comply with gcc calling convention, too. | ||
21 | */ | ||
22 | |||
23 | .text | ||
24 | ENTRY(efi_call_phys) | ||
25 | /* | ||
26 | * 0. The function can only be called in Linux kernel. So CS has been | ||
27 | * set to 0x0010, DS and SS have been set to 0x0018. In EFI, I found | ||
28 | * the values of these registers are the same. And, the corresponding | ||
29 | * GDT entries are identical. So I will do nothing about segment reg | ||
30 | * and GDT, but change GDT base register in prelog and epilog. | ||
31 | */ | ||
32 | |||
33 | /* | ||
34 | * 1. Now I am running with EIP = <physical address> + PAGE_OFFSET. | ||
35 | * But to make it smoothly switch from virtual mode to flat mode. | ||
36 | * The mapping of lower virtual memory has been created in prelog and | ||
37 | * epilog. | ||
38 | */ | ||
39 | movl $1f, %edx | ||
40 | subl $__PAGE_OFFSET, %edx | ||
41 | jmp *%edx | ||
42 | 1: | ||
43 | |||
44 | /* | ||
45 | * 2. Now on the top of stack is the return | ||
46 | * address in the caller of efi_call_phys(), then parameter 1, | ||
47 | * parameter 2, ..., param n. To make things easy, we save the return | ||
48 | * address of efi_call_phys in a global variable. | ||
49 | */ | ||
50 | popl %edx | ||
51 | movl %edx, saved_return_addr | ||
52 | /* get the function pointer into ECX*/ | ||
53 | popl %ecx | ||
54 | movl %ecx, efi_rt_function_ptr | ||
55 | movl $2f, %edx | ||
56 | subl $__PAGE_OFFSET, %edx | ||
57 | pushl %edx | ||
58 | |||
59 | /* | ||
60 | * 3. Clear PG bit in %CR0. | ||
61 | */ | ||
62 | movl %cr0, %edx | ||
63 | andl $0x7fffffff, %edx | ||
64 | movl %edx, %cr0 | ||
65 | jmp 1f | ||
66 | 1: | ||
67 | |||
68 | /* | ||
69 | * 4. Adjust stack pointer. | ||
70 | */ | ||
71 | subl $__PAGE_OFFSET, %esp | ||
72 | |||
73 | /* | ||
74 | * 5. Call the physical function. | ||
75 | */ | ||
76 | jmp *%ecx | ||
77 | |||
78 | 2: | ||
79 | /* | ||
80 | * 6. After EFI runtime service returns, control will return to | ||
81 | * following instruction. We'd better readjust stack pointer first. | ||
82 | */ | ||
83 | addl $__PAGE_OFFSET, %esp | ||
84 | |||
85 | /* | ||
86 | * 7. Restore PG bit | ||
87 | */ | ||
88 | movl %cr0, %edx | ||
89 | orl $0x80000000, %edx | ||
90 | movl %edx, %cr0 | ||
91 | jmp 1f | ||
92 | 1: | ||
93 | /* | ||
94 | * 8. Now restore the virtual mode from flat mode by | ||
95 | * adding EIP with PAGE_OFFSET. | ||
96 | */ | ||
97 | movl $1f, %edx | ||
98 | jmp *%edx | ||
99 | 1: | ||
100 | |||
101 | /* | ||
102 | * 9. Balance the stack. And because EAX contain the return value, | ||
103 | * we'd better not clobber it. | ||
104 | */ | ||
105 | leal efi_rt_function_ptr, %edx | ||
106 | movl (%edx), %ecx | ||
107 | pushl %ecx | ||
108 | |||
109 | /* | ||
110 | * 10. Push the saved return address onto the stack and return. | ||
111 | */ | ||
112 | leal saved_return_addr, %edx | ||
113 | movl (%edx), %ecx | ||
114 | pushl %ecx | ||
115 | ret | ||
116 | ENDPROC(efi_call_phys) | ||
117 | .previous | ||
118 | |||
119 | .data | ||
120 | saved_return_addr: | ||
121 | .long 0 | ||
122 | efi_rt_function_ptr: | ||
123 | .long 0 | ||
diff --git a/arch/x86/kernel/efi_stub_64.S b/arch/x86/kernel/efi_stub_64.S deleted file mode 100644 index 4c07ccab8146..000000000000 --- a/arch/x86/kernel/efi_stub_64.S +++ /dev/null | |||
@@ -1,116 +0,0 @@ | |||
1 | /* | ||
2 | * Function calling ABI conversion from Linux to EFI for x86_64 | ||
3 | * | ||
4 | * Copyright (C) 2007 Intel Corp | ||
5 | * Bibo Mao <bibo.mao@intel.com> | ||
6 | * Huang Ying <ying.huang@intel.com> | ||
7 | */ | ||
8 | |||
9 | #include <linux/linkage.h> | ||
10 | |||
11 | #define SAVE_XMM \ | ||
12 | mov %rsp, %rax; \ | ||
13 | subq $0x70, %rsp; \ | ||
14 | and $~0xf, %rsp; \ | ||
15 | mov %rax, (%rsp); \ | ||
16 | mov %cr0, %rax; \ | ||
17 | clts; \ | ||
18 | mov %rax, 0x8(%rsp); \ | ||
19 | movaps %xmm0, 0x60(%rsp); \ | ||
20 | movaps %xmm1, 0x50(%rsp); \ | ||
21 | movaps %xmm2, 0x40(%rsp); \ | ||
22 | movaps %xmm3, 0x30(%rsp); \ | ||
23 | movaps %xmm4, 0x20(%rsp); \ | ||
24 | movaps %xmm5, 0x10(%rsp) | ||
25 | |||
26 | #define RESTORE_XMM \ | ||
27 | movaps 0x60(%rsp), %xmm0; \ | ||
28 | movaps 0x50(%rsp), %xmm1; \ | ||
29 | movaps 0x40(%rsp), %xmm2; \ | ||
30 | movaps 0x30(%rsp), %xmm3; \ | ||
31 | movaps 0x20(%rsp), %xmm4; \ | ||
32 | movaps 0x10(%rsp), %xmm5; \ | ||
33 | mov 0x8(%rsp), %rsi; \ | ||
34 | mov %rsi, %cr0; \ | ||
35 | mov (%rsp), %rsp | ||
36 | |||
37 | ENTRY(efi_call0) | ||
38 | SAVE_XMM | ||
39 | subq $32, %rsp | ||
40 | call *%rdi | ||
41 | addq $32, %rsp | ||
42 | RESTORE_XMM | ||
43 | ret | ||
44 | ENDPROC(efi_call0) | ||
45 | |||
46 | ENTRY(efi_call1) | ||
47 | SAVE_XMM | ||
48 | subq $32, %rsp | ||
49 | mov %rsi, %rcx | ||
50 | call *%rdi | ||
51 | addq $32, %rsp | ||
52 | RESTORE_XMM | ||
53 | ret | ||
54 | ENDPROC(efi_call1) | ||
55 | |||
56 | ENTRY(efi_call2) | ||
57 | SAVE_XMM | ||
58 | subq $32, %rsp | ||
59 | mov %rsi, %rcx | ||
60 | call *%rdi | ||
61 | addq $32, %rsp | ||
62 | RESTORE_XMM | ||
63 | ret | ||
64 | ENDPROC(efi_call2) | ||
65 | |||
66 | ENTRY(efi_call3) | ||
67 | SAVE_XMM | ||
68 | subq $32, %rsp | ||
69 | mov %rcx, %r8 | ||
70 | mov %rsi, %rcx | ||
71 | call *%rdi | ||
72 | addq $32, %rsp | ||
73 | RESTORE_XMM | ||
74 | ret | ||
75 | ENDPROC(efi_call3) | ||
76 | |||
77 | ENTRY(efi_call4) | ||
78 | SAVE_XMM | ||
79 | subq $32, %rsp | ||
80 | mov %r8, %r9 | ||
81 | mov %rcx, %r8 | ||
82 | mov %rsi, %rcx | ||
83 | call *%rdi | ||
84 | addq $32, %rsp | ||
85 | RESTORE_XMM | ||
86 | ret | ||
87 | ENDPROC(efi_call4) | ||
88 | |||
89 | ENTRY(efi_call5) | ||
90 | SAVE_XMM | ||
91 | subq $48, %rsp | ||
92 | mov %r9, 32(%rsp) | ||
93 | mov %r8, %r9 | ||
94 | mov %rcx, %r8 | ||
95 | mov %rsi, %rcx | ||
96 | call *%rdi | ||
97 | addq $48, %rsp | ||
98 | RESTORE_XMM | ||
99 | ret | ||
100 | ENDPROC(efi_call5) | ||
101 | |||
102 | ENTRY(efi_call6) | ||
103 | SAVE_XMM | ||
104 | mov (%rsp), %rax | ||
105 | mov 8(%rax), %rax | ||
106 | subq $48, %rsp | ||
107 | mov %r9, 32(%rsp) | ||
108 | mov %rax, 40(%rsp) | ||
109 | mov %r8, %r9 | ||
110 | mov %rcx, %r8 | ||
111 | mov %rsi, %rcx | ||
112 | call *%rdi | ||
113 | addq $48, %rsp | ||
114 | RESTORE_XMM | ||
115 | ret | ||
116 | ENDPROC(efi_call6) | ||