2005-04-17 05:20:36 +07:00
|
|
|
/*
|
|
|
|
* Extensible Firmware Interface
|
|
|
|
*
|
|
|
|
* Based on Extensible Firmware Interface Specification version 1.0
|
|
|
|
*
|
|
|
|
* Copyright (C) 1999 VA Linux Systems
|
|
|
|
* Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
|
|
|
|
* Copyright (C) 1999-2002 Hewlett-Packard Co.
|
|
|
|
* David Mosberger-Tang <davidm@hpl.hp.com>
|
|
|
|
* Stephane Eranian <eranian@hpl.hp.com>
|
|
|
|
*
|
|
|
|
* All EFI Runtime Services are not implemented yet as EFI only
|
|
|
|
* supports physical mode addressing on SoftSDV. This is to be fixed
|
|
|
|
* in a future version. --drummond 1999-07-20
|
|
|
|
*
|
|
|
|
* Implemented EFI runtime services and virtual mode calls. --davidm
|
|
|
|
*
|
|
|
|
* Goutham Rao: <goutham.rao@intel.com>
|
|
|
|
* Skip non-WB memory and ignore empty memory ranges.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/ioport.h>
|
|
|
|
#include <linux/efi.h>
|
|
|
|
|
|
|
|
#include <asm/io.h>
|
2011-05-28 01:46:07 +07:00
|
|
|
#include <asm/desc.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
#include <asm/page.h>
|
|
|
|
#include <asm/pgtable.h>
|
|
|
|
#include <asm/tlbflush.h>
|
2008-02-14 04:26:39 +07:00
|
|
|
#include <asm/efi.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* To make EFI call EFI runtime service in physical addressing mode we need
|
2015-03-03 13:34:33 +07:00
|
|
|
* prolog/epilog before/after the invocation to claim the EFI runtime service
|
|
|
|
* handler exclusively and to duplicate a memory mapping in low memory space,
|
|
|
|
* say 0 - 3G.
|
2005-04-17 05:20:36 +07:00
|
|
|
*/
|
|
|
|
|
2015-11-28 04:09:34 +07:00
|
|
|
int __init efi_alloc_page_tables(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-10-31 23:25:08 +07:00
|
|
|
void efi_sync_low_kernel_mappings(void) {}
|
2014-01-18 18:48:15 +07:00
|
|
|
void __init efi_dump_pagetable(void) {}
|
2014-09-08 00:42:17 +07:00
|
|
|
int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
|
2014-01-18 18:48:17 +07:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2013-10-31 23:25:08 +07:00
|
|
|
|
|
|
|
void __init efi_map_region(efi_memory_desc_t *md)
|
|
|
|
{
|
|
|
|
old_map_region(md);
|
|
|
|
}
|
|
|
|
|
2013-12-20 17:02:14 +07:00
|
|
|
void __init efi_map_region_fixed(efi_memory_desc_t *md) {}
|
2013-12-20 17:02:19 +07:00
|
|
|
void __init parse_efi_setup(u64 phys_addr, u32 data_len) {}
|
2013-12-20 17:02:14 +07:00
|
|
|
|
2015-03-03 13:48:50 +07:00
|
|
|
pgd_t * __init efi_call_phys_prolog(void)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2008-01-30 19:31:12 +07:00
|
|
|
struct desc_ptr gdt_descr;
|
2015-03-03 13:48:50 +07:00
|
|
|
pgd_t *save_pgd;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2015-03-03 13:48:50 +07:00
|
|
|
/* Current pgd is swapper_pg_dir, we'll restore it later: */
|
|
|
|
save_pgd = swapper_pg_dir;
|
2011-12-08 19:10:50 +07:00
|
|
|
load_cr3(initial_page_table);
|
2008-01-30 19:32:11 +07:00
|
|
|
__flush_tlb_all();
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2017-03-15 00:05:07 +07:00
|
|
|
gdt_descr.address = __pa(get_cpu_gdt_rw(0));
|
2007-05-03 00:27:11 +07:00
|
|
|
gdt_descr.size = GDT_SIZE - 1;
|
|
|
|
load_gdt(&gdt_descr);
|
2015-03-03 13:48:50 +07:00
|
|
|
|
|
|
|
return save_pgd;
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
2015-03-03 13:48:50 +07:00
|
|
|
void __init efi_call_phys_epilog(pgd_t *save_pgd)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2008-01-30 19:31:12 +07:00
|
|
|
struct desc_ptr gdt_descr;
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2017-03-15 00:05:07 +07:00
|
|
|
gdt_descr.address = (unsigned long)get_cpu_gdt_rw(0);
|
2007-05-03 00:27:11 +07:00
|
|
|
gdt_descr.size = GDT_SIZE - 1;
|
|
|
|
load_gdt(&gdt_descr);
|
2006-02-25 04:04:14 +07:00
|
|
|
|
2015-03-03 13:48:50 +07:00
|
|
|
load_cr3(save_pgd);
|
2008-01-30 19:32:11 +07:00
|
|
|
__flush_tlb_all();
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
2014-02-14 14:24:24 +07:00
|
|
|
|
2016-02-17 19:36:05 +07:00
|
|
|
void __init efi_runtime_update_mappings(void)
|
2014-02-14 14:24:24 +07:00
|
|
|
{
|
|
|
|
if (__supported_pte_mask & _PAGE_NX)
|
|
|
|
runtime_code_page_mkexec();
|
|
|
|
}
|