diff mbox series

[v5,1/8] capsule: board: Add information needed for capsule updates

Message ID 20220401191759.1670812-2-sughosh.ganu@linaro.org
State New
Headers show
Series efi: capsule: Capsule Update fixes and enhancements | expand

Commit Message

Sughosh Ganu April 1, 2022, 7:17 p.m. UTC
Add a structure which defines the information that is needed for
executing capsule updates on a platform. Some information in the
structure is used for making the update process more robust while some
information is used for fixing some issues. Initialise this structure
in the board file, and use the information for the capsule updates.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
---

Changes since V1:

* Define a structure efi_capsule_update_info which includes the string
  for populating dfu_alt_info
* Initialise the string for dfu_alt_info in the board file


 .../imx8mp_rsb3720a1/imx8mp_rsb3720a1.c       | 25 +++++++++++++
 .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c   | 24 +++++++++++++
 board/emulation/qemu-arm/qemu-arm.c           | 24 +++++++++++++
 board/kontron/pitx_imx8m/pitx_imx8m.c         | 21 ++++++++++-
 board/kontron/sl-mx8mm/sl-mx8mm.c             | 20 +++++++++++
 board/kontron/sl28/sl28.c                     | 21 +++++++++++
 board/sandbox/sandbox.c                       | 34 ++++++++++++++++++
 board/socionext/developerbox/developerbox.c   | 33 +++++++++++++++++
 board/xilinx/common/board.c                   | 28 +++++++++++++++
 include/configs/imx8mm-cl-iot-gate.h          | 10 ++++++
 include/configs/imx8mp_rsb3720.h              | 10 ++++++
 include/configs/kontron-sl-mx8mm.h            |  6 ++++
 include/configs/kontron_pitx_imx8m.h          |  6 ++++
 include/configs/kontron_sl28.h                |  6 ++++
 include/configs/qemu-arm.h                    | 10 ++++++
 include/configs/sandbox.h                     | 14 ++++++++
 include/configs/synquacer.h                   | 14 ++++++++
 include/configs/xilinx_versal.h               |  6 ++++
 include/configs/xilinx_zynqmp.h               | 10 ++++++
 include/configs/zynq-common.h                 | 10 ++++++
 include/efi_loader.h                          | 36 +++++++++++++++++++
 21 files changed, 367 insertions(+), 1 deletion(-)

Comments

