freebsd-skq/sys/conf
kib df422cbea3 Add kernel interfaces to call EFI Runtime Services.
Runtime services require special execution environment for the call.
Besides that, OS must inform firmware about runtime virtual memory map
which will be active during the calls, with the SetVirtualAddressMap()
runtime call, done while the 1:1 mapping is still used.  There are two
complication: the SetVirtualAddressMap() effectively must be done from
loader, which needs to know kernel address map in advance.  More,
despite not explicitely mentioned in the specification, both 1:1 and
the map passed to SetVirtualAddressMap() must be active during the
SetVirtualAddressMap() call.  Second, there are buggy BIOSes which
require both mappings active during runtime calls as well, most likely
because they fail to identify all relocations to perform.

On amd64, we can get rid of both problems by providing 1:1 mapping for
the duration of runtime calls, by temprorary remapping user addresses.
As result, we avoid the need for loader to know about future kernel
address map, and avoid bugs in BIOSes.  Typically BIOS only maps
something in low 4G.  If not runtime bugs, we would take advantage of
the DMAP, as previous versions of this patch did.

Similar but more complicated trick can be used even for i386 and 32bit
runtime, if and when the EFI boot on i386 is supported.  We would need
a trampoline page, since potentially whole 4G of VA would be switched
on calls, instead of only userspace portion on amd64.

Context switches are disabled for the duration of the call, FPU access
is granted, and interrupts are not disabled.  The later is possible
because kernel is mapped during calls.

To test, the sysctl mib debug.efi_time is provided, setting it to 1
makes one call to EFI get_time() runtime service, on success the efitm
structure is printed to the control terminal.  Load efirt.ko, or add
EFIRT option to the kernel config, to enable code.

Discussed with:	emaste, imp
Tested by:	emaste (mac, qemu)
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2016-09-21 11:31:58 +00:00
..
config.mk Don't run find(1) for __MPATH with NO_MODULES set. 2016-07-22 17:31:14 +00:00
dtb.mk Add missed updates for r301079 and r301084. 2016-05-31 23:12:43 +00:00
files Move ofw_cpu file to the main files conf file. 2016-09-21 02:56:57 +00:00
files.amd64 Add kernel interfaces to call EFI Runtime Services. 2016-09-21 11:31:58 +00:00
files.arm Move ofw_cpu file to the main files conf file. 2016-09-21 02:56:57 +00:00
files.arm64 Add driver for PCIe root complex on Annapurna Alpine platform. 2016-09-20 11:11:06 +00:00
files.i386 Make CloudABI work on i386. 2016-08-22 17:37:31 +00:00
files.mips MFC r288071: 2016-08-01 06:59:35 +00:00
files.pc98 Merge i386 and amd64 variants of mp_watchdog.c into x86/, there is no 2016-08-03 13:51:53 +00:00
files.powerpc Merge MPC85XX and QorIQ config options 2016-08-03 01:22:11 +00:00
files.riscv o Remove operation in machine mode. 2016-08-10 12:41:36 +00:00
files.sparc64 MFC r288071: 2016-08-01 06:59:35 +00:00
kern.mk Always pass -m to ld for converting binary files to kernel ELF objects 2016-09-20 17:07:14 +00:00
kern.opts.mk Change the default build behavior so we don't compile extra TCP modules by 2016-06-10 19:06:11 +00:00
kern.post.mk FAST_DEPEND: Fix 'make all install' not properly rebuilding based on .depend.* files. 2016-08-23 19:37:18 +00:00
kern.pre.mk Always pass -m to ld for converting binary files to kernel ELF objects 2016-09-20 17:07:14 +00:00
kmod_syms.awk
kmod.mk Always pass -m to ld for converting binary files to kernel ELF objects 2016-09-20 17:07:14 +00:00
ldscript.amd64 remove CONSTRUCTORS from kernel linker scripts 2016-07-28 13:54:46 +00:00
ldscript.arm remove CONSTRUCTORS from kernel linker scripts 2016-07-28 13:54:46 +00:00
ldscript.arm64 Explicitly include all .rodata.* sections in the kernel .rodata. This 2016-09-03 17:23:24 +00:00
ldscript.i386 remove CONSTRUCTORS from kernel linker scripts 2016-07-28 13:54:46 +00:00
ldscript.mips remove CONSTRUCTORS from kernel linker scripts 2016-07-28 13:54:46 +00:00
ldscript.mips.cfe remove CONSTRUCTORS from kernel linker scripts 2016-07-28 13:54:46 +00:00
ldscript.mips.mips64 remove CONSTRUCTORS from kernel linker scripts 2016-07-28 13:54:46 +00:00
ldscript.mips.octeon1 remove CONSTRUCTORS from kernel linker scripts 2016-07-28 13:54:46 +00:00
ldscript.powerpc remove CONSTRUCTORS from kernel linker scripts 2016-07-28 13:54:46 +00:00
ldscript.powerpc64 remove CONSTRUCTORS from kernel linker scripts 2016-07-28 13:54:46 +00:00
ldscript.riscv o Remove operation in machine mode. 2016-08-10 12:41:36 +00:00
ldscript.sparc64 remove CONSTRUCTORS from kernel linker scripts 2016-07-28 13:54:46 +00:00
Makefile.amd64
Makefile.arm
Makefile.arm64
Makefile.i386
Makefile.mips [mips] Improve MIPS trampoline code 2016-05-16 23:56:31 +00:00
Makefile.pc98
Makefile.powerpc
Makefile.riscv Set dependencies for genassym.c. 2016-05-24 16:30:05 +00:00
Makefile.sparc64
makeLINT.mk
makeLINT.sed
newvers.sh Reflect head is now 12.0-CURRENT. 2016-07-08 00:12:29 +00:00
NOTES Add evdev protocol implementation 2016-09-11 18:56:38 +00:00
options Add evdev protocol implementation 2016-09-11 18:56:38 +00:00
options.amd64 Add kernel interfaces to call EFI Runtime Services. 2016-09-21 11:31:58 +00:00
options.arm Add support for Allwinner A13. 2016-07-08 23:38:25 +00:00
options.arm64 Add SOC_ALLWINNER_A64 option for Allwinner A64 (sun50i) SoCs. 2016-07-11 20:05:03 +00:00
options.i386
options.mips Add support for SMP on MIPS Malta platform. 2016-09-09 14:50:44 +00:00
options.pc98
options.powerpc Merge MPC85XX and QorIQ config options 2016-08-03 01:22:11 +00:00
options.riscv
options.sparc64
systags.sh
WITHOUT_SOURCELESS
WITHOUT_SOURCELESS_HOST
WITHOUT_SOURCELESS_UCODE