[PATCH v3 3/3] board: remove capsule update support in set_dfu_alt_info()
Ilias Apalodimas
ilias.apalodimas at linaro.org
Tue Feb 18 09:10:29 CET 2025
Hi Jonathan
This is a nice cleanup.
[...]
>
> {
> return 0;
> diff --git a/board/xilinx/common/board.h b/board/xilinx/common/board.h
> index 64d657673e9..cb86c4c5b91 100644
> --- a/board/xilinx/common/board.h
> +++ b/board/xilinx/common/board.h
> @@ -18,4 +18,7 @@ bool board_detection(void);
> char *soc_name_decode(void);
>
> bool soc_detection(void);
> +
> +void configure_capsule_updates(void);
> +
> #endif /* BOARD_XILINX_COMMON_BOARD_H */
> diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c
> index 2c387630a61..05530736751 100644
> --- a/board/xilinx/versal/board.c
> +++ b/board/xilinx/versal/board.c
> @@ -281,6 +281,9 @@ int board_late_init(void)
> {
> int ret;
>
> + if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT))
> + configure_capsule_updates();
> +
> if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
> debug("Saved variables - Skipping\n");
> return 0;
> @@ -357,8 +360,6 @@ enum env_location env_get_location(enum env_operation op, int prio)
> }
> #endif
>
> -#if defined(CONFIG_SET_DFU_ALT_INFO)
> -
> #define DFU_ALT_BUF_LEN SZ_1K
>
> static void mtd_found_part(u32 *base, u32 *size)
> @@ -386,7 +387,7 @@ static void mtd_found_part(u32 *base, u32 *size)
> }
> }
>
> -void set_dfu_alt_info(char *interface, char *devstr)
> +void configure_capsule_updates(void)
> {
> int bootseq = 0, len = 0;
> u32 multiboot = versal_multi_boot();
> @@ -394,9 +395,6 @@ void set_dfu_alt_info(char *interface, char *devstr)
>
> ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN);
>
> - if (env_get("dfu_alt_info"))
> - return;
> -
> memset(buf, 0, sizeof(buf));
>
> multiboot = env_get_hex("multiboot", multiboot);
> @@ -437,9 +435,6 @@ void set_dfu_alt_info(char *interface, char *devstr)
> return;
> }
>
> - env_set("dfu_alt_info", buf);
> - puts("DFU alt info setting: done\n");
> update_info.dfu_string = strdup(buf);
> debug("Capsule DFU: %s\n", update_info.dfu_string);
> }
> -#endif
> diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c
> index bd004b86a88..b1fd768a26c 100644
> --- a/board/xilinx/zynq/board.c
> +++ b/board/xilinx/zynq/board.c
> @@ -53,6 +53,9 @@ int board_late_init(void)
> char *new_targets;
> char *env_targets;
>
> + if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT))
> + configure_capsule_updates();
> +
> if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
> debug("Saved variables - Skipping\n");
> return 0;
> @@ -166,17 +169,12 @@ enum env_location env_get_location(enum env_operation op, int prio)
> }
> }
>
> -#if defined(CONFIG_SET_DFU_ALT_INFO)
> -
> #define DFU_ALT_BUF_LEN SZ_1K
>
> -void set_dfu_alt_info(char *interface, char *devstr)
> +void configure_capsule_updates(void)
> {
> ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN);
>
> - if (env_get("dfu_alt_info"))
> - return;
> -
> memset(buf, 0, sizeof(buf));
>
> switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
> @@ -198,9 +196,6 @@ void set_dfu_alt_info(char *interface, char *devstr)
> return;
> }
>
> - env_set("dfu_alt_info", buf);
> - puts("DFU alt info setting: done\n");
> update_info.dfu_string = strdup(buf);
> debug("Capsule DFU: %s\n", update_info.dfu_string);
> }
> -#endif
> diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
> index 8060d54428d..33205d4cf1d 100644
> --- a/board/xilinx/zynqmp/zynqmp.c
> +++ b/board/xilinx/zynqmp/zynqmp.c
> @@ -527,6 +527,9 @@ int board_late_init(void)
> usb_ether_init();
> #endif
>
> + if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT))
> + configure_capsule_updates();
> +
> multiboot = multi_boot();
> if (multiboot >= 0)
> env_set_hex("multiboot", multiboot);
> @@ -632,8 +635,6 @@ enum env_location env_get_location(enum env_operation op, int prio)
> }
> #endif
>
> -#if defined(CONFIG_SET_DFU_ALT_INFO)
> -
> #define DFU_ALT_BUF_LEN SZ_1K
>
> static void mtd_found_part(u32 *base, u32 *size)
> @@ -661,15 +662,12 @@ static void mtd_found_part(u32 *base, u32 *size)
> }
> }
>
> -void set_dfu_alt_info(char *interface, char *devstr)
> +void configure_capsule_updates(void)
> {
> int multiboot, bootseq = 0, len = 0;
>
> ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN);
>
> - if (env_get("dfu_alt_info"))
> - return;
> -
> memset(buf, 0, sizeof(buf));
>
> multiboot = multi_boot();
> @@ -733,12 +731,9 @@ void set_dfu_alt_info(char *interface, char *devstr)
> return;
> }
>
> - env_set("dfu_alt_info", buf);
> - puts("DFU alt info setting: done\n");
> update_info.dfu_string = strdup(buf);
> debug("Capsule DFU: %s\n", update_info.dfu_string);
> }
> -#endif
>
> #if defined(CONFIG_SPL_SPI_LOAD)
> unsigned int spl_spi_get_uboot_offs(struct spi_flash *flash)
> diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> index d4f6b56afaa..1be11aed901 100644
> --- a/lib/efi_loader/Kconfig
> +++ b/lib/efi_loader/Kconfig
> @@ -304,7 +304,6 @@ config EFI_CAPSULE_FIRMWARE_FIT
> depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
> select UPDATE_FIT
> select DFU
> - select SET_DFU_ALT_INFO
> select EFI_CAPSULE_FIRMWARE
> help
> Select this option if you want to enable firmware management protocol
> @@ -316,7 +315,6 @@ config EFI_CAPSULE_FIRMWARE_RAW
> depends on SANDBOX || (!SANDBOX && !EFI_CAPSULE_FIRMWARE_FIT)
> select DFU_WRITE_ALT
> select DFU
> - select SET_DFU_ALT_INFO
> select EFI_CAPSULE_FIRMWARE
> help
> Select this option if you want to enable firmware management protocol
> diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
> index 1a1cf3b55e1..3286c21a2b7 100644
> --- a/lib/efi_loader/efi_firmware.c
> +++ b/lib/efi_loader/efi_firmware.c
> @@ -56,11 +56,6 @@ struct fmp_state {
> u32 last_attempt_status; /* not used */
> };
>
> -__weak void set_dfu_alt_info(char *interface, char *devstr)
> -{
> - env_set("dfu_alt_info", update_info.dfu_string);
> -}
> -
> /**
> * efi_firmware_get_image_type_id - get image_type_id
> * @image_index: image index
> --
> 2.34.1
>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
More information about the U-Boot
mailing list