]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
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 | ||
1da177e4 | 22 | #include <linux/kernel.h> |
1da177e4 | 23 | #include <linux/types.h> |
1da177e4 | 24 | #include <linux/ioport.h> |
1da177e4 LT |
25 | #include <linux/efi.h> |
26 | ||
1da177e4 | 27 | #include <asm/io.h> |
783ac47c | 28 | #include <asm/desc.h> |
1da177e4 LT |
29 | #include <asm/page.h> |
30 | #include <asm/pgtable.h> | |
1da177e4 | 31 | #include <asm/tlbflush.h> |
cc7e73f3 | 32 | #include <asm/efi.h> |
1da177e4 | 33 | |
1da177e4 LT |
34 | /* |
35 | * To make EFI call EFI runtime service in physical addressing mode we need | |
4e78eb05 | 36 | * prolog/epilog before/after the invocation to disable interrupt, to |
1da177e4 LT |
37 | * claim EFI runtime service handler exclusively and to duplicate a memory in |
38 | * low memory space say 0 - 3G. | |
39 | */ | |
1da177e4 | 40 | static unsigned long efi_rt_eflags; |
1da177e4 | 41 | |
d2f7cbe7 | 42 | void efi_sync_low_kernel_mappings(void) {} |
11cc8512 | 43 | void __init efi_dump_pagetable(void) {} |
4e78eb05 | 44 | int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) |
b7b898ae BP |
45 | { |
46 | return 0; | |
47 | } | |
4e78eb05 MK |
48 | void __init efi_cleanup_page_tables(unsigned long pa_memmap, unsigned num_pages) |
49 | { | |
50 | } | |
d2f7cbe7 BP |
51 | |
52 | void __init efi_map_region(efi_memory_desc_t *md) | |
53 | { | |
54 | old_map_region(md); | |
55 | } | |
56 | ||
3b266496 | 57 | void __init efi_map_region_fixed(efi_memory_desc_t *md) {} |
1fec0533 | 58 | void __init parse_efi_setup(u64 phys_addr, u32 data_len) {} |
3b266496 | 59 | |
4e78eb05 | 60 | void __init efi_call_phys_prolog(void) |
1da177e4 | 61 | { |
6b68f01b | 62 | struct desc_ptr gdt_descr; |
1da177e4 | 63 | |
1da177e4 LT |
64 | local_irq_save(efi_rt_eflags); |
65 | ||
6d3e32e6 | 66 | load_cr3(initial_page_table); |
8b2cb7a8 | 67 | __flush_tlb_all(); |
1da177e4 | 68 | |
4fbb5968 RR |
69 | gdt_descr.address = __pa(get_cpu_gdt_table(0)); |
70 | gdt_descr.size = GDT_SIZE - 1; | |
71 | load_gdt(&gdt_descr); | |
1da177e4 LT |
72 | } |
73 | ||
4e78eb05 | 74 | void __init efi_call_phys_epilog(void) |
1da177e4 | 75 | { |
6b68f01b | 76 | struct desc_ptr gdt_descr; |
1da177e4 | 77 | |
4fbb5968 RR |
78 | gdt_descr.address = (unsigned long)get_cpu_gdt_table(0); |
79 | gdt_descr.size = GDT_SIZE - 1; | |
80 | load_gdt(&gdt_descr); | |
2b932f6c | 81 | |
6d3e32e6 | 82 | load_cr3(swapper_pg_dir); |
8b2cb7a8 | 83 | __flush_tlb_all(); |
1da177e4 LT |
84 | |
85 | local_irq_restore(efi_rt_eflags); | |
1da177e4 | 86 | } |
c55d016f BP |
87 | |
88 | void __init efi_runtime_mkexec(void) | |
89 | { | |
90 | if (__supported_pte_mask & _PAGE_NX) | |
91 | runtime_code_page_mkexec(); | |
92 | } |