Heinrich Schuchardt April 2, 2022, 9:04 a.m. UTC | #1
On 4/1/22 21:17, Sughosh Ganu wrote:
> Add a structure which defines the information that is needed for
> executing capsule updates on a platform. Some information in the
> structure is used for making the update process more robust while some
> information is used for fixing some issues. Initialise this structure
> in the board file, and use the information for the capsule updates.
>
> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> ---
>
> Changes since V1:
>
> * Define a structure efi_capsule_update_info which includes the string
>    for populating dfu_alt_info
> * Initialise the string for dfu_alt_info in the board file
>
>
>   .../imx8mp_rsb3720a1/imx8mp_rsb3720a1.c       | 25 +++++++++++++
>   .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c   | 24 +++++++++++++
>   board/emulation/qemu-arm/qemu-arm.c           | 24 +++++++++++++
>   board/kontron/pitx_imx8m/pitx_imx8m.c         | 21 ++++++++++-
>   board/kontron/sl-mx8mm/sl-mx8mm.c             | 20 +++++++++++
>   board/kontron/sl28/sl28.c                     | 21 +++++++++++
>   board/sandbox/sandbox.c                       | 34 ++++++++++++++++++
>   board/socionext/developerbox/developerbox.c   | 33 +++++++++++++++++
>   board/xilinx/common/board.c                   | 28 +++++++++++++++
>   include/configs/imx8mm-cl-iot-gate.h          | 10 ++++++
>   include/configs/imx8mp_rsb3720.h              | 10 ++++++
>   include/configs/kontron-sl-mx8mm.h            |  6 ++++
>   include/configs/kontron_pitx_imx8m.h          |  6 ++++
>   include/configs/kontron_sl28.h                |  6 ++++
>   include/configs/qemu-arm.h                    | 10 ++++++
>   include/configs/sandbox.h                     | 14 ++++++++
>   include/configs/synquacer.h                   | 14 ++++++++
>   include/configs/xilinx_versal.h               |  6 ++++
>   include/configs/xilinx_zynqmp.h               | 10 ++++++
>   include/configs/zynq-common.h                 | 10 ++++++
>   include/efi_loader.h                          | 36 +++++++++++++++++++
>   21 files changed, 367 insertions(+), 1 deletion(-)
>
> diff --git a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
> index 16566092bd..aa9cfa8339 100644
> --- a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
> +++ b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
> @@ -6,6 +6,8 @@
>
>   #include <common.h>
>   #include <dwc3-uboot.h>
> +#include <efi.h>
> +#include <efi_loader.h>
>   #include <errno.h>
>   #include <miiphy.h>
>   #include <netdev.h>
> @@ -21,6 +23,7 @@
>   #include <asm/arch/clock.h>
>   #include <asm/mach-imx/dma.h>
>   #include <linux/delay.h>
> +#include <linux/kernel.h>
>   #include <power/pmic.h>
>
>   DECLARE_GLOBAL_DATA_PTR;
> @@ -44,6 +47,28 @@ static void setup_gpmi_nand(void)
>   }
>   #endif
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +struct efi_fw_images fw_images[] = {
> +	{
> +#if defined(CONFIG_TARGET_IMX8MP_RSB3720A1_4G)
> +		.image_type_id = IMX8MP_RSB3720A1_4G_FIT_IMAGE_GUID,
> +#elif defined(CONFIG_TARGET_IMX8MP_RSB3720A1_6G)
> +		.image_type_id = IMX8MP_RSB3720A1_6G_FIT_IMAGE_GUID,

I am missing a handler for all other cases here, e.g.

#else
#error Capsule update: firmware image GUID not defined

But why don't you do this like on the sandbox? Just create one entry per
known config item.

Then the image array will simply be empty for all other boards.

> +#endif
> +		.fw_name = u"IMX8MP-RSB3720-FIT",
> +		.image_index = 1,
> +	},
> +};
> +
> +struct efi_capsule_update_info update_info = {
> +	.dfu_string = "mmc 2=flash-bin raw 0 0x1B00 mmcpart 1",
> +	.images = fw_images,
> +};
> +
> +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
> +
>   int board_early_init_f(void)
>   {
>   	struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR;
> diff --git a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
> index 7e2d88f449..f2f5eb10f1 100644
> --- a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
> +++ b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
> @@ -5,6 +5,8 @@
>    */
>
>   #include <common.h>
> +#include <efi.h>
> +#include <efi_loader.h>
>   #include <env.h>
>   #include <extension_board.h>
>   #include <hang.h>
> @@ -21,11 +23,33 @@
>   #include <asm/mach-imx/gpio.h>
>   #include <asm/mach-imx/mxc_i2c.h>
>   #include <asm/sections.h>
> +#include <linux/kernel.h>
>
>   #include "ddr/ddr.h"
>
>   DECLARE_GLOBAL_DATA_PTR;
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +struct efi_fw_images fw_images[] = {
> +	{
> +#if defined(CONFIG_TARGET_IMX8MM_CL_IOT_GATE)
> +		.image_type_id = IMX8MM_CL_IOT_GATE_FIT_IMAGE_GUID,
> +#elif defined(CONFIG_TARGET_IMX8MM_CL_IOT_GATE_OPTEE)
> +		.image_type_id = IMX8MM_CL_IOT_GATE_OPTEE_FIT_IMAGE_GUID,
> +#endif
> +		.fw_name = u"IMX8MM-CL-IOT-GATE-FIT",
> +		.image_index = 1,
> +	},
> +};
> +
> +struct efi_capsule_update_info update_info = {
> +	.dfu_string = "mmc 2=flash-bin raw 0x42 0x1D00 mmcpart 1",
> +	.images = fw_images,
> +};
> +
> +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>   int board_phys_sdram_size(phys_size_t *size)
>   {
>   	struct lpddr4_tcm_desc *lpddr4_tcm_desc =
> diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
> index 16d5a97167..f36709ea27 100644
> --- a/board/emulation/qemu-arm/qemu-arm.c
> +++ b/board/emulation/qemu-arm/qemu-arm.c
> @@ -6,15 +6,39 @@
>   #include <common.h>
>   #include <cpu_func.h>
>   #include <dm.h>
> +#include <efi.h>
> +#include <efi_loader.h>
>   #include <fdtdec.h>
>   #include <init.h>
>   #include <log.h>
>   #include <virtio_types.h>
>   #include <virtio.h>
>
> +#include <linux/kernel.h>
> +
>   #ifdef CONFIG_ARM64
>   #include <asm/armv8/mmu.h>
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +struct efi_fw_images fw_images[] = {
> +	{
> +#if defined(CONFIG_TARGET_QEMU_ARM_32BIT)
> +		.image_type_id = QEMU_ARM_UBOOT_IMAGE_GUID,
> +#elif defined(CONFIG_TARGET_QEMU_ARM_64BIT)
> +		.image_type_id = QEMU_ARM64_UBOOT_IMAGE_GUID,
> +#endif
> +		.fw_name = u"Qemu-Arm-UBOOT",
> +		.image_index = 1,
> +	},
> +};
> +
> +struct efi_capsule_update_info update_info = {
> +	.images = fw_images,
> +};
> +
> +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>   static struct mm_region qemu_arm64_mem_map[] = {
>   	{
>   		/* Flash */
> diff --git a/board/kontron/pitx_imx8m/pitx_imx8m.c b/board/kontron/pitx_imx8m/pitx_imx8m.c
> index d655fe099b..a9329460f6 100644
> --- a/board/kontron/pitx_imx8m/pitx_imx8m.c
> +++ b/board/kontron/pitx_imx8m/pitx_imx8m.c
> @@ -2,6 +2,8 @@
>
>   #include "pitx_misc.h"
>   #include <common.h>
> +#include <efi.h>
> +#include <efi_loader.h>
>   #include <init.h>
>   #include <mmc.h>
>   #include <miiphy.h>
> @@ -12,7 +14,7 @@
>   #include <asm/mach-imx/gpio.h>
>   #include <asm/mach-imx/iomux-v3.h>
>   #include <linux/delay.h>
> -
> +#include <linux/kernel.h>
>
>   DECLARE_GLOBAL_DATA_PTR;
>
> @@ -30,6 +32,23 @@ static iomux_v3_cfg_t const uart_pads[] = {
>   	IMX8MQ_PAD_ECSPI1_MISO__UART3_CTS_B | MUX_PAD_CTRL(UART_PAD_CTRL),
>   };
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +struct efi_fw_images fw_images[] = {
> +	{
> +		.image_type_id = KONTRON_PITX_IMX8M_FIT_IMAGE_GUID,
> +		.fw_name = u"KONTRON-PITX-IMX8M-UBOOT",
> +		.image_index = 1,
> +	},
> +};
> +
> +struct efi_capsule_update_info update_info = {
> +	.dfu_string = "mmc 0=flash-bin raw 0x42 0x1000 mmcpart 1",
> +	.images = fw_images,
> +};
> +
> +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>   int board_early_init_f(void)
>   {
>   	struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR;
> diff --git a/board/kontron/sl-mx8mm/sl-mx8mm.c b/board/kontron/sl-mx8mm/sl-mx8mm.c
> index 48376cb826..287c572eeb 100644
> --- a/board/kontron/sl-mx8mm/sl-mx8mm.c
> +++ b/board/kontron/sl-mx8mm/sl-mx8mm.c
> @@ -6,12 +6,32 @@
>   #include <asm/arch/imx-regs.h>
>   #include <asm/global_data.h>
>   #include <asm/io.h>
> +#include <efi.h>
> +#include <efi_loader.h>
>   #include <fdt_support.h>
>   #include <linux/errno.h>
> +#include <linux/kernel.h>
>   #include <net.h>
>
>   DECLARE_GLOBAL_DATA_PTR;
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +struct efi_fw_images fw_images[] = {
> +	{
> +		.image_type_id = KONTRON_SL_MX8MM_FIT_IMAGE_GUID,
> +		.fw_name = u"KONTROL-SL-MX8MM-UBOOT",
> +		.image_index = 1,
> +	},
> +};
> +
> +struct efi_capsule_update_info update_info = {
> +	.dfu_string = "sf 0:0=flash-bin raw 0x400 0x1f0000",
> +	.images = fw_images,
> +};
> +
> +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>   int board_phys_sdram_size(phys_size_t *size)
>   {
>   	u32 ddr_size = readl(M4_BOOTROM_BASE_ADDR);
> diff --git a/board/kontron/sl28/sl28.c b/board/kontron/sl28/sl28.c
> index 3c48a9141d..0ffa351288 100644
> --- a/board/kontron/sl28/sl28.c
> +++ b/board/kontron/sl28/sl28.c
> @@ -3,11 +3,14 @@
>   #include <common.h>
>   #include <dm.h>
>   #include <malloc.h>
> +#include <efi.h>
> +#include <efi_loader.h>
>   #include <errno.h>
>   #include <fsl_ddr.h>
>   #include <fdt_support.h>
>   #include <asm/global_data.h>
>   #include <linux/libfdt.h>
> +#include <linux/kernel.h>
>   #include <env_internal.h>
>   #include <asm/arch-fsl-layerscape/soc.h>
>   #include <asm/arch-fsl-layerscape/fsl_icid.h>
> @@ -23,6 +26,24 @@
>
>   DECLARE_GLOBAL_DATA_PTR;
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +struct efi_fw_images fw_images[] = {
> +	{
> +		.image_type_id = KONTRON_SL28_FIT_IMAGE_GUID,
> +		.fw_name = u"KONTRON-SL28-FIT",
> +		.image_index = 1,
> +	},
> +};
> +
> +struct efi_capsule_update_info update_info = {
> +	.dfu_string = "sf 0:0=u-boot-bin raw 0x210000 0x1d0000;"
> +			"u-boot-env raw 0x3e0000 0x20000",
> +	.images = fw_images,
> +};
> +
> +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>   int board_early_init_f(void)
>   {
>   	fsl_lsch3_early_init_f();
> diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c
> index 5d9a945d64..d93aaa6a20 100644
> --- a/board/sandbox/sandbox.c
> +++ b/board/sandbox/sandbox.c
> @@ -7,6 +7,8 @@
>   #include <cpu_func.h>
>   #include <cros_ec.h>
>   #include <dm.h>
> +#include <efi.h>
> +#include <efi_loader.h>
>   #include <env_internal.h>
>   #include <init.h>
>   #include <led.h>
> @@ -14,6 +16,7 @@
>   #include <asm/global_data.h>
>   #include <asm/test.h>
>   #include <asm/u-boot-sandbox.h>
> +#include <linux/kernel.h>
>   #include <malloc.h>
>
>   #include <extension_board.h>
> @@ -25,6 +28,37 @@
>    */
>   gd_t *gd;
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +struct efi_fw_images fw_images[] = {
> +#if defined(CONFIG_EFI_CAPSULE_FIRMWARE_RAW)
> +	{
> +		.image_type_id = SANDBOX_UBOOT_IMAGE_GUID,
> +		.fw_name = u"SANDBOX-UBOOT",
> +		.image_index = 1,
> +	},
> +	{
> +		.image_type_id = SANDBOX_UBOOT_ENV_IMAGE_GUID,
> +		.fw_name = u"SANDBOX-UBOOT-ENV",
> +		.image_index = 2,
> +	},
> +#elif defined(CONFIG_EFI_CAPSULE_FIRMWARE_FIT)
> +	{
> +		.image_type_id = SANDBOX_FIT_IMAGE_GUID,
> +		.fw_name = u"SANDBOX-FIT",
> +		.image_index = 1,
> +	},
> +#endif
> +};
> +
> +struct efi_capsule_update_info update_info = {
> +	.dfu_string = "sf 0:0=u-boot-bin raw 0x100000 0x50000;"
> +		"u-boot-env raw 0x150000 0x200000",
> +	.images = fw_images,
> +};
> +
> +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>   #if !CONFIG_IS_ENABLED(OF_PLATDATA)
>   /*
>    * Add a simple GPIO device (don't use with of-platdata as it interferes with
> diff --git a/board/socionext/developerbox/developerbox.c b/board/socionext/developerbox/developerbox.c
> index 9552bfcdc3..7820b7e68a 100644
> --- a/board/socionext/developerbox/developerbox.c
> +++ b/board/socionext/developerbox/developerbox.c
> @@ -10,10 +10,43 @@
>   #include <asm/global_data.h>
>   #include <asm/io.h>
>   #include <common.h>
> +#include <efi.h>
> +#include <efi_loader.h>
>   #include <env_internal.h>
>   #include <fdt_support.h>
>   #include <log.h>
>
> +#include <linux/kernel.h>
> +
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +struct efi_fw_images fw_images[] = {
> +	{
> +		.image_type_id = DEVELOPERBOX_UBOOT_IMAGE_GUID,
> +		.fw_name = u"DEVELOPERBOX-UBOOT",
> +		.image_index = 1,
> +	},
> +	{
> +		.image_type_id = DEVELOPERBOX_FIP_IMAGE_GUID,
> +		.fw_name = u"DEVELOPERBOX-FIP",
> +		.image_index = 2,
> +	},
> +	{
> +		.image_type_id = DEVELOPERBOX_OPTEE_IMAGE_GUID,
> +		.fw_name = u"DEVELOPERBOX-OPTEE",
> +		.image_index = 3,
> +	},
> +};
> +
> +struct efi_capsule_update_info update_info = {
> +	.dfu_string = "mtd nor1=u-boot.bin raw 200000 100000;"
> +			"fip.bin raw 180000 78000;"
> +			"optee.bin raw 500000 100000",
> +	.images = fw_images,
> +};
> +
> +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>   static struct mm_region sc2a11_mem_map[] = {
>   	{
>   		.virt = 0x0UL,
> diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
> index 0068cb8792..d4f3598d7e 100644
> --- a/board/xilinx/common/board.c
> +++ b/board/xilinx/common/board.c
> @@ -5,6 +5,8 @@
>    */
>
>   #include <common.h>
> +#include <efi.h>
> +#include <efi_loader.h>
>   #include <env.h>
>   #include <log.h>
>   #include <asm/global_data.h>
> @@ -20,9 +22,35 @@
>   #include <generated/dt.h>
>   #include <soc.h>
>   #include <linux/ctype.h>
> +#include <linux/kernel.h>
>
>   #include "fru.h"
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +struct efi_fw_images fw_images[] = {
> +#if defined(XILINX_BOOT_IMAGE_GUID)

GUIDs should always be defined.
This seems to be the wrong #if.

> +	{
> +		.image_type_id = XILINX_BOOT_IMAGE_GUID,
> +		.fw_name = u"XILINX-BOOT",
> +		.image_index = 1,
> +	},
> +#endif
> +#if defined(XILINX_UBOOT_IMAGE_GUID)
> +	{
> +		.image_type_id = XILINX_UBOOT_IMAGE_GUID,
> +		.fw_name = u"XILINX-UBOOT",
> +		.image_index = 2,
> +	},
> +#endif
> +};
> +
> +struct efi_capsule_update_info update_info = {
> +	.images = fw_images,
> +};
> +
> +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>   #if defined(CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET)
>   int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
>   {
> diff --git a/include/configs/imx8mm-cl-iot-gate.h b/include/configs/imx8mm-cl-iot-gate.h
> index 7e6be6050c..35df2e755e 100644
> --- a/include/configs/imx8mm-cl-iot-gate.h
> +++ b/include/configs/imx8mm-cl-iot-gate.h
> @@ -31,6 +31,16 @@
>
>   #endif
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +#define IMX8MM_CL_IOT_GATE_FIT_IMAGE_GUID \
> +	EFI_GUID(0x7a32a939, 0xab92, 0x467b, 0x91, 0x52, \
> +		 0x74, 0x77, 0x1b, 0x95, 0xe6, 0x46)
> +
> +#define IMX8MM_CL_IOT_GATE_OPTEE_FIT_IMAGE_GUID \
> +	EFI_GUID(0x0bf1165c, 0x1831, 0x4864, 0x94, 0x5e, \
> +		 0xac, 0x3d, 0x38, 0x48, 0xf4, 0x99)
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>   #if CONFIG_IS_ENABLED(CMD_MMC)
>   # define BOOT_TARGET_MMC(func) \
>   	func(MMC, mmc, 2)      \
> diff --git a/include/configs/imx8mp_rsb3720.h b/include/configs/imx8mp_rsb3720.h
> index ac4a7d0cb3..a5a845c2da 100644
> --- a/include/configs/imx8mp_rsb3720.h
> +++ b/include/configs/imx8mp_rsb3720.h
> @@ -21,6 +21,16 @@
>   #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
>   #define CONFIG_SYS_UBOOT_BASE	(QSPI0_AMBA_BASE + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512)
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +#define IMX8MP_RSB3720A1_4G_FIT_IMAGE_GUID \
> +	EFI_GUID(0xb1251e89, 0x384a, 0x4635, 0xa8, 0x06, \
> +		 0x3a, 0xa0, 0xb0, 0xe9, 0xf9, 0x65)
> +
> +#define IMX8MP_RSB3720A1_6G_FIT_IMAGE_GUID \
> +	EFI_GUID(0xb5fb6f08, 0xe142, 0x4db1, 0x97, 0xea, \
> +		 0x5f, 0xd3, 0x6b, 0x9b, 0xe5, 0xb9)
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT*/
> +
>   #ifdef CONFIG_SPL_BUILD
>   #define CONFIG_SPL_LDSCRIPT		"arch/arm/cpu/armv8/u-boot-spl.lds"
>   #define CONFIG_SPL_STACK		0x960000
> diff --git a/include/configs/kontron-sl-mx8mm.h b/include/configs/kontron-sl-mx8mm.h
> index 788ae77cd3..aff1b90010 100644
> --- a/include/configs/kontron-sl-mx8mm.h
> +++ b/include/configs/kontron-sl-mx8mm.h
> @@ -38,6 +38,12 @@
>   #define CONFIG_USB_MAX_CONTROLLER_COUNT	2
>   #endif
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +#define KONTRON_SL_MX8MM_FIT_IMAGE_GUID \
> +	EFI_GUID(0xd488e45a, 0x4929, 0x4b55, 0x8c, 0x14, \
> +		 0x86, 0xce, 0xa2, 0xcd, 0x66, 0x29)
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>   #ifndef CONFIG_SPL_BUILD
>   #define BOOT_TARGET_DEVICES(func) \
>   	func(MMC, mmc, 1) \
> diff --git a/include/configs/kontron_pitx_imx8m.h b/include/configs/kontron_pitx_imx8m.h
> index 0f96b905ab..678364e367 100644
> --- a/include/configs/kontron_pitx_imx8m.h
> +++ b/include/configs/kontron_pitx_imx8m.h
> @@ -14,6 +14,12 @@
>   #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
>   #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR	0x300
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +#define KONTRON_PITX_IMX8M_FIT_IMAGE_GUID \
> +	EFI_GUID(0xc898e959, 0x5b1f, 0x4e6d, 0x88, 0xe0, \
> +		 0x40, 0xd4, 0x5c, 0xca, 0x13, 0x99)
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>   #ifdef CONFIG_SPL_BUILD
>   #define CONFIG_SPL_LDSCRIPT		"arch/arm/cpu/armv8/u-boot-spl.lds"
>   #define CONFIG_SPL_STACK		0x187FF0
> diff --git a/include/configs/kontron_sl28.h b/include/configs/kontron_sl28.h
> index 448749a7f8..97d0d365f6 100644
> --- a/include/configs/kontron_sl28.h
> +++ b/include/configs/kontron_sl28.h
> @@ -57,6 +57,12 @@
>   #define CONFIG_SYS_SPL_MALLOC_START	0x80200000
>   #define CONFIG_SYS_MONITOR_LEN		(1024 * 1024)
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +#define KONTRON_SL28_FIT_IMAGE_GUID \
> +	EFI_GUID(0x86ebd44f, 0xfeb8, 0x466f, 0x8b, 0xb8, \
> +		 0x89, 0x06, 0x18, 0x45, 0x6d, 0x8b)
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>   /* environment */
>   /* see include/configs/ti_armv7_common.h */
>   #define ENV_MEM_LAYOUT_SETTINGS \
> diff --git a/include/configs/qemu-arm.h b/include/configs/qemu-arm.h
> index d45f606860..2f2abc746d 100644
> --- a/include/configs/qemu-arm.h
> +++ b/include/configs/qemu-arm.h
> @@ -17,6 +17,16 @@
>
>   #define CONFIG_SYS_BOOTM_LEN		SZ_64M
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +#define QEMU_ARM_UBOOT_IMAGE_GUID \
> +	EFI_GUID(0xf885b085, 0x99f8, 0x45af, 0x84, 0x7d, \
> +		 0xd5, 0x14, 0x10, 0x7a, 0x4a, 0x2c)
> +
> +#define QEMU_ARM64_UBOOT_IMAGE_GUID \
> +	EFI_GUID(0x058b7d83, 0x50d5, 0x4c47, 0xa1, 0x95, \
> +		 0x60, 0xd8, 0x6a, 0xd3, 0x41, 0xc4)
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>   /* For timer, QEMU emulates an ARMv7/ARMv8 architected timer */
>
>   /* Environment options */
> diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
> index 75efbf3448..e951d08056 100644
> --- a/include/configs/sandbox.h
> +++ b/include/configs/sandbox.h
> @@ -14,6 +14,20 @@
>
>   #define CONFIG_SYS_CBSIZE		1024	/* Console I/O Buffer Size */
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +#define SANDBOX_UBOOT_IMAGE_GUID \
> +	EFI_GUID(0x09d7cf52, 0x0720, 0x4710, 0x91, 0xd1, \
> +		 0x08, 0x46, 0x9b, 0x7f, 0xe9, 0xc8)
> +
> +#define SANDBOX_UBOOT_ENV_IMAGE_GUID \
> +	EFI_GUID(0x5a7021f5, 0xfef2, 0x48b4, 0xaa, 0xba, \
> +		 0x83, 0x2e, 0x77, 0x74, 0x18, 0xc0)
> +
> +#define SANDBOX_FIT_IMAGE_GUID \
> +	EFI_GUID(0x3673b45d, 0x6a7c, 0x46f3, 0x9e, 0x60, \
> +		 0xad, 0xab, 0xb0, 0x3f, 0x79, 0x37)
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>   /* Size of our emulated memory */
>   #define SB_CONCAT(x, y) x ## y
>   #define SB_TO_UL(s) SB_CONCAT(s, UL)
> diff --git a/include/configs/synquacer.h b/include/configs/synquacer.h
> index 8dd092fc59..07e1f56e3d 100644
> --- a/include/configs/synquacer.h
> +++ b/include/configs/synquacer.h
> @@ -51,6 +51,20 @@
>   			"fip.bin raw 180000 78000;"			\
>   			"optee.bin raw 500000 100000\0"
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +#define DEVELOPERBOX_UBOOT_IMAGE_GUID \
> +	EFI_GUID(0x53a92e83, 0x4ef4, 0x473a, 0x8b, 0x0d, \
> +		 0xb5, 0xd8, 0xc7, 0xb2, 0xd6, 0x00)
> +
> +#define DEVELOPERBOX_FIP_IMAGE_GUID \
> +	EFI_GUID(0x880866e9, 0x84ba, 0x4793, 0xa9, 0x08, \
> +		 0x33, 0xe0, 0xb9, 0x16, 0xf3, 0x98)
> +
> +#define DEVELOPERBOX_OPTEE_IMAGE_GUID \
> +	EFI_GUID(0xc1b629f1, 0xce0e, 0x4894, 0x82, 0xbf, \
> +		 0xf0, 0xa3, 0x83, 0x87, 0xe6, 0x30)
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>   /* Distro boot settings */
>   #ifndef CONFIG_SPL_BUILD
>   #ifdef CONFIG_CMD_USB
> diff --git a/include/configs/xilinx_versal.h b/include/configs/xilinx_versal.h
> index bc72f5f35f..95218962f7 100644
> --- a/include/configs/xilinx_versal.h
> +++ b/include/configs/xilinx_versal.h
> @@ -31,6 +31,12 @@
>   #define CONFIG_BOOTP_BOOTFILESIZE
>   #define CONFIG_BOOTP_MAY_FAIL
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)

Please, remove this #if. Correct the check in the c module.

> +#define XILINX_BOOT_IMAGE_GUID \
> +	EFI_GUID(0x20c5fba5, 0x0171, 0x457f, 0xb9, 0xcd, \
> +		 0xf5, 0x12, 0x9c, 0xd0, 0x72, 0x28)
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>   /* Miscellaneous configurable options */
>
>   /* Monitor Command Prompt */
> diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h
> index e51d92ffe4..942f004b15 100644
> --- a/include/configs/xilinx_zynqmp.h
> +++ b/include/configs/xilinx_zynqmp.h
> @@ -31,6 +31,16 @@
>   #define CONFIG_BOOTP_BOOTFILESIZE
>   #define CONFIG_BOOTP_MAY_FAIL
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)

Please, remove the #if. Correct the check in the c module.

> +#define XILINX_BOOT_IMAGE_GUID \
> +	EFI_GUID(0xde6066e8, 0x0256, 0x4fad, 0x82, 0x38, \
> +		 0xe4, 0x06, 0xe2, 0x74, 0xc4, 0xcf)
> +
> +#define XILINX_UBOOT_IMAGE_GUID \
> +	EFI_GUID(0xcf9ecfd4, 0x938b, 0x41c5, 0x85, 0x51, \
> +		 0x1f, 0x88, 0x3a, 0xb7, 0xdc, 0x18)
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>   #ifdef CONFIG_NAND_ARASAN
>   # define CONFIG_SYS_MAX_NAND_DEVICE	1
>   #endif
> diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h
> index 780952cf5f..d116947d25 100644
> --- a/include/configs/zynq-common.h
> +++ b/include/configs/zynq-common.h
> @@ -20,6 +20,16 @@
>   #define CONFIG_SYS_TIMER_COUNTS_DOWN
>   #define CONFIG_SYS_TIMER_COUNTER	(CONFIG_SYS_TIMERBASE + 0x4)
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)

ditto.

Best regards

Heinrich

> +#define XILINX_BOOT_IMAGE_GUID \
> +	EFI_GUID(0x1ba29a15, 0x9969, 0x40aa, 0xb4, 0x24, \
> +		 0xe8, 0x61, 0x21, 0x61, 0x86, 0x64)
> +
> +#define XILINX_UBOOT_IMAGE_GUID \
> +	EFI_GUID(0x1a5178f0, 0x87d3, 0x4f36, 0xac, 0x63, \
> +		 0x3b, 0x31, 0xa2, 0x3b, 0xe3, 0x05)
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>   /* Serial drivers */
>   /* The following table includes the supported baudrates */
>   #define CONFIG_SYS_BAUDRATE_TABLE  \
> diff --git a/include/efi_loader.h b/include/efi_loader.h
> index af36639ec6..a064a2c4ec 100644
> --- a/include/efi_loader.h
> +++ b/include/efi_loader.h
> @@ -979,6 +979,42 @@ efi_status_t efi_capsule_authenticate(const void *capsule,
>
>   #define EFI_CAPSULE_DIR u"\\EFI\\UpdateCapsule\\"
>
> +/**
> + * struct efi_fw_images - List of firmware images updatable through capsule
> + *                        update
> + *
> + * This structure gives information about the firmware images on the platform
> + * which can be updated through the capsule update mechanism
> + *
> + * @image_type_id:	Image GUID. Same value is to be used in the capsule
> + * @fw_name:		Name of the firmware image
> + * @image_index:	Image Index, same as value passed to SetImage FMP
> + *                      function
> + */
> +struct efi_fw_images {
> +	efi_guid_t image_type_id;
> +	u16 *fw_name;
> +	u8 image_index;
> +};
> +
> +/**
> + * struct efi_capsule_update_info - Information needed for capsule updates
> + *
> + * This structure provides information needed for performing firmware
> + * updates. The structure needs to be initialised per platform, for all
> + * platforms which enable capsule updates
> + *
> + * @dfu_string:		String used to populate dfu_alt_info
> + * @images:		Pointer to an array of updatable images
> + */
> +struct efi_capsule_update_info {
> +	const char *dfu_string;
> +	struct efi_fw_images *images;
> +};
> +
> +extern struct efi_capsule_update_info update_info;
> +extern u8 num_image_type_guids;
> +
>   /**
>    * Install the ESRT system table.
>    *
Sughosh Ganu April 11, 2022, 10:20 a.m. UTC | #2
On Sat, 2 Apr 2022 at 14:34, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> On 4/1/22 21:17, Sughosh Ganu wrote:
> > Add a structure which defines the information that is needed for
> > executing capsule updates on a platform. Some information in the
> > structure is used for making the update process more robust while some
> > information is used for fixing some issues. Initialise this structure
> > in the board file, and use the information for the capsule updates.
> >
> > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> > ---
> >
> > Changes since V1:
> >
> > * Define a structure efi_capsule_update_info which includes the string
> >    for populating dfu_alt_info
> > * Initialise the string for dfu_alt_info in the board file
> >
> >
> >   .../imx8mp_rsb3720a1/imx8mp_rsb3720a1.c       | 25 +++++++++++++
> >   .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c   | 24 +++++++++++++
> >   board/emulation/qemu-arm/qemu-arm.c           | 24 +++++++++++++
> >   board/kontron/pitx_imx8m/pitx_imx8m.c         | 21 ++++++++++-
> >   board/kontron/sl-mx8mm/sl-mx8mm.c             | 20 +++++++++++
> >   board/kontron/sl28/sl28.c                     | 21 +++++++++++
> >   board/sandbox/sandbox.c                       | 34 ++++++++++++++++++
> >   board/socionext/developerbox/developerbox.c   | 33 +++++++++++++++++
> >   board/xilinx/common/board.c                   | 28 +++++++++++++++
> >   include/configs/imx8mm-cl-iot-gate.h          | 10 ++++++
> >   include/configs/imx8mp_rsb3720.h              | 10 ++++++
> >   include/configs/kontron-sl-mx8mm.h            |  6 ++++
> >   include/configs/kontron_pitx_imx8m.h          |  6 ++++
> >   include/configs/kontron_sl28.h                |  6 ++++
> >   include/configs/qemu-arm.h                    | 10 ++++++
> >   include/configs/sandbox.h                     | 14 ++++++++
> >   include/configs/synquacer.h                   | 14 ++++++++
> >   include/configs/xilinx_versal.h               |  6 ++++
> >   include/configs/xilinx_zynqmp.h               | 10 ++++++
> >   include/configs/zynq-common.h                 | 10 ++++++
> >   include/efi_loader.h                          | 36 +++++++++++++++++++
> >   21 files changed, 367 insertions(+), 1 deletion(-)
> >
> > diff --git a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
> > index 16566092bd..aa9cfa8339 100644
> > --- a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
> > +++ b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
> > @@ -6,6 +6,8 @@
> >
> >   #include <common.h>
> >   #include <dwc3-uboot.h>
> > +#include <efi.h>
> > +#include <efi_loader.h>
> >   #include <errno.h>
> >   #include <miiphy.h>
> >   #include <netdev.h>
> > @@ -21,6 +23,7 @@
> >   #include <asm/arch/clock.h>
> >   #include <asm/mach-imx/dma.h>
> >   #include <linux/delay.h>
> > +#include <linux/kernel.h>
> >   #include <power/pmic.h>
> >
> >   DECLARE_GLOBAL_DATA_PTR;
> > @@ -44,6 +47,28 @@ static void setup_gpmi_nand(void)
> >   }
> >   #endif
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +struct efi_fw_images fw_images[] = {
> > +     {
> > +#if defined(CONFIG_TARGET_IMX8MP_RSB3720A1_4G)
> > +             .image_type_id = IMX8MP_RSB3720A1_4G_FIT_IMAGE_GUID,
> > +#elif defined(CONFIG_TARGET_IMX8MP_RSB3720A1_6G)
> > +             .image_type_id = IMX8MP_RSB3720A1_6G_FIT_IMAGE_GUID,
>
> I am missing a handler for all other cases here, e.g.
>
> #else
> #error Capsule update: firmware image GUID not defined
>
> But why don't you do this like on the sandbox? Just create one entry per
> known config item.

I created a separate entry per config since the number of images were
different per config. But I can create separate entries per config.
Will do so.

>
> Then the image array will simply be empty for all other boards.
>
> > +#endif
> > +             .fw_name = u"IMX8MP-RSB3720-FIT",
> > +             .image_index = 1,
> > +     },
> > +};
> > +
> > +struct efi_capsule_update_info update_info = {
> > +     .dfu_string = "mmc 2=flash-bin raw 0 0x1B00 mmcpart 1",
> > +     .images = fw_images,
> > +};
> > +
> > +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> > +
> >   int board_early_init_f(void)
> >   {
> >       struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR;
> > diff --git a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
> > index 7e2d88f449..f2f5eb10f1 100644
> > --- a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
> > +++ b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
> > @@ -5,6 +5,8 @@
> >    */
> >
> >   #include <common.h>
> > +#include <efi.h>
> > +#include <efi_loader.h>
> >   #include <env.h>
> >   #include <extension_board.h>
> >   #include <hang.h>
> > @@ -21,11 +23,33 @@
> >   #include <asm/mach-imx/gpio.h>
> >   #include <asm/mach-imx/mxc_i2c.h>
> >   #include <asm/sections.h>
> > +#include <linux/kernel.h>
> >
> >   #include "ddr/ddr.h"
> >
> >   DECLARE_GLOBAL_DATA_PTR;
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +struct efi_fw_images fw_images[] = {
> > +     {
> > +#if defined(CONFIG_TARGET_IMX8MM_CL_IOT_GATE)
> > +             .image_type_id = IMX8MM_CL_IOT_GATE_FIT_IMAGE_GUID,
> > +#elif defined(CONFIG_TARGET_IMX8MM_CL_IOT_GATE_OPTEE)
> > +             .image_type_id = IMX8MM_CL_IOT_GATE_OPTEE_FIT_IMAGE_GUID,
> > +#endif
> > +             .fw_name = u"IMX8MM-CL-IOT-GATE-FIT",
> > +             .image_index = 1,
> > +     },
> > +};
> > +
> > +struct efi_capsule_update_info update_info = {
> > +     .dfu_string = "mmc 2=flash-bin raw 0x42 0x1D00 mmcpart 1",
> > +     .images = fw_images,
> > +};
> > +
> > +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> >   int board_phys_sdram_size(phys_size_t *size)
> >   {
> >       struct lpddr4_tcm_desc *lpddr4_tcm_desc =
> > diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
> > index 16d5a97167..f36709ea27 100644
> > --- a/board/emulation/qemu-arm/qemu-arm.c
> > +++ b/board/emulation/qemu-arm/qemu-arm.c
> > @@ -6,15 +6,39 @@
> >   #include <common.h>
> >   #include <cpu_func.h>
> >   #include <dm.h>
> > +#include <efi.h>
> > +#include <efi_loader.h>
> >   #include <fdtdec.h>
> >   #include <init.h>
> >   #include <log.h>
> >   #include <virtio_types.h>
> >   #include <virtio.h>
> >
> > +#include <linux/kernel.h>
> > +
> >   #ifdef CONFIG_ARM64
> >   #include <asm/armv8/mmu.h>
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +struct efi_fw_images fw_images[] = {
> > +     {
> > +#if defined(CONFIG_TARGET_QEMU_ARM_32BIT)
> > +             .image_type_id = QEMU_ARM_UBOOT_IMAGE_GUID,
> > +#elif defined(CONFIG_TARGET_QEMU_ARM_64BIT)
> > +             .image_type_id = QEMU_ARM64_UBOOT_IMAGE_GUID,
> > +#endif
> > +             .fw_name = u"Qemu-Arm-UBOOT",
> > +             .image_index = 1,
> > +     },
> > +};
> > +
> > +struct efi_capsule_update_info update_info = {
> > +     .images = fw_images,
> > +};
> > +
> > +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> >   static struct mm_region qemu_arm64_mem_map[] = {
> >       {
> >               /* Flash */
> > diff --git a/board/kontron/pitx_imx8m/pitx_imx8m.c b/board/kontron/pitx_imx8m/pitx_imx8m.c
> > index d655fe099b..a9329460f6 100644
> > --- a/board/kontron/pitx_imx8m/pitx_imx8m.c
> > +++ b/board/kontron/pitx_imx8m/pitx_imx8m.c
> > @@ -2,6 +2,8 @@
> >
> >   #include "pitx_misc.h"
> >   #include <common.h>
> > +#include <efi.h>
> > +#include <efi_loader.h>
> >   #include <init.h>
> >   #include <mmc.h>
> >   #include <miiphy.h>
> > @@ -12,7 +14,7 @@
> >   #include <asm/mach-imx/gpio.h>
> >   #include <asm/mach-imx/iomux-v3.h>
> >   #include <linux/delay.h>
> > -
> > +#include <linux/kernel.h>
> >
> >   DECLARE_GLOBAL_DATA_PTR;
> >
> > @@ -30,6 +32,23 @@ static iomux_v3_cfg_t const uart_pads[] = {
> >       IMX8MQ_PAD_ECSPI1_MISO__UART3_CTS_B | MUX_PAD_CTRL(UART_PAD_CTRL),
> >   };
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +struct efi_fw_images fw_images[] = {
> > +     {
> > +             .image_type_id = KONTRON_PITX_IMX8M_FIT_IMAGE_GUID,
> > +             .fw_name = u"KONTRON-PITX-IMX8M-UBOOT",
> > +             .image_index = 1,
> > +     },
> > +};
> > +
> > +struct efi_capsule_update_info update_info = {
> > +     .dfu_string = "mmc 0=flash-bin raw 0x42 0x1000 mmcpart 1",
> > +     .images = fw_images,
> > +};
> > +
> > +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> >   int board_early_init_f(void)
> >   {
> >       struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR;
> > diff --git a/board/kontron/sl-mx8mm/sl-mx8mm.c b/board/kontron/sl-mx8mm/sl-mx8mm.c
> > index 48376cb826..287c572eeb 100644
> > --- a/board/kontron/sl-mx8mm/sl-mx8mm.c
> > +++ b/board/kontron/sl-mx8mm/sl-mx8mm.c
> > @@ -6,12 +6,32 @@
> >   #include <asm/arch/imx-regs.h>
> >   #include <asm/global_data.h>
> >   #include <asm/io.h>
> > +#include <efi.h>
> > +#include <efi_loader.h>
> >   #include <fdt_support.h>
> >   #include <linux/errno.h>
> > +#include <linux/kernel.h>
> >   #include <net.h>
> >
> >   DECLARE_GLOBAL_DATA_PTR;
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +struct efi_fw_images fw_images[] = {
> > +     {
> > +             .image_type_id = KONTRON_SL_MX8MM_FIT_IMAGE_GUID,
> > +             .fw_name = u"KONTROL-SL-MX8MM-UBOOT",
> > +             .image_index = 1,
> > +     },
> > +};
> > +
> > +struct efi_capsule_update_info update_info = {
> > +     .dfu_string = "sf 0:0=flash-bin raw 0x400 0x1f0000",
> > +     .images = fw_images,
> > +};
> > +
> > +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> >   int board_phys_sdram_size(phys_size_t *size)
> >   {
> >       u32 ddr_size = readl(M4_BOOTROM_BASE_ADDR);
> > diff --git a/board/kontron/sl28/sl28.c b/board/kontron/sl28/sl28.c
> > index 3c48a9141d..0ffa351288 100644
> > --- a/board/kontron/sl28/sl28.c
> > +++ b/board/kontron/sl28/sl28.c
> > @@ -3,11 +3,14 @@
> >   #include <common.h>
> >   #include <dm.h>
> >   #include <malloc.h>
> > +#include <efi.h>
> > +#include <efi_loader.h>
> >   #include <errno.h>
> >   #include <fsl_ddr.h>
> >   #include <fdt_support.h>
> >   #include <asm/global_data.h>
> >   #include <linux/libfdt.h>
> > +#include <linux/kernel.h>
> >   #include <env_internal.h>
> >   #include <asm/arch-fsl-layerscape/soc.h>
> >   #include <asm/arch-fsl-layerscape/fsl_icid.h>
> > @@ -23,6 +26,24 @@
> >
> >   DECLARE_GLOBAL_DATA_PTR;
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +struct efi_fw_images fw_images[] = {
> > +     {
> > +             .image_type_id = KONTRON_SL28_FIT_IMAGE_GUID,
> > +             .fw_name = u"KONTRON-SL28-FIT",
> > +             .image_index = 1,
> > +     },
> > +};
> > +
> > +struct efi_capsule_update_info update_info = {
> > +     .dfu_string = "sf 0:0=u-boot-bin raw 0x210000 0x1d0000;"
> > +                     "u-boot-env raw 0x3e0000 0x20000",
> > +     .images = fw_images,
> > +};
> > +
> > +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> >   int board_early_init_f(void)
> >   {
> >       fsl_lsch3_early_init_f();
> > diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c
> > index 5d9a945d64..d93aaa6a20 100644
> > --- a/board/sandbox/sandbox.c
> > +++ b/board/sandbox/sandbox.c
> > @@ -7,6 +7,8 @@
> >   #include <cpu_func.h>
> >   #include <cros_ec.h>
> >   #include <dm.h>
> > +#include <efi.h>
> > +#include <efi_loader.h>
> >   #include <env_internal.h>
> >   #include <init.h>
> >   #include <led.h>
> > @@ -14,6 +16,7 @@
> >   #include <asm/global_data.h>
> >   #include <asm/test.h>
> >   #include <asm/u-boot-sandbox.h>
> > +#include <linux/kernel.h>
> >   #include <malloc.h>
> >
> >   #include <extension_board.h>
> > @@ -25,6 +28,37 @@
> >    */
> >   gd_t *gd;
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +struct efi_fw_images fw_images[] = {
> > +#if defined(CONFIG_EFI_CAPSULE_FIRMWARE_RAW)
> > +     {
> > +             .image_type_id = SANDBOX_UBOOT_IMAGE_GUID,
> > +             .fw_name = u"SANDBOX-UBOOT",
> > +             .image_index = 1,
> > +     },
> > +     {
> > +             .image_type_id = SANDBOX_UBOOT_ENV_IMAGE_GUID,
> > +             .fw_name = u"SANDBOX-UBOOT-ENV",
> > +             .image_index = 2,
> > +     },
> > +#elif defined(CONFIG_EFI_CAPSULE_FIRMWARE_FIT)
> > +     {
> > +             .image_type_id = SANDBOX_FIT_IMAGE_GUID,
> > +             .fw_name = u"SANDBOX-FIT",
> > +             .image_index = 1,
> > +     },
> > +#endif
> > +};
> > +
> > +struct efi_capsule_update_info update_info = {
> > +     .dfu_string = "sf 0:0=u-boot-bin raw 0x100000 0x50000;"
> > +             "u-boot-env raw 0x150000 0x200000",
> > +     .images = fw_images,
> > +};
> > +
> > +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> >   #if !CONFIG_IS_ENABLED(OF_PLATDATA)
> >   /*
> >    * Add a simple GPIO device (don't use with of-platdata as it interferes with
> > diff --git a/board/socionext/developerbox/developerbox.c b/board/socionext/developerbox/developerbox.c
> > index 9552bfcdc3..7820b7e68a 100644
> > --- a/board/socionext/developerbox/developerbox.c
> > +++ b/board/socionext/developerbox/developerbox.c
> > @@ -10,10 +10,43 @@
> >   #include <asm/global_data.h>
> >   #include <asm/io.h>
> >   #include <common.h>
> > +#include <efi.h>
> > +#include <efi_loader.h>
> >   #include <env_internal.h>
> >   #include <fdt_support.h>
> >   #include <log.h>
> >
> > +#include <linux/kernel.h>
> > +
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +struct efi_fw_images fw_images[] = {
> > +     {
> > +             .image_type_id = DEVELOPERBOX_UBOOT_IMAGE_GUID,
> > +             .fw_name = u"DEVELOPERBOX-UBOOT",
> > +             .image_index = 1,
> > +     },
> > +     {
> > +             .image_type_id = DEVELOPERBOX_FIP_IMAGE_GUID,
> > +             .fw_name = u"DEVELOPERBOX-FIP",
> > +             .image_index = 2,
> > +     },
> > +     {
> > +             .image_type_id = DEVELOPERBOX_OPTEE_IMAGE_GUID,
> > +             .fw_name = u"DEVELOPERBOX-OPTEE",
> > +             .image_index = 3,
> > +     },
> > +};
> > +
> > +struct efi_capsule_update_info update_info = {
> > +     .dfu_string = "mtd nor1=u-boot.bin raw 200000 100000;"
> > +                     "fip.bin raw 180000 78000;"
> > +                     "optee.bin raw 500000 100000",
> > +     .images = fw_images,
> > +};
> > +
> > +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> >   static struct mm_region sc2a11_mem_map[] = {
> >       {
> >               .virt = 0x0UL,
> > diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
> > index 0068cb8792..d4f3598d7e 100644
> > --- a/board/xilinx/common/board.c
> > +++ b/board/xilinx/common/board.c
> > @@ -5,6 +5,8 @@
> >    */
> >
> >   #include <common.h>
> > +#include <efi.h>
> > +#include <efi_loader.h>
> >   #include <env.h>
> >   #include <log.h>
> >   #include <asm/global_data.h>
> > @@ -20,9 +22,35 @@
> >   #include <generated/dt.h>
> >   #include <soc.h>
> >   #include <linux/ctype.h>
> > +#include <linux/kernel.h>
> >
> >   #include "fru.h"
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +struct efi_fw_images fw_images[] = {
> > +#if defined(XILINX_BOOT_IMAGE_GUID)
>
> GUIDs should always be defined.
> This seems to be the wrong #if.

This was done as per the suggestion of the board maintainer. Even if
the GUID is not defined, it will result in a NULL GUID, and the update
will fail, as the GUID match will fail at the time of the update.

>
> > +     {
> > +             .image_type_id = XILINX_BOOT_IMAGE_GUID,
> > +             .fw_name = u"XILINX-BOOT",
> > +             .image_index = 1,
> > +     },
> > +#endif
> > +#if defined(XILINX_UBOOT_IMAGE_GUID)
> > +     {
> > +             .image_type_id = XILINX_UBOOT_IMAGE_GUID,
> > +             .fw_name = u"XILINX-UBOOT",
> > +             .image_index = 2,
> > +     },
> > +#endif
> > +};
> > +
> > +struct efi_capsule_update_info update_info = {
> > +     .images = fw_images,
> > +};
> > +
> > +u8 num_image_type_guids = ARRAY_SIZE(fw_images);
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> >   #if defined(CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET)
> >   int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
> >   {
> > diff --git a/include/configs/imx8mm-cl-iot-gate.h b/include/configs/imx8mm-cl-iot-gate.h
> > index 7e6be6050c..35df2e755e 100644
> > --- a/include/configs/imx8mm-cl-iot-gate.h
> > +++ b/include/configs/imx8mm-cl-iot-gate.h
> > @@ -31,6 +31,16 @@
> >
> >   #endif
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +#define IMX8MM_CL_IOT_GATE_FIT_IMAGE_GUID \
> > +     EFI_GUID(0x7a32a939, 0xab92, 0x467b, 0x91, 0x52, \
> > +              0x74, 0x77, 0x1b, 0x95, 0xe6, 0x46)
> > +
> > +#define IMX8MM_CL_IOT_GATE_OPTEE_FIT_IMAGE_GUID \
> > +     EFI_GUID(0x0bf1165c, 0x1831, 0x4864, 0x94, 0x5e, \
> > +              0xac, 0x3d, 0x38, 0x48, 0xf4, 0x99)
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> >   #if CONFIG_IS_ENABLED(CMD_MMC)
> >   # define BOOT_TARGET_MMC(func) \
> >       func(MMC, mmc, 2)      \
> > diff --git a/include/configs/imx8mp_rsb3720.h b/include/configs/imx8mp_rsb3720.h
> > index ac4a7d0cb3..a5a845c2da 100644
> > --- a/include/configs/imx8mp_rsb3720.h
> > +++ b/include/configs/imx8mp_rsb3720.h
> > @@ -21,6 +21,16 @@
> >   #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION  1
> >   #define CONFIG_SYS_UBOOT_BASE       (QSPI0_AMBA_BASE + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512)
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +#define IMX8MP_RSB3720A1_4G_FIT_IMAGE_GUID \
> > +     EFI_GUID(0xb1251e89, 0x384a, 0x4635, 0xa8, 0x06, \
> > +              0x3a, 0xa0, 0xb0, 0xe9, 0xf9, 0x65)
> > +
> > +#define IMX8MP_RSB3720A1_6G_FIT_IMAGE_GUID \
> > +     EFI_GUID(0xb5fb6f08, 0xe142, 0x4db1, 0x97, 0xea, \
> > +              0x5f, 0xd3, 0x6b, 0x9b, 0xe5, 0xb9)
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT*/
> > +
> >   #ifdef CONFIG_SPL_BUILD
> >   #define CONFIG_SPL_LDSCRIPT         "arch/arm/cpu/armv8/u-boot-spl.lds"
> >   #define CONFIG_SPL_STACK            0x960000
> > diff --git a/include/configs/kontron-sl-mx8mm.h b/include/configs/kontron-sl-mx8mm.h
> > index 788ae77cd3..aff1b90010 100644
> > --- a/include/configs/kontron-sl-mx8mm.h
> > +++ b/include/configs/kontron-sl-mx8mm.h
> > @@ -38,6 +38,12 @@
> >   #define CONFIG_USB_MAX_CONTROLLER_COUNT     2
> >   #endif
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +#define KONTRON_SL_MX8MM_FIT_IMAGE_GUID \
> > +     EFI_GUID(0xd488e45a, 0x4929, 0x4b55, 0x8c, 0x14, \
> > +              0x86, 0xce, 0xa2, 0xcd, 0x66, 0x29)
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> >   #ifndef CONFIG_SPL_BUILD
> >   #define BOOT_TARGET_DEVICES(func) \
> >       func(MMC, mmc, 1) \
> > diff --git a/include/configs/kontron_pitx_imx8m.h b/include/configs/kontron_pitx_imx8m.h
> > index 0f96b905ab..678364e367 100644
> > --- a/include/configs/kontron_pitx_imx8m.h
> > +++ b/include/configs/kontron_pitx_imx8m.h
> > @@ -14,6 +14,12 @@
> >   #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
> >   #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR     0x300
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +#define KONTRON_PITX_IMX8M_FIT_IMAGE_GUID \
> > +     EFI_GUID(0xc898e959, 0x5b1f, 0x4e6d, 0x88, 0xe0, \
> > +              0x40, 0xd4, 0x5c, 0xca, 0x13, 0x99)
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> >   #ifdef CONFIG_SPL_BUILD
> >   #define CONFIG_SPL_LDSCRIPT         "arch/arm/cpu/armv8/u-boot-spl.lds"
> >   #define CONFIG_SPL_STACK            0x187FF0
> > diff --git a/include/configs/kontron_sl28.h b/include/configs/kontron_sl28.h
> > index 448749a7f8..97d0d365f6 100644
> > --- a/include/configs/kontron_sl28.h
> > +++ b/include/configs/kontron_sl28.h
> > @@ -57,6 +57,12 @@
> >   #define CONFIG_SYS_SPL_MALLOC_START 0x80200000
> >   #define CONFIG_SYS_MONITOR_LEN              (1024 * 1024)
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +#define KONTRON_SL28_FIT_IMAGE_GUID \
> > +     EFI_GUID(0x86ebd44f, 0xfeb8, 0x466f, 0x8b, 0xb8, \
> > +              0x89, 0x06, 0x18, 0x45, 0x6d, 0x8b)
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> >   /* environment */
> >   /* see include/configs/ti_armv7_common.h */
> >   #define ENV_MEM_LAYOUT_SETTINGS \
> > diff --git a/include/configs/qemu-arm.h b/include/configs/qemu-arm.h
> > index d45f606860..2f2abc746d 100644
> > --- a/include/configs/qemu-arm.h
> > +++ b/include/configs/qemu-arm.h
> > @@ -17,6 +17,16 @@
> >
> >   #define CONFIG_SYS_BOOTM_LEN                SZ_64M
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +#define QEMU_ARM_UBOOT_IMAGE_GUID \
> > +     EFI_GUID(0xf885b085, 0x99f8, 0x45af, 0x84, 0x7d, \
> > +              0xd5, 0x14, 0x10, 0x7a, 0x4a, 0x2c)
> > +
> > +#define QEMU_ARM64_UBOOT_IMAGE_GUID \
> > +     EFI_GUID(0x058b7d83, 0x50d5, 0x4c47, 0xa1, 0x95, \
> > +              0x60, 0xd8, 0x6a, 0xd3, 0x41, 0xc4)
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> >   /* For timer, QEMU emulates an ARMv7/ARMv8 architected timer */
> >
> >   /* Environment options */
> > diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
> > index 75efbf3448..e951d08056 100644
> > --- a/include/configs/sandbox.h
> > +++ b/include/configs/sandbox.h
> > @@ -14,6 +14,20 @@
> >
> >   #define CONFIG_SYS_CBSIZE           1024    /* Console I/O Buffer Size */
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +#define SANDBOX_UBOOT_IMAGE_GUID \
> > +     EFI_GUID(0x09d7cf52, 0x0720, 0x4710, 0x91, 0xd1, \
> > +              0x08, 0x46, 0x9b, 0x7f, 0xe9, 0xc8)
> > +
> > +#define SANDBOX_UBOOT_ENV_IMAGE_GUID \
> > +     EFI_GUID(0x5a7021f5, 0xfef2, 0x48b4, 0xaa, 0xba, \
> > +              0x83, 0x2e, 0x77, 0x74, 0x18, 0xc0)
> > +
> > +#define SANDBOX_FIT_IMAGE_GUID \
> > +     EFI_GUID(0x3673b45d, 0x6a7c, 0x46f3, 0x9e, 0x60, \
> > +              0xad, 0xab, 0xb0, 0x3f, 0x79, 0x37)
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> >   /* Size of our emulated memory */
> >   #define SB_CONCAT(x, y) x ## y
> >   #define SB_TO_UL(s) SB_CONCAT(s, UL)
> > diff --git a/include/configs/synquacer.h b/include/configs/synquacer.h
> > index 8dd092fc59..07e1f56e3d 100644
> > --- a/include/configs/synquacer.h
> > +++ b/include/configs/synquacer.h
> > @@ -51,6 +51,20 @@
> >                       "fip.bin raw 180000 78000;"                     \
> >                       "optee.bin raw 500000 100000\0"
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +#define DEVELOPERBOX_UBOOT_IMAGE_GUID \
> > +     EFI_GUID(0x53a92e83, 0x4ef4, 0x473a, 0x8b, 0x0d, \
> > +              0xb5, 0xd8, 0xc7, 0xb2, 0xd6, 0x00)
> > +
> > +#define DEVELOPERBOX_FIP_IMAGE_GUID \
> > +     EFI_GUID(0x880866e9, 0x84ba, 0x4793, 0xa9, 0x08, \
> > +              0x33, 0xe0, 0xb9, 0x16, 0xf3, 0x98)
> > +
> > +#define DEVELOPERBOX_OPTEE_IMAGE_GUID \
> > +     EFI_GUID(0xc1b629f1, 0xce0e, 0x4894, 0x82, 0xbf, \
> > +              0xf0, 0xa3, 0x83, 0x87, 0xe6, 0x30)
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> >   /* Distro boot settings */
> >   #ifndef CONFIG_SPL_BUILD
> >   #ifdef CONFIG_CMD_USB
> > diff --git a/include/configs/xilinx_versal.h b/include/configs/xilinx_versal.h
> > index bc72f5f35f..95218962f7 100644
> > --- a/include/configs/xilinx_versal.h
> > +++ b/include/configs/xilinx_versal.h
> > @@ -31,6 +31,12 @@
> >   #define CONFIG_BOOTP_BOOTFILESIZE
> >   #define CONFIG_BOOTP_MAY_FAIL
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
>
> Please, remove this #if. Correct the check in the c module.

Okay. Will remove this check from all header files where the GUID
values are defined.

-sughosh

>
> > +#define XILINX_BOOT_IMAGE_GUID \
> > +     EFI_GUID(0x20c5fba5, 0x0171, 0x457f, 0xb9, 0xcd, \
> > +              0xf5, 0x12, 0x9c, 0xd0, 0x72, 0x28)
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> >   /* Miscellaneous configurable options */
> >
> >   /* Monitor Command Prompt */
> > diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h
> > index e51d92ffe4..942f004b15 100644
> > --- a/include/configs/xilinx_zynqmp.h
> > +++ b/include/configs/xilinx_zynqmp.h
> > @@ -31,6 +31,16 @@
> >   #define CONFIG_BOOTP_BOOTFILESIZE
> >   #define CONFIG_BOOTP_MAY_FAIL
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
>
> Please, remove the #if. Correct the check in the c module.
>
> > +#define XILINX_BOOT_IMAGE_GUID \
> > +     EFI_GUID(0xde6066e8, 0x0256, 0x4fad, 0x82, 0x38, \
> > +              0xe4, 0x06, 0xe2, 0x74, 0xc4, 0xcf)
> > +
> > +#define XILINX_UBOOT_IMAGE_GUID \
> > +     EFI_GUID(0xcf9ecfd4, 0x938b, 0x41c5, 0x85, 0x51, \
> > +              0x1f, 0x88, 0x3a, 0xb7, 0xdc, 0x18)
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> >   #ifdef CONFIG_NAND_ARASAN
> >   # define CONFIG_SYS_MAX_NAND_DEVICE 1
> >   #endif
> > diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h
> > index 780952cf5f..d116947d25 100644
> > --- a/include/configs/zynq-common.h
> > +++ b/include/configs/zynq-common.h
> > @@ -20,6 +20,16 @@
> >   #define CONFIG_SYS_TIMER_COUNTS_DOWN
> >   #define CONFIG_SYS_TIMER_COUNTER    (CONFIG_SYS_TIMERBASE + 0x4)
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
>
> ditto.
>
> Best regards
>
> Heinrich
>
> > +#define XILINX_BOOT_IMAGE_GUID \
> > +     EFI_GUID(0x1ba29a15, 0x9969, 0x40aa, 0xb4, 0x24, \
> > +              0xe8, 0x61, 0x21, 0x61, 0x86, 0x64)
> > +
> > +#define XILINX_UBOOT_IMAGE_GUID \
> > +     EFI_GUID(0x1a5178f0, 0x87d3, 0x4f36, 0xac, 0x63, \
> > +              0x3b, 0x31, 0xa2, 0x3b, 0xe3, 0x05)
> > +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> > +
> >   /* Serial drivers */
> >   /* The following table includes the supported baudrates */
> >   #define CONFIG_SYS_BAUDRATE_TABLE  \
> > diff --git a/include/efi_loader.h b/include/efi_loader.h
> > index af36639ec6..a064a2c4ec 100644
> > --- a/include/efi_loader.h
> > +++ b/include/efi_loader.h
> > @@ -979,6 +979,42 @@ efi_status_t efi_capsule_authenticate(const void *capsule,
> >
> >   #define EFI_CAPSULE_DIR u"\\EFI\\UpdateCapsule\\"
> >
> > +/**
> > + * struct efi_fw_images - List of firmware images updatable through capsule
> > + *                        update
> > + *
> > + * This structure gives information about the firmware images on the platform
> > + * which can be updated through the capsule update mechanism
> > + *
> > + * @image_type_id:   Image GUID. Same value is to be used in the capsule
> > + * @fw_name:         Name of the firmware image
> > + * @image_index:     Image Index, same as value passed to SetImage FMP
> > + *                      function
> > + */
> > +struct efi_fw_images {
> > +     efi_guid_t image_type_id;
> > +     u16 *fw_name;
> > +     u8 image_index;
> > +};
> > +
> > +/**
> > + * struct efi_capsule_update_info - Information needed for capsule updates
> > + *
> > + * This structure provides information needed for performing firmware
> > + * updates. The structure needs to be initialised per platform, for all
> > + * platforms which enable capsule updates
> > + *
> > + * @dfu_string:              String used to populate dfu_alt_info
> > + * @images:          Pointer to an array of updatable images
> > + */
> > +struct efi_capsule_update_info {
> > +     const char *dfu_string;
> > +     struct efi_fw_images *images;
> > +};
> > +
> > +extern struct efi_capsule_update_info update_info;
> > +extern u8 num_image_type_guids;
> > +
> >   /**
> >    * Install the ESRT system table.
> >    *
>
diff mbox series

Patch

diff --git a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
index 16566092bd..aa9cfa8339 100644
--- a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
+++ b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
@@ -6,6 +6,8 @@ 
 
 #include <common.h>
 #include <dwc3-uboot.h>
+#include <efi.h>
+#include <efi_loader.h>
 #include <errno.h>
 #include <miiphy.h>
 #include <netdev.h>
@@ -21,6 +23,7 @@ 
 #include <asm/arch/clock.h>
 #include <asm/mach-imx/dma.h>
 #include <linux/delay.h>
+#include <linux/kernel.h>
 #include <power/pmic.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -44,6 +47,28 @@  static void setup_gpmi_nand(void)
 }
 #endif
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_images fw_images[] = {
+	{
+#if defined(CONFIG_TARGET_IMX8MP_RSB3720A1_4G)
+		.image_type_id = IMX8MP_RSB3720A1_4G_FIT_IMAGE_GUID,
+#elif defined(CONFIG_TARGET_IMX8MP_RSB3720A1_6G)
+		.image_type_id = IMX8MP_RSB3720A1_6G_FIT_IMAGE_GUID,
+#endif
+		.fw_name = u"IMX8MP-RSB3720-FIT",
+		.image_index = 1,
+	},
+};
+
+struct efi_capsule_update_info update_info = {
+	.dfu_string = "mmc 2=flash-bin raw 0 0x1B00 mmcpart 1",
+	.images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
+
 int board_early_init_f(void)
 {
 	struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR;
diff --git a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
index 7e2d88f449..f2f5eb10f1 100644
--- a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
+++ b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
@@ -5,6 +5,8 @@ 
  */
 
 #include <common.h>
+#include <efi.h>
+#include <efi_loader.h>
 #include <env.h>
 #include <extension_board.h>
 #include <hang.h>
@@ -21,11 +23,33 @@ 
 #include <asm/mach-imx/gpio.h>
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/sections.h>
+#include <linux/kernel.h>
 
 #include "ddr/ddr.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_images fw_images[] = {
+	{
+#if defined(CONFIG_TARGET_IMX8MM_CL_IOT_GATE)
+		.image_type_id = IMX8MM_CL_IOT_GATE_FIT_IMAGE_GUID,
+#elif defined(CONFIG_TARGET_IMX8MM_CL_IOT_GATE_OPTEE)
+		.image_type_id = IMX8MM_CL_IOT_GATE_OPTEE_FIT_IMAGE_GUID,
+#endif
+		.fw_name = u"IMX8MM-CL-IOT-GATE-FIT",
+		.image_index = 1,
+	},
+};
+
+struct efi_capsule_update_info update_info = {
+	.dfu_string = "mmc 2=flash-bin raw 0x42 0x1D00 mmcpart 1",
+	.images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_phys_sdram_size(phys_size_t *size)
 {
 	struct lpddr4_tcm_desc *lpddr4_tcm_desc =
diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
index 16d5a97167..f36709ea27 100644
--- a/board/emulation/qemu-arm/qemu-arm.c
+++ b/board/emulation/qemu-arm/qemu-arm.c
@@ -6,15 +6,39 @@ 
 #include <common.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <efi.h>
+#include <efi_loader.h>
 #include <fdtdec.h>
 #include <init.h>
 #include <log.h>
 #include <virtio_types.h>
 #include <virtio.h>
 
+#include <linux/kernel.h>
+
 #ifdef CONFIG_ARM64
 #include <asm/armv8/mmu.h>
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_images fw_images[] = {
+	{
+#if defined(CONFIG_TARGET_QEMU_ARM_32BIT)
+		.image_type_id = QEMU_ARM_UBOOT_IMAGE_GUID,
+#elif defined(CONFIG_TARGET_QEMU_ARM_64BIT)
+		.image_type_id = QEMU_ARM64_UBOOT_IMAGE_GUID,
+#endif
+		.fw_name = u"Qemu-Arm-UBOOT",
+		.image_index = 1,
+	},
+};
+
+struct efi_capsule_update_info update_info = {
+	.images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 static struct mm_region qemu_arm64_mem_map[] = {
 	{
 		/* Flash */
diff --git a/board/kontron/pitx_imx8m/pitx_imx8m.c b/board/kontron/pitx_imx8m/pitx_imx8m.c
index d655fe099b..a9329460f6 100644
--- a/board/kontron/pitx_imx8m/pitx_imx8m.c
+++ b/board/kontron/pitx_imx8m/pitx_imx8m.c
@@ -2,6 +2,8 @@ 
 
 #include "pitx_misc.h"
 #include <common.h>
+#include <efi.h>
+#include <efi_loader.h>
 #include <init.h>
 #include <mmc.h>
 #include <miiphy.h>
@@ -12,7 +14,7 @@ 
 #include <asm/mach-imx/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <linux/delay.h>
-
+#include <linux/kernel.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -30,6 +32,23 @@  static iomux_v3_cfg_t const uart_pads[] = {
 	IMX8MQ_PAD_ECSPI1_MISO__UART3_CTS_B | MUX_PAD_CTRL(UART_PAD_CTRL),
 };
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_images fw_images[] = {
+	{
+		.image_type_id = KONTRON_PITX_IMX8M_FIT_IMAGE_GUID,
+		.fw_name = u"KONTRON-PITX-IMX8M-UBOOT",
+		.image_index = 1,
+	},
+};
+
+struct efi_capsule_update_info update_info = {
+	.dfu_string = "mmc 0=flash-bin raw 0x42 0x1000 mmcpart 1",
+	.images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_early_init_f(void)
 {
 	struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR;
diff --git a/board/kontron/sl-mx8mm/sl-mx8mm.c b/board/kontron/sl-mx8mm/sl-mx8mm.c
index 48376cb826..287c572eeb 100644
--- a/board/kontron/sl-mx8mm/sl-mx8mm.c
+++ b/board/kontron/sl-mx8mm/sl-mx8mm.c
@@ -6,12 +6,32 @@ 
 #include <asm/arch/imx-regs.h>
 #include <asm/global_data.h>
 #include <asm/io.h>
+#include <efi.h>
+#include <efi_loader.h>
 #include <fdt_support.h>
 #include <linux/errno.h>
+#include <linux/kernel.h>
 #include <net.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_images fw_images[] = {
+	{
+		.image_type_id = KONTRON_SL_MX8MM_FIT_IMAGE_GUID,
+		.fw_name = u"KONTROL-SL-MX8MM-UBOOT",
+		.image_index = 1,
+	},
+};
+
+struct efi_capsule_update_info update_info = {
+	.dfu_string = "sf 0:0=flash-bin raw 0x400 0x1f0000",
+	.images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_phys_sdram_size(phys_size_t *size)
 {
 	u32 ddr_size = readl(M4_BOOTROM_BASE_ADDR);
diff --git a/board/kontron/sl28/sl28.c b/board/kontron/sl28/sl28.c
index 3c48a9141d..0ffa351288 100644
--- a/board/kontron/sl28/sl28.c
+++ b/board/kontron/sl28/sl28.c
@@ -3,11 +3,14 @@ 
 #include <common.h>
 #include <dm.h>
 #include <malloc.h>
+#include <efi.h>
+#include <efi_loader.h>
 #include <errno.h>
 #include <fsl_ddr.h>
 #include <fdt_support.h>
 #include <asm/global_data.h>
 #include <linux/libfdt.h>
+#include <linux/kernel.h>
 #include <env_internal.h>
 #include <asm/arch-fsl-layerscape/soc.h>
 #include <asm/arch-fsl-layerscape/fsl_icid.h>
@@ -23,6 +26,24 @@ 
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_images fw_images[] = {
+	{
+		.image_type_id = KONTRON_SL28_FIT_IMAGE_GUID,
+		.fw_name = u"KONTRON-SL28-FIT",
+		.image_index = 1,
+	},
+};
+
+struct efi_capsule_update_info update_info = {
+	.dfu_string = "sf 0:0=u-boot-bin raw 0x210000 0x1d0000;"
+			"u-boot-env raw 0x3e0000 0x20000",
+	.images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 int board_early_init_f(void)
 {
 	fsl_lsch3_early_init_f();
diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c
index 5d9a945d64..d93aaa6a20 100644
--- a/board/sandbox/sandbox.c
+++ b/board/sandbox/sandbox.c
@@ -7,6 +7,8 @@ 
 #include <cpu_func.h>
 #include <cros_ec.h>
 #include <dm.h>
+#include <efi.h>
+#include <efi_loader.h>
 #include <env_internal.h>
 #include <init.h>
 #include <led.h>
@@ -14,6 +16,7 @@ 
 #include <asm/global_data.h>
 #include <asm/test.h>
 #include <asm/u-boot-sandbox.h>
+#include <linux/kernel.h>
 #include <malloc.h>
 
 #include <extension_board.h>
@@ -25,6 +28,37 @@ 
  */
 gd_t *gd;
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_images fw_images[] = {
+#if defined(CONFIG_EFI_CAPSULE_FIRMWARE_RAW)
+	{
+		.image_type_id = SANDBOX_UBOOT_IMAGE_GUID,
+		.fw_name = u"SANDBOX-UBOOT",
+		.image_index = 1,
+	},
+	{
+		.image_type_id = SANDBOX_UBOOT_ENV_IMAGE_GUID,
+		.fw_name = u"SANDBOX-UBOOT-ENV",
+		.image_index = 2,
+	},
+#elif defined(CONFIG_EFI_CAPSULE_FIRMWARE_FIT)
+	{
+		.image_type_id = SANDBOX_FIT_IMAGE_GUID,
+		.fw_name = u"SANDBOX-FIT",
+		.image_index = 1,
+	},
+#endif
+};
+
+struct efi_capsule_update_info update_info = {
+	.dfu_string = "sf 0:0=u-boot-bin raw 0x100000 0x50000;"
+		"u-boot-env raw 0x150000 0x200000",
+	.images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
 /*
  * Add a simple GPIO device (don't use with of-platdata as it interferes with
diff --git a/board/socionext/developerbox/developerbox.c b/board/socionext/developerbox/developerbox.c
index 9552bfcdc3..7820b7e68a 100644
--- a/board/socionext/developerbox/developerbox.c
+++ b/board/socionext/developerbox/developerbox.c
@@ -10,10 +10,43 @@ 
 #include <asm/global_data.h>
 #include <asm/io.h>
 #include <common.h>
+#include <efi.h>
+#include <efi_loader.h>
 #include <env_internal.h>
 #include <fdt_support.h>
 #include <log.h>
 
+#include <linux/kernel.h>
+
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_images fw_images[] = {
+	{
+		.image_type_id = DEVELOPERBOX_UBOOT_IMAGE_GUID,
+		.fw_name = u"DEVELOPERBOX-UBOOT",
+		.image_index = 1,
+	},
+	{
+		.image_type_id = DEVELOPERBOX_FIP_IMAGE_GUID,
+		.fw_name = u"DEVELOPERBOX-FIP",
+		.image_index = 2,
+	},
+	{
+		.image_type_id = DEVELOPERBOX_OPTEE_IMAGE_GUID,
+		.fw_name = u"DEVELOPERBOX-OPTEE",
+		.image_index = 3,
+	},
+};
+
+struct efi_capsule_update_info update_info = {
+	.dfu_string = "mtd nor1=u-boot.bin raw 200000 100000;"
+			"fip.bin raw 180000 78000;"
+			"optee.bin raw 500000 100000",
+	.images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 static struct mm_region sc2a11_mem_map[] = {
 	{
 		.virt = 0x0UL,
diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 0068cb8792..d4f3598d7e 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -5,6 +5,8 @@ 
  */
 
 #include <common.h>
+#include <efi.h>
+#include <efi_loader.h>
 #include <env.h>
 #include <log.h>
 #include <asm/global_data.h>
@@ -20,9 +22,35 @@ 
 #include <generated/dt.h>
 #include <soc.h>
 #include <linux/ctype.h>
+#include <linux/kernel.h>
 
 #include "fru.h"
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_images fw_images[] = {
+#if defined(XILINX_BOOT_IMAGE_GUID)
+	{
+		.image_type_id = XILINX_BOOT_IMAGE_GUID,
+		.fw_name = u"XILINX-BOOT",
+		.image_index = 1,
+	},
+#endif
+#if defined(XILINX_UBOOT_IMAGE_GUID)
+	{
+		.image_type_id = XILINX_UBOOT_IMAGE_GUID,
+		.fw_name = u"XILINX-UBOOT",
+		.image_index = 2,
+	},
+#endif
+};
+
+struct efi_capsule_update_info update_info = {
+	.images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 #if defined(CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET)
 int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
 {
diff --git a/include/configs/imx8mm-cl-iot-gate.h b/include/configs/imx8mm-cl-iot-gate.h
index 7e6be6050c..35df2e755e 100644
--- a/include/configs/imx8mm-cl-iot-gate.h
+++ b/include/configs/imx8mm-cl-iot-gate.h
@@ -31,6 +31,16 @@ 
 
 #endif
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+#define IMX8MM_CL_IOT_GATE_FIT_IMAGE_GUID \
+	EFI_GUID(0x7a32a939, 0xab92, 0x467b, 0x91, 0x52, \
+		 0x74, 0x77, 0x1b, 0x95, 0xe6, 0x46)
+
+#define IMX8MM_CL_IOT_GATE_OPTEE_FIT_IMAGE_GUID \
+	EFI_GUID(0x0bf1165c, 0x1831, 0x4864, 0x94, 0x5e, \
+		 0xac, 0x3d, 0x38, 0x48, 0xf4, 0x99)
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 #if CONFIG_IS_ENABLED(CMD_MMC)
 # define BOOT_TARGET_MMC(func) \
 	func(MMC, mmc, 2)      \
diff --git a/include/configs/imx8mp_rsb3720.h b/include/configs/imx8mp_rsb3720.h
index ac4a7d0cb3..a5a845c2da 100644
--- a/include/configs/imx8mp_rsb3720.h
+++ b/include/configs/imx8mp_rsb3720.h
@@ -21,6 +21,16 @@ 
 #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
 #define CONFIG_SYS_UBOOT_BASE	(QSPI0_AMBA_BASE + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512)
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+#define IMX8MP_RSB3720A1_4G_FIT_IMAGE_GUID \
+	EFI_GUID(0xb1251e89, 0x384a, 0x4635, 0xa8, 0x06, \
+		 0x3a, 0xa0, 0xb0, 0xe9, 0xf9, 0x65)
+
+#define IMX8MP_RSB3720A1_6G_FIT_IMAGE_GUID \
+	EFI_GUID(0xb5fb6f08, 0xe142, 0x4db1, 0x97, 0xea, \
+		 0x5f, 0xd3, 0x6b, 0x9b, 0xe5, 0xb9)
+#endif /* EFI_HAVE_CAPSULE_SUPPORT*/
+
 #ifdef CONFIG_SPL_BUILD
 #define CONFIG_SPL_LDSCRIPT		"arch/arm/cpu/armv8/u-boot-spl.lds"
 #define CONFIG_SPL_STACK		0x960000
diff --git a/include/configs/kontron-sl-mx8mm.h b/include/configs/kontron-sl-mx8mm.h
index 788ae77cd3..aff1b90010 100644
--- a/include/configs/kontron-sl-mx8mm.h
+++ b/include/configs/kontron-sl-mx8mm.h
@@ -38,6 +38,12 @@ 
 #define CONFIG_USB_MAX_CONTROLLER_COUNT	2
 #endif
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+#define KONTRON_SL_MX8MM_FIT_IMAGE_GUID \
+	EFI_GUID(0xd488e45a, 0x4929, 0x4b55, 0x8c, 0x14, \
+		 0x86, 0xce, 0xa2, 0xcd, 0x66, 0x29)
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 #ifndef CONFIG_SPL_BUILD
 #define BOOT_TARGET_DEVICES(func) \
 	func(MMC, mmc, 1) \
diff --git a/include/configs/kontron_pitx_imx8m.h b/include/configs/kontron_pitx_imx8m.h
index 0f96b905ab..678364e367 100644
--- a/include/configs/kontron_pitx_imx8m.h
+++ b/include/configs/kontron_pitx_imx8m.h
@@ -14,6 +14,12 @@ 
 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR	0x300
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+#define KONTRON_PITX_IMX8M_FIT_IMAGE_GUID \
+	EFI_GUID(0xc898e959, 0x5b1f, 0x4e6d, 0x88, 0xe0, \
+		 0x40, 0xd4, 0x5c, 0xca, 0x13, 0x99)
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 #ifdef CONFIG_SPL_BUILD
 #define CONFIG_SPL_LDSCRIPT		"arch/arm/cpu/armv8/u-boot-spl.lds"
 #define CONFIG_SPL_STACK		0x187FF0
diff --git a/include/configs/kontron_sl28.h b/include/configs/kontron_sl28.h
index 448749a7f8..97d0d365f6 100644
--- a/include/configs/kontron_sl28.h
+++ b/include/configs/kontron_sl28.h
@@ -57,6 +57,12 @@ 
 #define CONFIG_SYS_SPL_MALLOC_START	0x80200000
 #define CONFIG_SYS_MONITOR_LEN		(1024 * 1024)
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+#define KONTRON_SL28_FIT_IMAGE_GUID \
+	EFI_GUID(0x86ebd44f, 0xfeb8, 0x466f, 0x8b, 0xb8, \
+		 0x89, 0x06, 0x18, 0x45, 0x6d, 0x8b)
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 /* environment */
 /* see include/configs/ti_armv7_common.h */
 #define ENV_MEM_LAYOUT_SETTINGS \
diff --git a/include/configs/qemu-arm.h b/include/configs/qemu-arm.h
index d45f606860..2f2abc746d 100644
--- a/include/configs/qemu-arm.h
+++ b/include/configs/qemu-arm.h
@@ -17,6 +17,16 @@ 
 
 #define CONFIG_SYS_BOOTM_LEN		SZ_64M
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+#define QEMU_ARM_UBOOT_IMAGE_GUID \
+	EFI_GUID(0xf885b085, 0x99f8, 0x45af, 0x84, 0x7d, \
+		 0xd5, 0x14, 0x10, 0x7a, 0x4a, 0x2c)
+
+#define QEMU_ARM64_UBOOT_IMAGE_GUID \
+	EFI_GUID(0x058b7d83, 0x50d5, 0x4c47, 0xa1, 0x95, \
+		 0x60, 0xd8, 0x6a, 0xd3, 0x41, 0xc4)
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 /* For timer, QEMU emulates an ARMv7/ARMv8 architected timer */
 
 /* Environment options */
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index 75efbf3448..e951d08056 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -14,6 +14,20 @@ 
 
 #define CONFIG_SYS_CBSIZE		1024	/* Console I/O Buffer Size */
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+#define SANDBOX_UBOOT_IMAGE_GUID \
+	EFI_GUID(0x09d7cf52, 0x0720, 0x4710, 0x91, 0xd1, \
+		 0x08, 0x46, 0x9b, 0x7f, 0xe9, 0xc8)
+
+#define SANDBOX_UBOOT_ENV_IMAGE_GUID \
+	EFI_GUID(0x5a7021f5, 0xfef2, 0x48b4, 0xaa, 0xba, \
+		 0x83, 0x2e, 0x77, 0x74, 0x18, 0xc0)
+
+#define SANDBOX_FIT_IMAGE_GUID \
+	EFI_GUID(0x3673b45d, 0x6a7c, 0x46f3, 0x9e, 0x60, \
+		 0xad, 0xab, 0xb0, 0x3f, 0x79, 0x37)
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 /* Size of our emulated memory */
 #define SB_CONCAT(x, y) x ## y
 #define SB_TO_UL(s) SB_CONCAT(s, UL)
diff --git a/include/configs/synquacer.h b/include/configs/synquacer.h
index 8dd092fc59..07e1f56e3d 100644
--- a/include/configs/synquacer.h
+++ b/include/configs/synquacer.h
@@ -51,6 +51,20 @@ 
 			"fip.bin raw 180000 78000;"			\
 			"optee.bin raw 500000 100000\0"
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+#define DEVELOPERBOX_UBOOT_IMAGE_GUID \
+	EFI_GUID(0x53a92e83, 0x4ef4, 0x473a, 0x8b, 0x0d, \
+		 0xb5, 0xd8, 0xc7, 0xb2, 0xd6, 0x00)
+
+#define DEVELOPERBOX_FIP_IMAGE_GUID \
+	EFI_GUID(0x880866e9, 0x84ba, 0x4793, 0xa9, 0x08, \
+		 0x33, 0xe0, 0xb9, 0x16, 0xf3, 0x98)
+
+#define DEVELOPERBOX_OPTEE_IMAGE_GUID \
+	EFI_GUID(0xc1b629f1, 0xce0e, 0x4894, 0x82, 0xbf, \
+		 0xf0, 0xa3, 0x83, 0x87, 0xe6, 0x30)
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 /* Distro boot settings */
 #ifndef CONFIG_SPL_BUILD
 #ifdef CONFIG_CMD_USB
diff --git a/include/configs/xilinx_versal.h b/include/configs/xilinx_versal.h
index bc72f5f35f..95218962f7 100644
--- a/include/configs/xilinx_versal.h
+++ b/include/configs/xilinx_versal.h
@@ -31,6 +31,12 @@ 
 #define CONFIG_BOOTP_BOOTFILESIZE
 #define CONFIG_BOOTP_MAY_FAIL
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+#define XILINX_BOOT_IMAGE_GUID \
+	EFI_GUID(0x20c5fba5, 0x0171, 0x457f, 0xb9, 0xcd, \
+		 0xf5, 0x12, 0x9c, 0xd0, 0x72, 0x28)
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 /* Miscellaneous configurable options */
 
 /* Monitor Command Prompt */
diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h
index e51d92ffe4..942f004b15 100644
--- a/include/configs/xilinx_zynqmp.h
+++ b/include/configs/xilinx_zynqmp.h
@@ -31,6 +31,16 @@ 
 #define CONFIG_BOOTP_BOOTFILESIZE
 #define CONFIG_BOOTP_MAY_FAIL
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+#define XILINX_BOOT_IMAGE_GUID \
+	EFI_GUID(0xde6066e8, 0x0256, 0x4fad, 0x82, 0x38, \
+		 0xe4, 0x06, 0xe2, 0x74, 0xc4, 0xcf)
+
+#define XILINX_UBOOT_IMAGE_GUID \
+	EFI_GUID(0xcf9ecfd4, 0x938b, 0x41c5, 0x85, 0x51, \
+		 0x1f, 0x88, 0x3a, 0xb7, 0xdc, 0x18)
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 #ifdef CONFIG_NAND_ARASAN
 # define CONFIG_SYS_MAX_NAND_DEVICE	1
 #endif
diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h
index 780952cf5f..d116947d25 100644
--- a/include/configs/zynq-common.h
+++ b/include/configs/zynq-common.h
@@ -20,6 +20,16 @@ 
 #define CONFIG_SYS_TIMER_COUNTS_DOWN
 #define CONFIG_SYS_TIMER_COUNTER	(CONFIG_SYS_TIMERBASE + 0x4)
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+#define XILINX_BOOT_IMAGE_GUID \
+	EFI_GUID(0x1ba29a15, 0x9969, 0x40aa, 0xb4, 0x24, \
+		 0xe8, 0x61, 0x21, 0x61, 0x86, 0x64)
+
+#define XILINX_UBOOT_IMAGE_GUID \
+	EFI_GUID(0x1a5178f0, 0x87d3, 0x4f36, 0xac, 0x63, \
+		 0x3b, 0x31, 0xa2, 0x3b, 0xe3, 0x05)
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
 /* Serial drivers */
 /* The following table includes the supported baudrates */
 #define CONFIG_SYS_BAUDRATE_TABLE  \
diff --git a/include/efi_loader.h b/include/efi_loader.h
index af36639ec6..a064a2c4ec 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -979,6 +979,42 @@  efi_status_t efi_capsule_authenticate(const void *capsule,
 
 #define EFI_CAPSULE_DIR u"\\EFI\\UpdateCapsule\\"
 
+/**
+ * struct efi_fw_images - List of firmware images updatable through capsule
+ *                        update
+ *
+ * This structure gives information about the firmware images on the platform
+ * which can be updated through the capsule update mechanism
+ *
+ * @image_type_id:	Image GUID. Same value is to be used in the capsule
+ * @fw_name:		Name of the firmware image
+ * @image_index:	Image Index, same as value passed to SetImage FMP
+ *                      function
+ */
+struct efi_fw_images {
+	efi_guid_t image_type_id;
+	u16 *fw_name;
+	u8 image_index;
+};
+
+/**
+ * struct efi_capsule_update_info - Information needed for capsule updates
+ *
+ * This structure provides information needed for performing firmware
+ * updates. The structure needs to be initialised per platform, for all
+ * platforms which enable capsule updates
+ *
+ * @dfu_string:		String used to populate dfu_alt_info
+ * @images:		Pointer to an array of updatable images
+ */
+struct efi_capsule_update_info {
+	const char *dfu_string;
+	struct efi_fw_images *images;
+};
+
+extern struct efi_capsule_update_info update_info;
+extern u8 num_image_type_guids;
+
 /**
  * Install the ESRT system table.
  *