efi_32.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. #include <linux/kernel.h>
  22. #include <linux/types.h>
  23. #include <linux/ioport.h>
  24. #include <linux/efi.h>
  25. #include <asm/io.h>
  26. #include <asm/desc.h>
  27. #include <asm/page.h>
  28. #include <asm/pgtable.h>
  29. #include <asm/tlbflush.h>
  30. #include <asm/efi.h>
  31. /*
  32. * To make EFI call EFI runtime service in physical addressing mode we need
  33. * prelog/epilog before/after the invocation to disable interrupt, to
  34. * claim EFI runtime service handler exclusively and to duplicate a memory in
  35. * low memory space say 0 - 3G.
  36. */
  37. static unsigned long efi_rt_eflags;
  38. void efi_sync_low_kernel_mappings(void) {}
  39. void efi_setup_page_tables(void) {}
  40. void __init efi_map_region(efi_memory_desc_t *md)
  41. {
  42. old_map_region(md);
  43. }
  44. void __init efi_map_region_fixed(efi_memory_desc_t *md) {}
  45. void __init parse_efi_setup(u64 phys_addr, u32 data_len) {}
  46. void efi_call_phys_prelog(void)
  47. {
  48. struct desc_ptr gdt_descr;
  49. local_irq_save(efi_rt_eflags);
  50. load_cr3(initial_page_table);
  51. __flush_tlb_all();
  52. gdt_descr.address = __pa(get_cpu_gdt_table(0));
  53. gdt_descr.size = GDT_SIZE - 1;
  54. load_gdt(&gdt_descr);
  55. }
  56. void efi_call_phys_epilog(void)
  57. {
  58. struct desc_ptr gdt_descr;
  59. gdt_descr.address = (unsigned long)get_cpu_gdt_table(0);
  60. gdt_descr.size = GDT_SIZE - 1;
  61. load_gdt(&gdt_descr);
  62. load_cr3(swapper_pg_dir);
  63. __flush_tlb_all();
  64. local_irq_restore(efi_rt_eflags);
  65. }
  66. void __init efi_runtime_mkexec(void)
  67. {
  68. if (__supported_pte_mask & _PAGE_NX)
  69. runtime_code_page_mkexec();
  70. }