if PAYLOAD_EDK2

config PAYLOAD_FILE
	string "edk2 binary"
	default "$(obj)/UEFIPAYLOAD.fd"
	help
	  The result of a UefiPayloadPkg build

choice
	prompt "Tianocore's EDK II payload"
	default EDK2_UEFIPAYLOAD
	help
	  Select which type of payload edk2 will build (default is UefiPayload)
	  UefiPayload: MrChromebox's customized fork of edk2 which works on most
	  x86_64 devices
	  Upstream: Use upstream edk2 payload from https://github.com/tianocore/edk2

config EDK2_UEFIPAYLOAD
	bool "UEFIPayload"
	help
	  Select this option to build using MrChromebox's custom edk2 fork,
	  which incorporates fixes/improvements from System 76's and 9elements' trees.

config EDK2_UPSTREAM
	bool "Upstream"
	help
	  Select this option if you want to use upstream edk2 to build edk2.

config EDK2_CUSTOM
	bool "Custom"
	help
	  Specify your own edk2 repository and branch to use.

endchoice

config EDK2_REPOSITORY
	string "URL to git repository for edk2"
	default "https://github.com/tianocore/edk2" if EDK2_UPSTREAM
	default "https://github.com/mrchromebox/edk2" if EDK2_UEFIPAYLOAD
	help
	  coreboot supports an array of build options which can be found below. These options
	  will only have an effect if the relevant options exist in the target repository.

config EDK2_TAG_OR_REV
	string "Insert a commit's SHA-1 or a branch name"
	default "origin/uefipayload_202207" if EDK2_UEFIPAYLOAD
	default "origin/master" if EDK2_UPSTREAM
	help
	  The commit's SHA-1 or branch name of the revision to use. This must exist in
	  EDK2_REPOSITORY, and in the case of a branch name, prefixed with origin i.e.
	  "origin/uefipayload_202202"

config EDK2_USE_EDK2_PLATFORMS
	bool "Use edk2-platforms repository"
	default n
	help
	  Clone edk2-platforms repository to the edk2 workspace for additional modules.

if EDK2_USE_EDK2_PLATFORMS

config EDK2_PLATFORMS_REPOSITORY
	string "URL to git repository for edk2-platforms"
	default "https://github.com/tianocore/edk2-platforms"
	help
	  URL to the edk2-platfors repository to clone.

config EDK2_PLATFORMS_TAG_OR_REV
	string "Insert a commit's SHA-1 or a branch name"
	default "origin/master"
	help
	  The commit's SHA-1 or branch name of the revision to use. This must exist in
	  EDK2_PLATFORMS_REPOSITORY, and in the case of a branch name, prefixed with
	  origin i.e. "origin/master"

endif

choice
	prompt "edk2 build"
	default EDK2_RELEASE
	help
	  Select whether to generate a debug or release build for
	  edk2; default is to generate a release build.

config EDK2_DEBUG
	bool "Generate edk2 debug build"
	help
	  Generate a debug build.

config EDK2_RELEASE
	bool "Generate edk2 release build"
	help
	  Generate a release build.

endchoice

if EDK2_UEFIPAYLOAD || EDK2_CUSTOM || EDK2_UPSTREAM

config EDK2_ABOVE_4G_MEMORY
	bool "Enable above 4G memory"
	default n
	help
	  Select this option to enable Above 4G Decode. This will allow the
	  payload to use all of the memory, rather than an maximum of 4G.

	  Disabling memory above 4G is useful for bootloaders that are not
	  fully 64-bit aware such as Qubes R4.0.4 bootloader.

