freebsd-dev/sys/conf/options.amd64
Konstantin Belousov bc3ad3a179 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

70 lines
1.5 KiB
Plaintext

# $FreeBSD$
# Options specific to AMD64 platform kernels
AUTO_EOI_1 opt_auto_eoi.h
AUTO_EOI_2 opt_auto_eoi.h
COUNT_XINVLTLB_HITS opt_smp.h
COUNT_IPIS opt_smp.h
MAXMEM
MPTABLE_FORCE_HTT
MP_WATCHDOG
NKPT opt_pmap.h
PV_STATS opt_pmap.h
# Options for emulators. These should only be used at config time, so
# they are handled like options for static filesystems
# (see src/sys/conf/options), except for broken debugging options.
COMPAT_FREEBSD32 opt_compat.h
#IBCS2 opt_dontuse.h
#COMPAT_LINUX opt_dontuse.h
COMPAT_LINUX32 opt_compat.h
#COMPAT_SVR4 opt_dontuse.h
#DEBUG_SVR4 opt_svr4.h
LINPROCFS opt_dontuse.h
LINSYSFS opt_dontuse.h
NDISAPI opt_dontuse.h
TIMER_FREQ opt_clock.h
# options for serial support
COM_ESP opt_sio.h
COM_MULTIPORT opt_sio.h
CONSPEED opt_sio.h
GDBSPEED opt_sio.h
COM_NO_ACPI opt_sio.h
VGA_ALT_SEQACCESS opt_vga.h
VGA_DEBUG opt_vga.h
VGA_NO_FONT_LOADING opt_vga.h
VGA_NO_MODE_CHANGE opt_vga.h
VGA_SLOW_IOACCESS opt_vga.h
VGA_WIDTH90 opt_vga.h
VESA
VESA_DEBUG opt_vesa.h
# AGP debugging support
AGP_DEBUG opt_agp.h
ATKBD_DFLT_KEYMAP opt_atkbd.h
# -------------------------------
# EOF
# -------------------------------
HAMMER opt_cpu.h
PSM_HOOKRESUME opt_psm.h
PSM_RESETAFTERSUSPEND opt_psm.h
PSM_DEBUG opt_psm.h
DEV_ATPIC opt_atpic.h
# BPF just-in-time compiler
BPF_JITTER opt_bpf.h
XENHVM opt_global.h
# options for the Intel C600 SAS driver (isci)
ISCI_LOGGING opt_isci.h
# EFI Runtime services support
EFIRT opt_efirt.h