efi_32.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. #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. * prolog/epilog before/after the invocation to claim the EFI runtime service
  34. * handler exclusively and to duplicate a memory mapping in low memory space,
  35. * say 0 - 3G.
  36. */
  37. int __init efi_alloc_page_tables(void)
  38. {
  39. return 0;
  40. }
  41. void efi_sync_low_kernel_mappings(void) {}
  42. void __init efi_dump_pagetable(void) {}
  43. int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
  44. {
  45. return 0;
  46. }
  47. void __init efi_map_region(efi_memory_desc_t *md)
  48. {
  49. old_map_region(md);
  50. }
  51. void __init efi_map_region_fixed(efi_memory_desc_t *md) {}
  52. void __init parse_efi_setup(u64 phys_addr, u32 data_len) {}
  53. pgd_t * __init efi_call_phys_prolog(void)
  54. {
  55. struct desc_ptr gdt_descr;
  56. pgd_t *save_pgd;
  57. /* Current pgd is swapper_pg_dir, we'll restore it later: */
  58. save_pgd = swapper_pg_dir;
  59. load_cr3(initial_page_table);
  60. __flush_tlb_all();
  61. gdt_descr.address = __pa(get_cpu_gdt_table(0));
  62. gdt_descr.size = GDT_SIZE - 1;
  63. load_gdt(&gdt_descr);
  64. return save_pgd;
  65. }
  66. void __init efi_call_phys_epilog(pgd_t *save_pgd)
  67. {
  68. struct desc_ptr gdt_descr;
  69. gdt_descr.address = (unsigned long)get_cpu_gdt_table(0);
  70. gdt_descr.size = GDT_SIZE - 1;
  71. load_gdt(&gdt_descr);
  72. load_cr3(save_pgd);
  73. __flush_tlb_all();
  74. }
  75. void __init efi_runtime_update_mappings(void)
  76. {
  77. if (__supported_pte_mask & _PAGE_NX)
  78. runtime_code_page_mkexec();
  79. }