# Copyright (C) 2023, Advanced Micro Devices, Inc.  All rights reserved.
#
# SPDX-License-Identifier: MIT
#

if !SUBSYSTEM_SDT_FLOW && SYSTEM_ZYNQMP
menu "PMUFW Configuration"
if SUBSYSTEM_DISTRO_PETALINUX
config SUBSYSTEM_PMUFW_BSPCOMPILER_FLAGSSET
	bool
	default y if SUBSYSTEM_PMUFW_BSPCOMPILER_FLAGS != ""

config SUBSYSTEM_PMUFW_BSPCOMPILER_FLAGS
	string "PMUFW BSP extra compiler flags"
	default ""
	help
	 PMUFW BSP extra compiler flags. You can specify multiple flags separated with space.
	 E.g: -DXSK_ACCESS_USER_EFUSE for enabling USER EFUSE access
endif

config SUBSYSTEM_PMUFW_COMPILER_EXTRA_FLAGS
	string "PMUFW compiler flags"
	default ""
	help
	 PMUFW compilation flags. You can specify multiple flags separated with space.
	 E.g: -DENABLE_IPI_CRC for enabling CRC check on IPI messages

endmenu
endif

if SUBSYSTEM_DISTRO_PETALINUX && !SUBSYSTEM_SDT_FLOW && (SYSTEM_ZYNQMP || SUBSYSTEM_ARCH_ARM)
menu "FSBL Configuration"
config SUBSYSTEM_FSBL_BSPCOMPILER_FLAGSSET
	bool
	default y if SUBSYSTEM_FSBL_BSPCOMPILER_FLAGS != ""

config SUBSYSTEM_FSBL_BSPCOMPILER_FLAGS
	string "FSBL BSP extra compiler flags"
	default ""
	help
	 FSBL BSP extra compiler flags. You can specify multiple flags separated with space.
	 E.g: -DENABLE_IPI_CRC for enabling CRC check on IPI messages

config SUBSYSTEM_FSBL_COMPILER_EXTRA_FLAGS
	string "FSBL compiler flags"
	default ""
	help
	 FSBL compilation flags. You can specify multiple flags separated with space.
	 E.g: -DFSBL_PROT_BYPASS

endmenu
endif

