Linux 4.18.10
[linux/fpc-iii.git] / arch / x86 / platform / efi / efi_32.c
blob324b93328b3746f4bb8010780ee85915707b8095
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Extensible Firmware Interface
5 * Based on Extensible Firmware Interface Specification version 1.0
7 * Copyright (C) 1999 VA Linux Systems
8 * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
9 * Copyright (C) 1999-2002 Hewlett-Packard Co.
10 * David Mosberger-Tang <davidm@hpl.hp.com>
11 * Stephane Eranian <eranian@hpl.hp.com>
13 * All EFI Runtime Services are not implemented yet as EFI only
14 * supports physical mode addressing on SoftSDV. This is to be fixed
15 * in a future version. --drummond 1999-07-20
17 * Implemented EFI runtime services and virtual mode calls. --davidm
19 * Goutham Rao: <goutham.rao@intel.com>
20 * Skip non-WB memory and ignore empty memory ranges.
23 #include <linux/kernel.h>
24 #include <linux/types.h>
25 #include <linux/ioport.h>
26 #include <linux/efi.h>
28 #include <asm/io.h>
29 #include <asm/desc.h>
30 #include <asm/page.h>
31 #include <asm/pgtable.h>
32 #include <asm/tlbflush.h>
33 #include <asm/efi.h>
36 * To make EFI call EFI runtime service in physical addressing mode we need
37 * prolog/epilog before/after the invocation to claim the EFI runtime service
38 * handler exclusively and to duplicate a memory mapping in low memory space,
39 * say 0 - 3G.
42 int __init efi_alloc_page_tables(void)
44 return 0;
47 void efi_sync_low_kernel_mappings(void) {}
49 void __init efi_dump_pagetable(void)
51 #ifdef CONFIG_EFI_PGT_DUMP
52 ptdump_walk_pgd_level(NULL, swapper_pg_dir);
53 #endif
56 int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
58 return 0;
61 void __init efi_map_region(efi_memory_desc_t *md)
63 old_map_region(md);
66 void __init efi_map_region_fixed(efi_memory_desc_t *md) {}
67 void __init parse_efi_setup(u64 phys_addr, u32 data_len) {}
69 pgd_t * __init efi_call_phys_prolog(void)
71 struct desc_ptr gdt_descr;
72 pgd_t *save_pgd;
74 /* Current pgd is swapper_pg_dir, we'll restore it later: */
75 save_pgd = swapper_pg_dir;
76 load_cr3(initial_page_table);
77 __flush_tlb_all();
79 gdt_descr.address = get_cpu_gdt_paddr(0);
80 gdt_descr.size = GDT_SIZE - 1;
81 load_gdt(&gdt_descr);
83 return save_pgd;
86 void __init efi_call_phys_epilog(pgd_t *save_pgd)
88 struct desc_ptr gdt_descr;
90 gdt_descr.address = (unsigned long)get_cpu_gdt_rw(0);
91 gdt_descr.size = GDT_SIZE - 1;
92 load_gdt(&gdt_descr);
94 load_cr3(save_pgd);
95 __flush_tlb_all();
98 void __init efi_runtime_update_mappings(void)
100 if (__supported_pte_mask & _PAGE_NX)
101 runtime_code_page_mkexec();