[PATCH v3 02/19] board: am64x: Define capsule update firmware info

Roger Quadros rogerq at kernel.org
Tue Apr 23 14:16:22 CEST 2024



On 19/04/2024 23:56, Jonathan Humphreys wrote:
> Define the firmware components updatable via EFI capsule update, including
> defining capsule GUIDs for the various firmware components for the AM64x SK.
> 
> Signed-off-by: Jonathan Humphreys <j-humphreys at ti.com>
> ---
>  board/ti/am64x/evm.c        | 33 +++++++++++++++++++++++++++++++++
>  include/configs/am64x_evm.h | 24 ++++++++++++++++++++++++
>  2 files changed, 57 insertions(+)
> 
> diff --git a/board/ti/am64x/evm.c b/board/ti/am64x/evm.c
> index b8de69da06c..83df75a6911 100644
> --- a/board/ti/am64x/evm.c
> +++ b/board/ti/am64x/evm.c
> @@ -7,6 +7,7 @@
>   *
>   */
>  
> +#include <efi_loader.h>
>  #include <asm/io.h>
>  #include <dm/uclass.h>
>  #include <k3-ddrss.h>
> @@ -27,6 +28,38 @@
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> +#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)

Checkpatch warns:

WARNING: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible
#31: FILE: board/ti/am64x/evm.c:31:
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)


How about we drop the #if here and instead see possible solution below.

> +struct efi_fw_image fw_images[] = {
> +	{
> +		.image_type_id = AM64X_SK_TIBOOT3_IMAGE_GUID,
> +		.fw_name = u"AM64X_SK_TIBOOT3",
> +		.image_index = 1,
> +	},
> +	{
> +		.image_type_id = AM64X_SK_SPL_IMAGE_GUID,
> +		.fw_name = u"AM64X_SK_SPL",
> +		.image_index = 2,
> +	},
> +	{
> +		.image_type_id = AM64X_SK_UBOOT_IMAGE_GUID,
> +		.fw_name = u"AM64X_SK_UBOOT",
> +		.image_index = 3,
> +	}
> +};
> +
> +struct efi_capsule_update_info update_info = {
> +	.dfu_string = "sf 0:0=tiboot3.bin raw 0 100000;tispl.bin raw 100000 200000;u-boot.img raw 300000 400000",
> +	.num_images = ARRAY_SIZE(fw_images),
> +	.images = fw_images,
> +};
> +
> +void set_dfu_alt_info(char *interface, char *devstr)
> +{

set the environment variable only if relevant config is enabled.

if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT))

> +	env_set("dfu_alt_info", update_info.dfu_string);

> +}
> +
> +#endif /* EFI_HAVE_CAPSULE_SUPPORT */
> +
>  int board_init(void)
>  {
>  	return 0;
> diff --git a/include/configs/am64x_evm.h b/include/configs/am64x_evm.h
> index f9f8c7bc2f6..9db83621ea8 100644
> --- a/include/configs/am64x_evm.h
> +++ b/include/configs/am64x_evm.h
> @@ -9,6 +9,30 @@
>  #ifndef __CONFIG_AM642_EVM_H
>  #define __CONFIG_AM642_EVM_H
>  
> +/**
> + * define AM64X_SK_TIBOOT3_IMAGE_GUID - firmware GUID for AM64X sk tiboot3.bin
> + * define AM64X_SK_SPL_IMAGE_GUID     - firmware GUID for AM64X sk SPL
> + * define AM64X_SK_UBOOT_IMAGE_GUID   - firmware GUID for AM64X sk UBOOT
> + *
> + * These GUIDs are used in capsules updates to identify the corresponding
> + * firmware object.
> + *
> + * Board developers using this as a starting reference should
> + * define their own GUIDs to ensure that firmware repositories (like
> + * LVFS) do not confuse them.
> + */
> +#define AM64X_SK_TIBOOT3_IMAGE_GUID \
> +	EFI_GUID(0xede0a0d5, 0x9116, 0x4bfb, 0xaa, 0x54, \
> +		0x09, 0xe9, 0x7b, 0x5a, 0xfe, 0x1a)
> +
> +#define AM64X_SK_SPL_IMAGE_GUID \
> +	EFI_GUID(0x77678f5c, 0x64d4, 0x4910, 0xad, 0x75, \
> +		0x52, 0xc9, 0xd9, 0x5c, 0xdb, 0x1d)
> +
> +#define AM64X_SK_UBOOT_IMAGE_GUID \
> +	EFI_GUID(0xc6ad43a9, 0x7d31, 0x4f5d, 0x83, 0xe9, \
> +		0xb8, 0xef, 0xec, 0xae, 0x05, 0xbf)
> +
>  /* Now for the remaining common defines */
>  #include <configs/ti_armv7_common.h>
>  

-- 
cheers,
-roger


More information about the U-Boot mailing list