Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
efi_32.c
Go to the documentation of this file.
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 <[email protected]>
8  * Copyright (C) 1999-2002 Hewlett-Packard Co.
9  * David Mosberger-Tang <[email protected]>
10  * Stephane Eranian <[email protected]>
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: <[email protected]>
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/desc.h>
29 #include <asm/page.h>
30 #include <asm/pgtable.h>
31 #include <asm/tlbflush.h>
32 #include <asm/efi.h>
33 
34 /*
35  * To make EFI call EFI runtime service in physical addressing mode we need
36  * prelog/epilog before/after the invocation to disable interrupt, to
37  * claim EFI runtime service handler exclusively and to duplicate a memory in
38  * low memory space say 0 - 3G.
39  */
40 
41 static unsigned long efi_rt_eflags;
42 
44 {
45  struct desc_ptr gdt_descr;
46 
47  local_irq_save(efi_rt_eflags);
48 
49  load_cr3(initial_page_table);
51 
52  gdt_descr.address = __pa(get_cpu_gdt_table(0));
53  gdt_descr.size = GDT_SIZE - 1;
54  load_gdt(&gdt_descr);
55 }
56 
58 {
59  struct desc_ptr gdt_descr;
60 
61  gdt_descr.address = (unsigned long)get_cpu_gdt_table(0);
62  gdt_descr.size = GDT_SIZE - 1;
63  load_gdt(&gdt_descr);
64 
65  load_cr3(swapper_pg_dir);
67 
68  local_irq_restore(efi_rt_eflags);
69 }