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 | |
23a0d4e8 IM |
36 | * prolog/epilog before/after the invocation to claim the EFI runtime service |
37 | * handler exclusively and to duplicate a memory mapping in low memory space, | |
38 | * say 0 - 3G. | |
1da177e4 | 39 | */ |
1da177e4 | 40 | |
67a9108e MF |
41 | int __init efi_alloc_page_tables(void) |
42 | { | |
43 | return 0; | |
44 | } | |
45 | ||
d2f7cbe7 | 46 | void efi_sync_low_kernel_mappings(void) {} |
11cc8512 | 47 | void __init efi_dump_pagetable(void) {} |
4e78eb05 | 48 | int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) |
b7b898ae BP |
49 | { |
50 | return 0; | |
51 | } | |
d2f7cbe7 BP |
52 | |
53 | void __init efi_map_region(efi_memory_desc_t *md) | |
54 | { | |
55 | old_map_region(md); | |
56 | } | |
57 | ||
3b266496 | 58 | void __init efi_map_region_fixed(efi_memory_desc_t *md) {} |
1fec0533 | 59 | void __init parse_efi_setup(u64 phys_addr, u32 data_len) {} |
3b266496 | 60 | |
744937b0 | 61 | pgd_t * __init efi_call_phys_prolog(void) |
1da177e4 | 62 | { |
6b68f01b | 63 | struct desc_ptr gdt_descr; |
744937b0 | 64 | pgd_t *save_pgd; |
1da177e4 | 65 | |
744937b0 IM |
66 | /* Current pgd is swapper_pg_dir, we'll restore it later: */ |
67 | save_pgd = swapper_pg_dir; | |
6d3e32e6 | 68 | load_cr3(initial_page_table); |
8b2cb7a8 | 69 | __flush_tlb_all(); |
1da177e4 | 70 | |
4fbb5968 RR |
71 | gdt_descr.address = __pa(get_cpu_gdt_table(0)); |
72 | gdt_descr.size = GDT_SIZE - 1; | |
73 | load_gdt(&gdt_descr); | |
744937b0 IM |
74 | |
75 | return save_pgd; | |
1da177e4 LT |
76 | } |
77 | ||
744937b0 | 78 | void __init efi_call_phys_epilog(pgd_t *save_pgd) |
1da177e4 | 79 | { |
6b68f01b | 80 | struct desc_ptr gdt_descr; |
1da177e4 | 81 | |
4fbb5968 RR |
82 | gdt_descr.address = (unsigned long)get_cpu_gdt_table(0); |
83 | gdt_descr.size = GDT_SIZE - 1; | |
84 | load_gdt(&gdt_descr); | |
2b932f6c | 85 | |
744937b0 | 86 | load_cr3(save_pgd); |
8b2cb7a8 | 87 | __flush_tlb_all(); |
1da177e4 | 88 | } |
c55d016f | 89 | |
6d0cc887 | 90 | void __init efi_runtime_update_mappings(void) |
c55d016f BP |
91 | { |
92 | if (__supported_pte_mask & _PAGE_NX) | |
93 | runtime_code_page_mkexec(); | |
94 | } |