162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_cimenu "EFI (Extensible Firmware Interface) Support"
362306a36Sopenharmony_ci	depends on EFI
462306a36Sopenharmony_ci
562306a36Sopenharmony_ciconfig EFI_ESRT
662306a36Sopenharmony_ci	bool
762306a36Sopenharmony_ci	depends on EFI && !IA64
862306a36Sopenharmony_ci	default y
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciconfig EFI_VARS_PSTORE
1162306a36Sopenharmony_ci	tristate "Register efivars backend for pstore"
1262306a36Sopenharmony_ci	depends on PSTORE
1362306a36Sopenharmony_ci	select UCS2_STRING
1462306a36Sopenharmony_ci	default y
1562306a36Sopenharmony_ci	help
1662306a36Sopenharmony_ci	  Say Y here to enable use efivars as a backend to pstore. This
1762306a36Sopenharmony_ci	  will allow writing console messages, crash dumps, or anything
1862306a36Sopenharmony_ci	  else supported by pstore to EFI variables.
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ciconfig EFI_VARS_PSTORE_DEFAULT_DISABLE
2162306a36Sopenharmony_ci	bool "Disable using efivars as a pstore backend by default"
2262306a36Sopenharmony_ci	depends on EFI_VARS_PSTORE
2362306a36Sopenharmony_ci	default n
2462306a36Sopenharmony_ci	help
2562306a36Sopenharmony_ci	  Saying Y here will disable the use of efivars as a storage
2662306a36Sopenharmony_ci	  backend for pstore by default. This setting can be overridden
2762306a36Sopenharmony_ci	  using the efivars module's pstore_disable parameter.
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ciconfig EFI_SOFT_RESERVE
3062306a36Sopenharmony_ci	bool "Reserve EFI Specific Purpose Memory"
3162306a36Sopenharmony_ci	depends on EFI && EFI_STUB && ACPI_HMAT
3262306a36Sopenharmony_ci	default ACPI_HMAT
3362306a36Sopenharmony_ci	help
3462306a36Sopenharmony_ci	  On systems that have mixed performance classes of memory EFI
3562306a36Sopenharmony_ci	  may indicate specific purpose memory with an attribute (See
3662306a36Sopenharmony_ci	  EFI_MEMORY_SP in UEFI 2.8). A memory range tagged with this
3762306a36Sopenharmony_ci	  attribute may have unique performance characteristics compared
3862306a36Sopenharmony_ci	  to the system's general purpose "System RAM" pool. On the
3962306a36Sopenharmony_ci	  expectation that such memory has application specific usage,
4062306a36Sopenharmony_ci	  and its base EFI memory type is "conventional" answer Y to
4162306a36Sopenharmony_ci	  arrange for the kernel to reserve it as a "Soft Reserved"
4262306a36Sopenharmony_ci	  resource, and set aside for direct-access (device-dax) by
4362306a36Sopenharmony_ci	  default. The memory range can later be optionally assigned to
4462306a36Sopenharmony_ci	  the page allocator by system administrator policy via the
4562306a36Sopenharmony_ci	  device-dax kmem facility. Say N to have the kernel treat this
4662306a36Sopenharmony_ci	  memory as "System RAM" by default.
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci	  If unsure, say Y.
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ciconfig EFI_DXE_MEM_ATTRIBUTES
5162306a36Sopenharmony_ci	bool "Adjust memory attributes in EFISTUB"
5262306a36Sopenharmony_ci	depends on EFI && EFI_STUB && X86
5362306a36Sopenharmony_ci	default y
5462306a36Sopenharmony_ci	help
5562306a36Sopenharmony_ci	  UEFI specification does not guarantee all memory to be
5662306a36Sopenharmony_ci	  accessible for both write and execute as the kernel expects
5762306a36Sopenharmony_ci	  it to be.
5862306a36Sopenharmony_ci	  Use DXE services to check and alter memory protection
5962306a36Sopenharmony_ci	  attributes during boot via EFISTUB to ensure that memory
6062306a36Sopenharmony_ci	  ranges used by the kernel are writable and executable.
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ciconfig EFI_PARAMS_FROM_FDT
6362306a36Sopenharmony_ci	bool
6462306a36Sopenharmony_ci	help
6562306a36Sopenharmony_ci	  Select this config option from the architecture Kconfig if
6662306a36Sopenharmony_ci	  the EFI runtime support gets system table address, memory
6762306a36Sopenharmony_ci          map address, and other parameters from the device tree.
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ciconfig EFI_RUNTIME_WRAPPERS
7062306a36Sopenharmony_ci	bool
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ciconfig EFI_GENERIC_STUB
7362306a36Sopenharmony_ci	bool
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ciconfig EFI_ZBOOT
7662306a36Sopenharmony_ci	bool "Enable the generic EFI decompressor"
7762306a36Sopenharmony_ci	depends on EFI_GENERIC_STUB && !ARM
7862306a36Sopenharmony_ci	select HAVE_KERNEL_GZIP
7962306a36Sopenharmony_ci	select HAVE_KERNEL_LZ4
8062306a36Sopenharmony_ci	select HAVE_KERNEL_LZMA
8162306a36Sopenharmony_ci	select HAVE_KERNEL_LZO
8262306a36Sopenharmony_ci	select HAVE_KERNEL_XZ
8362306a36Sopenharmony_ci	select HAVE_KERNEL_ZSTD
8462306a36Sopenharmony_ci	help
8562306a36Sopenharmony_ci	  Create the bootable image as an EFI application that carries the
8662306a36Sopenharmony_ci	  actual kernel image in compressed form, and decompresses it into
8762306a36Sopenharmony_ci	  memory before executing it via LoadImage/StartImage EFI boot service
8862306a36Sopenharmony_ci	  calls. For compatibility with non-EFI loaders, the payload can be
8962306a36Sopenharmony_ci	  decompressed and executed by the loader as well, provided that the
9062306a36Sopenharmony_ci	  loader implements the decompression algorithm and that non-EFI boot
9162306a36Sopenharmony_ci	  is supported by the encapsulated image. (The compression algorithm
9262306a36Sopenharmony_ci	  used is described in the zboot image header)
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ciconfig EFI_ARMSTUB_DTB_LOADER
9562306a36Sopenharmony_ci	bool "Enable the DTB loader"
9662306a36Sopenharmony_ci	depends on EFI_GENERIC_STUB && !RISCV && !LOONGARCH
9762306a36Sopenharmony_ci	default y
9862306a36Sopenharmony_ci	help
9962306a36Sopenharmony_ci	  Select this config option to add support for the dtb= command
10062306a36Sopenharmony_ci	  line parameter, allowing a device tree blob to be loaded into
10162306a36Sopenharmony_ci	  memory from the EFI System Partition by the stub.
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci	  If the device tree is provided by the platform or by
10462306a36Sopenharmony_ci	  the bootloader this option may not be needed.
10562306a36Sopenharmony_ci	  But, for various development reasons and to maintain existing
10662306a36Sopenharmony_ci	  functionality for bootloaders that do not have such support
10762306a36Sopenharmony_ci	  this option is necessary.
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ciconfig EFI_BOOTLOADER_CONTROL
11062306a36Sopenharmony_ci	tristate "EFI Bootloader Control"
11162306a36Sopenharmony_ci	select UCS2_STRING
11262306a36Sopenharmony_ci	default n
11362306a36Sopenharmony_ci	help
11462306a36Sopenharmony_ci	  This module installs a reboot hook, such that if reboot() is
11562306a36Sopenharmony_ci	  invoked with a string argument NNN, "NNN" is copied to the
11662306a36Sopenharmony_ci	  "LoaderEntryOneShot" EFI variable, to be read by the
11762306a36Sopenharmony_ci	  bootloader. If the string matches one of the boot labels
11862306a36Sopenharmony_ci	  defined in its configuration, the bootloader will boot once
11962306a36Sopenharmony_ci	  to that label. The "LoaderEntryRebootReason" EFI variable is
12062306a36Sopenharmony_ci	  set with the reboot reason: "reboot" or "shutdown". The
12162306a36Sopenharmony_ci	  bootloader reads this reboot reason and takes particular
12262306a36Sopenharmony_ci	  action according to its policy.
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ciconfig EFI_CAPSULE_LOADER
12562306a36Sopenharmony_ci	tristate "EFI capsule loader"
12662306a36Sopenharmony_ci	depends on EFI && !IA64
12762306a36Sopenharmony_ci	help
12862306a36Sopenharmony_ci	  This option exposes a loader interface "/dev/efi_capsule_loader" for
12962306a36Sopenharmony_ci	  users to load EFI capsules. This driver requires working runtime
13062306a36Sopenharmony_ci	  capsule support in the firmware, which many OEMs do not provide.
13162306a36Sopenharmony_ci
13262306a36Sopenharmony_ci	  Most users should say N.
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ciconfig EFI_CAPSULE_QUIRK_QUARK_CSH
13562306a36Sopenharmony_ci	bool "Add support for Quark capsules with non-standard headers"
13662306a36Sopenharmony_ci	depends on X86 && !64BIT
13762306a36Sopenharmony_ci	select EFI_CAPSULE_LOADER
13862306a36Sopenharmony_ci	default y
13962306a36Sopenharmony_ci	help
14062306a36Sopenharmony_ci	  Add support for processing Quark X1000 EFI capsules, whose header
14162306a36Sopenharmony_ci	  layout deviates from the layout mandated by the UEFI specification.
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_ciconfig EFI_TEST
14462306a36Sopenharmony_ci	tristate "EFI Runtime Service Tests Support"
14562306a36Sopenharmony_ci	depends on EFI
14662306a36Sopenharmony_ci	default n
14762306a36Sopenharmony_ci	help
14862306a36Sopenharmony_ci	  This driver uses the efi.<service> function pointers directly instead
14962306a36Sopenharmony_ci	  of going through the efivar API, because it is not trying to test the
15062306a36Sopenharmony_ci	  kernel subsystem, just for testing the UEFI runtime service
15162306a36Sopenharmony_ci	  interfaces which are provided by the firmware. This driver is used
15262306a36Sopenharmony_ci	  by the Firmware Test Suite (FWTS) for testing the UEFI runtime
15362306a36Sopenharmony_ci	  interfaces readiness of the firmware.
15462306a36Sopenharmony_ci	  Details for FWTS are available from:
15562306a36Sopenharmony_ci	  <https://wiki.ubuntu.com/FirmwareTestSuite>
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci	  Say Y here to enable the runtime services support via /dev/efi_test.
15862306a36Sopenharmony_ci	  If unsure, say N.
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ciconfig EFI_DEV_PATH_PARSER
16162306a36Sopenharmony_ci	bool
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ciconfig APPLE_PROPERTIES
16462306a36Sopenharmony_ci	bool "Apple Device Properties"
16562306a36Sopenharmony_ci	depends on EFI_STUB && X86
16662306a36Sopenharmony_ci	select EFI_DEV_PATH_PARSER
16762306a36Sopenharmony_ci	select UCS2_STRING
16862306a36Sopenharmony_ci	help
16962306a36Sopenharmony_ci	  Retrieve properties from EFI on Apple Macs and assign them to
17062306a36Sopenharmony_ci	  devices, allowing for improved support of Apple hardware.
17162306a36Sopenharmony_ci	  Properties that would otherwise be missing include the
17262306a36Sopenharmony_ci	  Thunderbolt Device ROM and GPU configuration data.
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_ci	  If unsure, say Y if you have a Mac.  Otherwise N.
17562306a36Sopenharmony_ci
17662306a36Sopenharmony_ciconfig RESET_ATTACK_MITIGATION
17762306a36Sopenharmony_ci	bool "Reset memory attack mitigation"
17862306a36Sopenharmony_ci	depends on EFI_STUB
17962306a36Sopenharmony_ci	help
18062306a36Sopenharmony_ci	  Request that the firmware clear the contents of RAM after a reboot
18162306a36Sopenharmony_ci	  using the TCG Platform Reset Attack Mitigation specification. This
18262306a36Sopenharmony_ci	  protects against an attacker forcibly rebooting the system while it
18362306a36Sopenharmony_ci	  still contains secrets in RAM, booting another OS and extracting the
18462306a36Sopenharmony_ci	  secrets. This should only be enabled when userland is configured to
18562306a36Sopenharmony_ci	  clear the MemoryOverwriteRequest flag on clean shutdown after secrets
18662306a36Sopenharmony_ci	  have been evicted, since otherwise it will trigger even on clean
18762306a36Sopenharmony_ci	  reboots.
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ciconfig EFI_RCI2_TABLE
19062306a36Sopenharmony_ci	bool "EFI Runtime Configuration Interface Table Version 2 Support"
19162306a36Sopenharmony_ci	depends on X86 || COMPILE_TEST
19262306a36Sopenharmony_ci	help
19362306a36Sopenharmony_ci	  Displays the content of the Runtime Configuration Interface
19462306a36Sopenharmony_ci	  Table version 2 on Dell EMC PowerEdge systems as a binary
19562306a36Sopenharmony_ci	  attribute 'rci2' under /sys/firmware/efi/tables directory.
19662306a36Sopenharmony_ci
19762306a36Sopenharmony_ci	  RCI2 table contains BIOS HII in XML format and is used to populate
19862306a36Sopenharmony_ci	  BIOS setup page in Dell EMC OpenManage Server Administrator tool.
19962306a36Sopenharmony_ci	  The BIOS setup page contains BIOS tokens which can be configured.
20062306a36Sopenharmony_ci
20162306a36Sopenharmony_ci	  Say Y here for Dell EMC PowerEdge systems.
20262306a36Sopenharmony_ci
20362306a36Sopenharmony_ciconfig EFI_DISABLE_PCI_DMA
20462306a36Sopenharmony_ci       bool "Clear Busmaster bit on PCI bridges during ExitBootServices()"
20562306a36Sopenharmony_ci       help
20662306a36Sopenharmony_ci	  Disable the busmaster bit in the control register on all PCI bridges
20762306a36Sopenharmony_ci	  while calling ExitBootServices() and passing control to the runtime
20862306a36Sopenharmony_ci	  kernel. System firmware may configure the IOMMU to prevent malicious
20962306a36Sopenharmony_ci	  PCI devices from being able to attack the OS via DMA. However, since
21062306a36Sopenharmony_ci	  firmware can't guarantee that the OS is IOMMU-aware, it will tear
21162306a36Sopenharmony_ci	  down IOMMU configuration when ExitBootServices() is called. This
21262306a36Sopenharmony_ci	  leaves a window between where a hostile device could still cause
21362306a36Sopenharmony_ci	  damage before Linux configures the IOMMU again.
21462306a36Sopenharmony_ci
21562306a36Sopenharmony_ci	  If you say Y here, the EFI stub will clear the busmaster bit on all
21662306a36Sopenharmony_ci	  PCI bridges before ExitBootServices() is called. This will prevent
21762306a36Sopenharmony_ci	  any malicious PCI devices from being able to perform DMA until the
21862306a36Sopenharmony_ci	  kernel reenables busmastering after configuring the IOMMU.
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ci	  This option will cause failures with some poorly behaved hardware
22162306a36Sopenharmony_ci	  and should not be enabled without testing. The kernel commandline
22262306a36Sopenharmony_ci	  options "efi=disable_early_pci_dma" or "efi=no_disable_early_pci_dma"
22362306a36Sopenharmony_ci	  may be used to override this option.
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ciconfig EFI_EARLYCON
22662306a36Sopenharmony_ci	def_bool y
22762306a36Sopenharmony_ci	depends on SERIAL_EARLYCON && !ARM && !IA64
22862306a36Sopenharmony_ci	select FONT_SUPPORT
22962306a36Sopenharmony_ci	select ARCH_USE_MEMREMAP_PROT
23062306a36Sopenharmony_ci
23162306a36Sopenharmony_ciconfig EFI_CUSTOM_SSDT_OVERLAYS
23262306a36Sopenharmony_ci	bool "Load custom ACPI SSDT overlay from an EFI variable"
23362306a36Sopenharmony_ci	depends on ACPI
23462306a36Sopenharmony_ci	default ACPI_TABLE_UPGRADE
23562306a36Sopenharmony_ci	help
23662306a36Sopenharmony_ci	  Allow loading of an ACPI SSDT overlay from an EFI variable specified
23762306a36Sopenharmony_ci	  by a kernel command line option.
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ci	  See Documentation/admin-guide/acpi/ssdt-overlays.rst for more
24062306a36Sopenharmony_ci	  information.
24162306a36Sopenharmony_ci
24262306a36Sopenharmony_ciconfig EFI_DISABLE_RUNTIME
24362306a36Sopenharmony_ci	bool "Disable EFI runtime services support by default"
24462306a36Sopenharmony_ci	default y if PREEMPT_RT
24562306a36Sopenharmony_ci	help
24662306a36Sopenharmony_ci	  Allow to disable the EFI runtime services support by default. This can
24762306a36Sopenharmony_ci	  already be achieved by using the efi=noruntime option, but it could be
24862306a36Sopenharmony_ci	  useful to have this default without any kernel command line parameter.
24962306a36Sopenharmony_ci
25062306a36Sopenharmony_ci	  The EFI runtime services are disabled by default when PREEMPT_RT is
25162306a36Sopenharmony_ci	  enabled, because measurements have shown that some EFI functions calls
25262306a36Sopenharmony_ci	  might take too much time to complete, causing large latencies which is
25362306a36Sopenharmony_ci	  an issue for Real-Time kernels.
25462306a36Sopenharmony_ci
25562306a36Sopenharmony_ci	  This default can be overridden by using the efi=runtime option.
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_ciconfig EFI_COCO_SECRET
25862306a36Sopenharmony_ci	bool "EFI Confidential Computing Secret Area Support"
25962306a36Sopenharmony_ci	help
26062306a36Sopenharmony_ci	  Confidential Computing platforms (such as AMD SEV) allow the
26162306a36Sopenharmony_ci	  Guest Owner to securely inject secrets during guest VM launch.
26262306a36Sopenharmony_ci	  The secrets are placed in a designated EFI reserved memory area.
26362306a36Sopenharmony_ci
26462306a36Sopenharmony_ci	  In order to use the secrets in the kernel, the location of the secret
26562306a36Sopenharmony_ci	  area (as published in the EFI config table) must be kept.
26662306a36Sopenharmony_ci
26762306a36Sopenharmony_ci	  If you say Y here, the address of the EFI secret area will be kept
26862306a36Sopenharmony_ci	  for usage inside the kernel.  This will allow the
26962306a36Sopenharmony_ci	  virt/coco/efi_secret module to access the secrets, which in turn
27062306a36Sopenharmony_ci	  allows userspace programs to access the injected secrets.
27162306a36Sopenharmony_ci
27262306a36Sopenharmony_ciconfig UNACCEPTED_MEMORY
27362306a36Sopenharmony_ci	bool
27462306a36Sopenharmony_ci	depends on EFI_STUB
27562306a36Sopenharmony_ci	help
27662306a36Sopenharmony_ci	   Some Virtual Machine platforms, such as Intel TDX, require
27762306a36Sopenharmony_ci	   some memory to be "accepted" by the guest before it can be used.
27862306a36Sopenharmony_ci	   This mechanism helps prevent malicious hosts from making changes
27962306a36Sopenharmony_ci	   to guest memory.
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ci	   UEFI specification v2.9 introduced EFI_UNACCEPTED_MEMORY memory type.
28262306a36Sopenharmony_ci
28362306a36Sopenharmony_ci	   This option adds support for unaccepted memory and makes such memory
28462306a36Sopenharmony_ci	   usable by the kernel.
28562306a36Sopenharmony_ci
28662306a36Sopenharmony_ciconfig EFI_EMBEDDED_FIRMWARE
28762306a36Sopenharmony_ci	bool
28862306a36Sopenharmony_ci	select CRYPTO_LIB_SHA256
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_ciendmenu
29162306a36Sopenharmony_ci
29262306a36Sopenharmony_ciconfig UEFI_CPER
29362306a36Sopenharmony_ci	bool
29462306a36Sopenharmony_ci
29562306a36Sopenharmony_ciconfig UEFI_CPER_ARM
29662306a36Sopenharmony_ci	bool
29762306a36Sopenharmony_ci	depends on UEFI_CPER && ( ARM || ARM64 )
29862306a36Sopenharmony_ci	default y
29962306a36Sopenharmony_ci
30062306a36Sopenharmony_ciconfig UEFI_CPER_X86
30162306a36Sopenharmony_ci	bool
30262306a36Sopenharmony_ci	depends on UEFI_CPER && X86
30362306a36Sopenharmony_ci	default y
304