if SUBSYSTEM_ARCH_AARCH64 && !SUBSYSTEM_COMPONENT_TRUSTED__FIRMWARE__ARM_NAME_NONE
menu "Trusted Firmware ARM (TF-A) Configuration"
config SUBSYSTEM_TF-A_MEMORY_SETTINGS
	bool "TF-A memory settings"
	default n
	help
	 Select this option, if membase and memsize settings of TF-A are to be modified.These are defined already in tfa source.
	  Use this option inorder to over-ride these values.For further info: ref trusted-firmware-arm/docs/plat/*.md's

if SUBSYSTEM_TF-A_MEMORY_SETTINGS
config SUBSYSTEM_TF-A_MEM_BASE
	hex "TF-A MEM BASE"
	default 0xFFFEA000
	help
	  On default the TF-A is placed in OCM memory. Alternatively, the TF-A can be
	  placed in DRAM by updating TF-A_MEM_BASE and TF-A_MEM_SIZE.

config SUBSYSTEM_TF-A_MEM_SIZE
	hex "TF-A MEM SIZE"
	default 0x16000
	help
	  Mention the TF-A size.
endif

config SUBSYSTEM_TF-A_EXTRA_COMPILER_FLAGS
	string "TF-A extra compiler flags"
	default ""
	help
	  TF-A extra compilation flags. You can specify multiple flags separated with semicolon.
	  (NEW!) : ZYNQMP_WDT_RESTART=1 for Special handling to cleanly restart the APU during AWDT recovery
	  Other E.g. MAKEARCH+=RESET_TO_BL31=1 SPD=tspd; ATF_BUILD_TARGET=bl31 bl32

if SUBSYSTEM_DISTRO_PETALINUX
config SUBSYSTEM_TF-A_DEBUG
	bool "TF-A debug"
	default n
	help
	 Select this option for selecting TF-A debug mode
endif

endmenu
endif

if !SUBSYSTEM_COMPONENT_U__BOOT_NAME_NONE
menu "u-boot Configuration"
config SUBSYSTEM_UBOOT_CONFIG_TARGET
	string "u-boot config target"
	help
	  Keep empty or specify auto/AUTO it will point to the default
	  defconfig file based on the yocto machine name.
	  Specify a u-boot config target when building u-boot, it will run
	  run u-boot XXX config target: make XXX_config to configure u-boot
	  first.

menu "u-boot script configuration"
config SUBSYSTEM_UBOOT_APPEND_BASEADDR
	bool "Append base address to image offsets"
	default y
	help
	  Enable this to apped Memory/DDR base address to the offsets specified.

if SUBSYSTEM_DISTRO_PETALINUX
config SUBSYSTEM_UBOOT_PRE_BOOTENV
	string "Pre bootenv"
	default ""
	help
	  Add uboot environment variables which will add into boot.scr script.

menu "JTAG/DDR image offsets"
config SUBSYSTEM_UBOOT_DEVICETREE_OFFSET
	string "Devicetree offset"
	default 0x1000 if SYSTEM_VERSAL
	default 0x100000 if SYSTEM_ZYNQMP
	default 0x100000 if SUBSYSTEM_ARCH_ARM
	default 0x1e00000 if SUBSYSTEM_ARCH_MICROBLAZE
	help
	  Offset to load the Device-tree to the DDR/JTAG.

config SUBSYSTEM_UBOOT_KERNEL_OFFSET
	hex "Kernel offset"
	default 0x200000 if SYSTEM_VERSAL
	default 0x200000 if SYSTEM_ZYNQMP
	default 0x200000 if SUBSYSTEM_ARCH_ARM
	default 0x0 if SUBSYSTEM_ARCH_MICROBLAZE
	help
	  Offset to load the Kernel image to the DDR/JTAG.

config SUBSYSTEM_UBOOT_RAMDISK_IMAGE_OFFSET
	hex "Ramdisk image offset"
	default 0x4000000 if SYSTEM_VERSAL
	default 0x4000000 if SYSTEM_ZYNQMP
	default 0x4000000 if SUBSYSTEM_ARCH_ARM
	default 0x2e00000 if SUBSYSTEM_ARCH_MICROBLAZE
	help
	  Offset to load the Ramdisk image to the DDR/JTAG.

config SUBSYSTEM_UBOOT_FIT_IMAGE_OFFSET
	hex "Fit image offset"
	default "0x10000000"
	help
	  Offset to load the Fit image to the DDR/JTAG.

if !SUBSYSTEM_ARCH_MICROBLAZE
config SUBSYSTEM_UBOOT_BOOTSCR_OFFSET
	hex "Boot script offset"
	default 0x20000000 if SYSTEM_VERSAL
	default 0x20000000 if SYSTEM_ZYNQMP
	default 0x3000000 if SUBSYSTEM_ARCH_ARM
	help
	  Boot script offset to the DDR/JTAG.
endif
endmenu

menu "QSPI/OSPI image offsets"
config SUBSYSTEM_UBOOT_QSPI_KERNEL_OFFSET
	hex "QSPI/OSPI Kernel offset"
	default 0xF00000 if SYSTEM_VERSAL
	default 0x3F00000 if SUBSYSTEM_VARIANT_ZYNQMPDR
	default 0xF00000 if SYSTEM_ZYNQMP
	default 0xA00000 if SUBSYSTEM_ARCH_ARM
	default 0xBC0000 if SUBSYSTEM_ARCH_MICROBLAZE
	help
	  Specify the QSPI/OSPI Kernel image offset to read the Kernel image from Flash.

config SUBSYSTEM_UBOOT_QSPI_KERNEL_SIZE
	hex "QSPI/OSPI Kernel size"
	default 0x1D00000 if SYSTEM_VERSAL
	default 0x1D00000 if SYSTEM_ZYNQMP
	default 0x600000 if SUBSYSTEM_ARCH_ARM
	default 0x500000 if SUBSYSTEM_ARCH_MICROBLAZE
	help
	  Specify the QSPI/OSPI Kernel image size to read the Kernel image from Flash.

config SUBSYSTEM_UBOOT_QSPI_RAMDISK_OFFSET
	hex "QSPI/OSPI Ramdisk offset"
	default 0x2E00000 if SYSTEM_VERSAL
	default 0x5D00000 if SUBSYSTEM_VARIANT_ZYNQMPDR
	default 0x4000000 if SYSTEM_ZYNQMP
	default 0x1000000 if SUBSYSTEM_ARCH_ARM
	default 0x4000000 if SUBSYSTEM_ARCH_MICROBLAZE
	help
	  Specify the QSPI/OSPI Ramdisk image offset to read the Ramdisk image from Flash.

config SUBSYSTEM_UBOOT_QSPI_RAMDISK_SIZE
	hex "QSPI/OSPI Ramdisk size"
	default 0x4000000 if SYSTEM_VERSAL
	default 0x1D00000 if SUBSYSTEM_VARIANT_ZYNQMPDR
	default 0x4000000 if SYSTEM_ZYNQMP
	default 0xF80000 if SUBSYSTEM_ARCH_ARM
	default 0xA00000 if SUBSYSTEM_ARCH_MICROBLAZE
	help
	  Specify the QSPI/OSPI Ramdisk image size to read the Ramdisk image from Flash.

config SUBSYSTEM_UBOOT_QSPI_FIT_IMAGE_OFFSET
	hex "QSPI/OSPI fit image offset"
	default 0xF40000 if SYSTEM_VERSAL
	default 0x3F80000 if SUBSYSTEM_VARIANT_ZYNQMPDR
	default 0xF40000 if SYSTEM_ZYNQMP
	default 0xA80000 if SUBSYSTEM_ARCH_ARM
	default 0xE00000 if SUBSYSTEM_ARCH_MICROBLAZE
	help
	  Specify the QSPI/OSPI Fit image offset to read the Fit image from Flash.

config SUBSYSTEM_UBOOT_QSPI_FIT_IMAGE_SIZE
	hex "QSPI/OSPI fit image size"
	default 0x6400000 if SYSTEM_VERSAL
	default 0x3F00000 if SUBSYSTEM_VARIANT_ZYNQMPDR
	default 0x6400000 if SYSTEM_ZYNQMP
	default 0x1500000 if SUBSYSTEM_ARCH_ARM
	default 0xF00000 if SUBSYSTEM_ARCH_MICROBLAZE
	help
	  Specify the QSPI/OSPI Fit image size to read the Fit image from Flash.

if !SUBSYSTEM_ARCH_MICROBLAZE
config SUBSYSTEM_UBOOT_QSPI_BOOTSCR_OFFSET
	string "QSPI/OSPI Boot script offset"
	default "AUTO"
	help
	  Specify the QSPI/OSPI boot script offset to read the boot script from Flash.
	  if QSPI/OSPI boot script offset value modified then QSPI/OSPI boot script size
	  value should also change.

config SUBSYSTEM_UBOOT_QSPI_BOOTSCR_SIZE
	string "QSPI/OSPI Boot script size"
	default "AUTO"
	help
	  Specify the QSPI/OSPI boot script size to read the boot script from Flash.
	  if QSPI/OSPI boot script size value modified then QSPI/OSPI boot script offset
	  value should also change.
endif
endmenu
menu "NAND image offsets"
config SUBSYSTEM_UBOOT_NAND_KERNEL_OFFSET
	hex "NAND Kernel offset"
	default 0x4100000 if SYSTEM_VERSAL
	default 0x4100000 if SYSTEM_ZYNQMP
	default 0x1000000 if SUBSYSTEM_ARCH_ARM
	default 0x0
	help
	  Specify the NAND Kernel image offset to read the Kernel image from Flash.

config SUBSYSTEM_UBOOT_NAND_KERNEL_SIZE
	hex "NAND Kernel size"
	default 0x3200000
	help
	  Specify the NAND Kernel image size to read the Kernel image from Flash.

config SUBSYSTEM_UBOOT_NAND_RAMDISK_OFFSET
	hex "NAND Ramdisk offset"
	default 0x8200000 if SYSTEM_VERSAL
	default 0x7800000 if SYSTEM_ZYNQMP
	default 0x4600000 if SUBSYSTEM_ARCH_ARM
	default 0x0
	help
	  Specify the NAND ramdisk image offset to load the ramdisk image from Flash.

config SUBSYSTEM_UBOOT_NAND_RAMDISK_SIZE
	hex "NAND Ramdisk size"
	default 0x3200000
	help
	  Specify the NAND ramdisk size to load the ramdisk image from Flash.

config SUBSYSTEM_UBOOT_NAND_FIT_IMAGE_OFFSET
	hex "NAND fit image offset"
	default 0x4180000 if SYSTEM_VERSAL
	default 0x4180000 if SYSTEM_ZYNQMP
	default 0x1080000 if SUBSYSTEM_ARCH_ARM
	default 0x0
	help
	  Specify the fit image offset to load the fit image from Flash.

config SUBSYSTEM_UBOOT_NAND_FIT_IMAGE_SIZE
	hex "NAND fit image size"
	default 0x6400000
	help
	  Specify the NAND fit image size to load the fit image from Flash.

endmenu
config SUBSYSTEM_UBOOT_KERNEL_IMAGE
	string "Kernel image name"
	default "Image" if SYSTEM_VERSAL
	default "Image" if SYSTEM_ZYNQMP
	default "uImage" if SUBSYSTEM_ARCH_ARM
	default "linux.bin.ub" if SUBSYSTEM_ARCH_MICROBLAZE
	help
	  Specify the kernel image name.

config SUBSYSTEM_UBOOT_FIT_IMAGE
	string "Fit image name"
	default "image.ub"
	help
	  Specify the fit image name.

endif
endmenu

if SUBSYSTEM_DISTRO_PETALINUX
if SUBSYSTEM_AUTOCONFIG_U__BOOT
config SUBSYSTEM_NETBOOT_OFFSET
	hex "netboot offset"
	default 0x1000000
	help
	 Set this to define the memory offset to load the image of netboot command in u-boot.

config SUBSYSTEM_U__BOOT_TFTPSERVER_IP
	string "TFTP Server IP address"
	default "AUTO"
	help
	 The IP address of your TFTP file server in the main network interface.
	 Specify the special value "AUTO" to use the IP address of your
	 development host.

endif
config SUBSYSTEM_UBOOT_EXT_DTB
	bool "u-boot-ext-dtb"
	default n
        help
	 Select this option to build seperate dtb for u-boot.
	 If user select this option the source files will come from
	 design using DTG and user can customize the nodes by creating
	 system-user.dtsi in <plnx-proj>/project-spec/meta-user/meta-xilinx-tools/recipes-bsp/uboot-device-tree

if SUBSYSTEM_UBOOT_EXT_DTB
config UBOOT_EXT_DTB_FROM_DTS
	string "uboot dts file path"
	default ""
	help
	 Provide the absolute path for customized .dts file. The build system will use the
	 provided .dts file and generate the u-boot dtb in <plnx-proj>/images/linux directory.
	 NOTE: All dtsi files should be specified here with space separator
	 which are included in dts file
	 Example: /u-boot-dt-path/system-top.dts /u-boot-dt-path/zcu102.dtsi

config UBOOT_DTB_PACKAGE_NAME
	string "uboot dtb package name"
	default "u-boot.dtb"
	help
	 Select this option to specify desired u-boot dtb name.
	 Default it will be set to u-boot.dtb
endif
endif
endmenu

menu "Linux Configuration"
config SUBSYSTEM_LINUX_CONFIG_TARGET
	string "linux config target"
	help
	  Keep empty or specify auto/AUTO it will point to the default
	  defconfig file based on the yocto machine name.
	  Specify a linux config target when building linux, it will run
	  run linux XXX config target: make XXX_config to configure linux
	  first.

endmenu
endif
