# SPDX-License-Identifier: GPL-2.0-only

menu "Firmware files"

config EXTRA_FIRMWARE_DIR
	string "Firmware blobs root directory"
	default "firmware"

config MISSING_FIRMWARE_ERROR
	bool "Fail the build when required firmware is missing"
	default y
	# This prevents firmware errors from breaking allyesconfig builds
	depends on !COMPILE_TEST
	help
	  In-tree Defconfigs that enable multiple boards with different firmware
	  binary requirements would say y here, so you don't need unrelated firmware
	  for the build to succeed.

	  Defconfigs custom-tailored to products would say n here as all boards
	  being built should be functional and have their firmware available.

	  If in doubt, say Y and refer to the documentation on where to acquire the
	  needed firmware.

config FIRMWARE_IMX_LPDDR4_PMU_TRAIN
	bool

config FIRMWARE_IMX_DDR4_PMU_TRAIN
	bool

config FIRMWARE_IMX8MM_ATF
	bool

config FIRMWARE_IMX8MN_ATF
	bool

config FIRMWARE_IMX8MP_ATF
	bool

config FIRMWARE_IMX8MQ_ATF
	bool

config FIRMWARE_IMX93_ATF
	bool

config FIRMWARE_AGILEX5_ATF
	bool

config FIRMWARE_IMX8MM_OPTEE
	bool "install OP-TEE on i.MX8MM boards"
	depends on FIRMWARE_IMX8MM_ATF && PBL_OPTEE
	help
	  This enables OP-TEE loading and starting on i.MX8MM. Place the OP-TEE binary
	  in CONFIG_EXTRA_FIRMWARE_DIR/imx8mm-bl32.bin. When this option is enabled then
	  the TF-A binary will be used from CONFIG_EXTRA_FIRMWARE_DIR/imx8mm-bl31.bin-optee.

config FIRMWARE_IMX8MN_OPTEE
	bool "install OP-TEE on i.MX8MN boards"
	depends on FIRMWARE_IMX8MN_ATF && PBL_OPTEE
	help
	  This enables OP-TEE loading and starting on i.MX8MN. Place the OP-TEE binary
	  in CONFIG_EXTRA_FIRMWARE_DIR/imx8mn-bl32.bin. When this option is enabled then
	  the TF-A binary will be used from CONFIG_EXTRA_FIRMWARE_DIR/imx8mn-bl31.bin-optee.

config FIRMWARE_IMX8MP_OPTEE
	bool "install OP-TEE on i.MX8MP boards"
	depends on FIRMWARE_IMX8MP_ATF && PBL_OPTEE
	help
	  This enables OP-TEE loading and starting on i.MX8MP. Place the OP-TEE binary
	  in CONFIG_EXTRA_FIRMWARE_DIR/imx8mp-bl32.bin. When this option is enabled then
	  the TF-A binary will be used from CONFIG_EXTRA_FIRMWARE_DIR/imx8mp-bl31.bin-optee.

config FIRMWARE_IMX8MQ_OPTEE
	bool "install OP-TEE on i.MX8MQ boards"
	depends on FIRMWARE_IMX8MQ_ATF && PBL_OPTEE
	help
	  This enables OP-TEE loading and starting on i.MX8MQ. Place the OP-TEE binary
	  in CONFIG_EXTRA_FIRMWARE_DIR/imx8mq-bl32.bin. When this option is enabled then
	  the TF-A binary will be used from CONFIG_EXTRA_FIRMWARE_DIR/imx8mq-bl31.bin-optee.

config FIRMWARE_IMX93_OPTEE
	bool "install OP-TEE on i.MX93 boards"
	depends on FIRMWARE_IMX93_ATF && PBL_OPTEE
	help
	  This enables OP-TEE loading and starting on i.MX93. Place the OP-TEE binary
	  in CONFIG_EXTRA_FIRMWARE_DIR/imx93-bl32.bin. When this option is enabled then
	  the TF-A binary will be used from CONFIG_EXTRA_FIRMWARE_DIR/imx93-bl31.bin-optee.
	  Additionally OP-TEE requires a RAM firmware loaded into the ELE. This is expected
	  in CONFIG_EXTRA_FIRMWARE_DIR/mx93a1-ahab-container.img. You can obtain it from
	  https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-ele-imx-0.1.1.bin

config FIRMWARE_IMX93_OPTEE_A0
	bool "install OP-TEE on i.MX93 older A0 revision boards"
	depends on FIRMWARE_IMX93_OPTEE
	help
	  Additionally OP-TEE requires a RAM firmware loaded into the ELE. This is expected
	  in CONFIG_EXTRA_FIRMWARE_DIR/mx93a0-ahab-container.img. You can obtain it from
	  https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-ele-imx-0.1.0.bin

config FIRMWARE_TQMA6UL_OPTEE
	bool
	depends on MACH_TQMA6UL && PBL_OPTEE
	default y

config FIRMWARE_CCBV2_OPTEE
	bool
	depends on MACH_WEBASTO_CCBV2 && PBL_OPTEE
	default y

config FIRMWARE_LS1028A_ATF
	bool

config FIRMWARE_LS1046A_ATF
	bool

config HAVE_FIRMWARE_VERIFY_NEXT_IMAGE
	bool

config FIRMWARE_VERIFY_NEXT_IMAGE
	depends on HAVE_FIRMWARE_VERIFY_NEXT_IMAGE
	bool "verify next image to load"
	help
	  The boot process of some SoCs uses multiple stages where the first stage is
	  a stripped down barebox loaded by the SoC's ROM and the next state is a full
	  barebox loaded by the first stage. In a trusted boot scenario the next stage
	  has to be verified by the first stage,

	  This option allows to specify the next image to be loaded. Put the next stage
	  image to firmware/next-image.bin. The next-image.bin won't be added to the
	  barebox binary, but a sha256 hash of the image will be generated and compiled
	  into the first stage which can be used to verify the next stage.

	  Note that this option only enabled generation of the sha256 hash. Loading and
	  starting the next stage is highly SoC dependent and it's the SoC code's
	  responsibility to actually verify the hash and to only start successfully
	  verified images. The function to check the next stage image hash is
	  firmware_next_image_verify(), make sure your SoC code uses it.

endmenu