config EDK2_BOOTSPLASH_FILE
	string "edk2 Bootsplash path and filename"
	default "Documentation/coreboot_logo.bmp"
	help
	  The path and filename of the file to use as graphical bootsplash
	  image. If this option is not configured, the default
	  coreboot logo (European Brown Hare) will used.

	  You can use any image format supported by imagemagick, a list of which
	  can be found [here](https://imagemagick.org/script/formats.php).

	  The build process will automatically convert this to the format that
	  edk2 requires, which is an uncompressed BMP, in BMP3 format. It does
	  this using imagemagick (`convert splosh.bmp BMP3:splash.bmp`).

	  The newly formatted file will be the dimensions size as the original
	  one.

	  The build process will automatically do this conversion, so it can
	  be supplied with any format that imagemagick can process (which is
	  pretty much any!).

	  This image will also be used as the BGRT boot image, which may
	  persist through your OS boot process.

	  See ACPI spec 6.3, 5.2.22 Boot Graphics Resource Table (BGRT), and
	  Microsoft's documentation on BGRT positioning:
	  Docs/Windows/Windows Drivers/Bring up guide/Boot screen components

	  Accordingly, the image used should be no taller/wider than 40% of
	  the display panel's native pixel height/width (or resolution set).

	  If an absolute path is not given, the path will assumed to be
	  relative to the coreboot root directory.

config EDK2_BOOT_MANAGER_ESCAPE
	bool "Use Escape key for Boot Manager"
	default n
	help
	  Use Escape as the hot-key to access the Boot Manager. This replaces
	  the default key of F2.

config EDK2_BOOT_TIMEOUT
	int "Set the timeout for boot menu prompt"
	default 2
	help
	  The length of time in seconds for which the boot splash/menu prompt will be displayed.
	  For boards with an internal display, the default value of 2s is generally sufficient.
	  For boards with an external display, a value of 5s is generally sufficient.

config EDK2_CBMEM_LOGGING
	bool "Enable edk2 logging to CBMEM"
	help
	  Select this option if you want to enable edk2 logging to CBMEM.
	  You may want to increase the default cbmem buffer size when selecting
	  this option, especially if using a debug (vs release) build.
	  Selecting this option will increase the payload size in CBFS by 0x10000.

config EDK2_SYSTEM76_EC_LOGGING
	bool "Enable edk2 logging to System76 EC"
	help
	  Select this option if you want to enable edk2 logging to S76 EC.

config EDK2_FOLLOW_BGRT_SPEC
	bool "Center logo 38.2% from the top of screen"
	default n
	help
	  Follow the BGRT Specification implemented by Microsoft and
	  the Boot Logo 38.2% will be vertically centered 38.2% from
	  the top of the display.

config EDK2_FULL_SCREEN_SETUP
	bool "Use the full screen for the edk2 frontpage"
	default y
	help
	  Allow edk2 to use the full screen to display the frontpage
	  (aka "Boot Menu"). With this option disable, it will be
	  limited to 640x480.

config EDK2_HAVE_EFI_SHELL
	bool "Include EFI Shell"
	default y
	help
	  Include the EFI shell Binary

config EDK2_PRIORITIZE_INTERNAL
	bool "Prioritize internal boot devices"
	default y
	help
	  Prioritize internal boot devices over external devices

config EDK2_PS2_SUPPORT
	bool "Support PS/2 Keyboards"
	default y
	help
	  Include support for PS/2 keyboards

config EDK2_SD_MMC_TIMEOUT
	int "Timeout in ms for initializing SD and eMMC devices"
	default 10
	help
	  The amount of time allowed to initialize the SD Card reader and/or eMMC drive.
	  Most only require 10ms, but certain readers can take 1s.

config EDK2_SERIAL_SUPPORT
	bool "Support serial output"
	default y if EDK2_DEBUG
	default n
	help
	  Enable serial port output in edk2. Serial output limits the performance of edk2's
	  FrontPage.

config EDK2_ENABLE_IPXE
	bool "Include iPXE in edk2 payload"
	default n
	select PXE
	help
	  Instructs coreboot build system to build iPXE EFI target and include
	  it in the EDK2 payload.

config EDK2_IPXE_OPTION_NAME
	string "iPXE option name"
	depends on EDK2_ENABLE_IPXE
	default "iPXE Network Boot"
	help
	  Configures how the iPXE boot option should be displayed in boot menu
	  of EDK2 Payload. This name will be passed as PCD to the EDK2 build
	  system.

config EDK2_SECURE_BOOT
	bool "Enable UEFI Secure Boot"
	depends on SMMSTORE_V2
	default n
	help
	  Enables UEFI Secure Boot image verification in EDK2 Payload.

config EDK2_SATA_PASSWORD
	bool "Enable TianoCore SATA disk password"
	default n
	help
	  Enable SATA disk password suupport in the TianoCore payload.

config EDK2_OPAL_PASSWORD
	bool "Enable TianoCore TCG OPAL password"
	default n
	help
	  Enables TCG OPAL disk password in the TianoCore Payload.

# DasharoModulePkg specific options

config EDK2_DASHARO_SYSTEM_FEATURES
	bool "Enable Dasharo System Features menu in EDK2"
	default n
	help
	  Enables Dasharo System Features submenu in the EDK2 setup menu.

if EDK2_DASHARO_SYSTEM_FEATURES

config EDK2_DASHARO_SECURITY_OPTIONS
	bool "Enable EDK2 Dasharo Security Options Menu"
	default n
	help
	  Enables the security configuration submenu in Dasharo System Features.

config EDK2_DASHARO_INTEL_ME_OPTIONS
	bool "Enable EDK2 Dasharo ME Configuration Menu"
	default n
	help
	  Enables the Intel ME configuration submenu in Dasharo System Features.

config EDK2_DASHARO_USB_CONFIG
	bool "Enable EDK2 Dasharo USB Configuration Menu"
	default n
	help
	  Enables the EDK2 USB stack configuration submenu in Dasharo System Features.

config EDK2_DASHARO_NETWORK_CONFIG
	bool "Enable EDK2 Dasharo Network Stack Configuration Menu"
	default n
	help
	  Enables the EDK2 network stack configuration submenu in Dasharo System Features.

config EDK2_DASHARO_CHIPSET_CONFIG
	bool "Enable EDK2 Dasharo Chipset Configuration Menu"
	default n
	help
	  Enables the EDK2 chipset configuration submenu in Dasharo System Features menu.

config EDK2_DASHARO_POWER_CONFIG
	bool "Enable EDK2 Dasharo Power Configuration Menu"
	default n
	help
	  Enables the EDK2 power management configuration submenu in Dasharo System
	  Features menu.

if EDK2_DASHARO_POWER_CONFIG

config EDK2_DASHARO_POWER_CONFIG_FAN_CURVE
	bool "Enable EDK2 Fan Curve options in Dasharo Power Configuration Menu"
	default n
	help
	  Enables fan curve options in the EDK2 power management configuration
	  submenu.

config EDK2_DASHARO_POWER_CONFIG_BATTERY_THRESHOLDS
	bool "Enable EDK2 Battery Threshold options in Dasharo Power Configuration Menu"
	default n
	help
	  Enables battery threshold options in the EDK2 power management
	  configuration submenu.
endif

config EDK2_DASHARO_NETWORK_BOOT_DEFAULT_ENABLE
	bool "Enable EDK2 network boot option by default"
	default n
	help
	  Enables the network boot option in EDK2 by default.

endif

# End of DasharoModulePkg specific options

config EDK2_BOOT_MENU_KEY
	hex "TianoCore boot menu key"
	default 0x0016
	help
	  Select the TianoCore payload boot menu key:
	  UP         0x0001
	  DOWN       0x0002
	  RIGHT      0x0003
	  LEFT       0x0004
	  HOME       0x0005
	  END        0x0006
	  INSERT     0x0007
	  DELETE     0x0008
	  F1         0x000B
	  F2         0x000C
	  F3         0x000D
	  F4         0x000E
	  F5         0x000F
	  F6         0x0010
	  F7         0x0011
	  F8         0x0012
	  F9         0x0013
	  F10        0x0014
	  F11        0x0015
	  F12        0x0016
	  ESC        0x0017

config EDK2_SETUP_MENU_KEY
	hex "TianoCore setup menu key"
	default 0x0017
	help
	  Select the TianoCore payload setup menu key:
	  UP         0x0001
	  DOWN       0x0002
	  RIGHT      0x0003
	  LEFT       0x0004
	  HOME       0x0005
	  END        0x0006
	  INSERT     0x0007
	  DELETE     0x0008
	  F1         0x000B
	  F2         0x000C
	  F3         0x000D
	  F4         0x000E
	  F5         0x000F
	  F6         0x0010
	  F7         0x0011
	  F8         0x0012
	  F9         0x0013
	  F10        0x0014
	  F11        0x0015
	  F12        0x0016
	  ESC        0x0017

config EDK2_DISABLE_MTRR_PROGRAMMING
	bool "Disable MTRR programming in EDK2 Payload"
	default y
	help
	  Disables MTRRs programming in the TianoCore Payload.

if EDK2_SECURE_BOOT

config EDK2_SECURE_BOOT_DEFAULT_ENABLE
	bool "Set Secure Boot state to enabled by default"
	default y
	help
	  Sets the UEFI Secure Boot state to enabled by default.

endif

endif

config EDK2_CUSTOM_BUILD_PARAMS
	string "edk2 additional custom build parameters"
	default "-D VARIABLE_SUPPORT=SMMSTORE" if EDK2_UEFIPAYLOAD && SMMSTORE_V2
	help
	  edk2 has build options that are not modified by coreboot, and these can be
	  found in `UefiPayloadPkg/UefiPayloadPkg.dsc`. Forks may also support
	  additional build options that should have been upstreamed but have not.

	  This option can support both macros `-D` and Pcds `--pcd`.

config EDK2_LAN_ROM_DRIVER
	string "Optional LAN ROM driver file"
	help
	  Integrates LAN ROM driver in TianoCore Payload. Takes an EFI driver
	  as input.

endif
