diff mbox series

[v9,05/15] stm32mp1: dk2: Add image information for capsule updates

Message ID 20220826095716.1676150-6-sughosh.ganu@linaro.org
State Superseded
Headers show
Series FWU: Add FWU Multi Bank Update feature support | expand

Commit Message

Sughosh Ganu Aug. 26, 2022, 9:57 a.m. UTC
Enabling capsule update functionality on the platform requires
populating information on the images that are to be updated using the
functionality. Do so for the DK2 board.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
---
Changes since V8:
* Use STM32MP_FIP_IMAGE_GUID for the FIP GUID value as suggested by
  Yann

 board/st/stm32mp1/stm32mp1.c       | 23 +++++++++++++++++++++++
 include/configs/stm32mp15_common.h |  4 ++++
 2 files changed, 27 insertions(+)

Comments

Ilias Apalodimas Sept. 4, 2022, 7:11 a.m. UTC | #1
On Fri, Aug 26, 2022 at 03:27:06PM +0530, Sughosh Ganu wrote:
> Enabling capsule update functionality on the platform requires
> populating information on the images that are to be updated using the
> functionality. Do so for the DK2 board.
> 
> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> ---
> Changes since V8:
> * Use STM32MP_FIP_IMAGE_GUID for the FIP GUID value as suggested by
>   Yann
> 
>  board/st/stm32mp1/stm32mp1.c       | 23 +++++++++++++++++++++++
>  include/configs/stm32mp15_common.h |  4 ++++
>  2 files changed, 27 insertions(+)
> 
> diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
> index 9496890d16..bfec0a710d 100644
> --- a/board/st/stm32mp1/stm32mp1.c
> +++ b/board/st/stm32mp1/stm32mp1.c
> @@ -11,6 +11,7 @@
>  #include <clk.h>
>  #include <config.h>
>  #include <dm.h>
> +#include <efi_loader.h>
>  #include <env.h>
>  #include <env_internal.h>
>  #include <fdt_simplefb.h>
> @@ -87,6 +88,16 @@
>  #define USB_START_LOW_THRESHOLD_UV	1230000
>  #define USB_START_HIGH_THRESHOLD_UV	2150000
>  
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +struct efi_fw_image fw_images[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 */
> +
>  int board_early_init_f(void)
>  {
>  	/* nothing to do, only used in SPL */
> @@ -670,6 +681,18 @@ int board_init(void)
>  
>  	setup_led(LEDST_ON);
>  
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +	if (board_is_stm32mp15x_dk2()) {
> +		efi_guid_t image_type_guid = STM32MP_FIP_IMAGE_GUID;
> +		guidcpy(&fw_images[0].image_type_id, &image_type_guid);
> +		fw_images[0].fw_name = u"STM32MP-FIP";
> +		/*
> +		 * For FWU multi bank update, the image
> +		 * index will be computed at runtime
> +		 */
> +		fw_images[0].image_index = 0;
> +	}
> +#endif
>  	return 0;
>  }
>  
> diff --git a/include/configs/stm32mp15_common.h b/include/configs/stm32mp15_common.h
> index c5412ffeb3..bb19dae945 100644
> --- a/include/configs/stm32mp15_common.h
> +++ b/include/configs/stm32mp15_common.h
> @@ -34,6 +34,10 @@
>  #define CONFIG_SERVERIP                 192.168.1.1
>  #endif
>  
> +#define STM32MP_FIP_IMAGE_GUID \
> +	EFI_GUID(0x19d5df83, 0x11b0, 0x457b, 0xbe, 0x2c, \
> +		 0x75, 0x59, 0xc1, 0x31, 0x42, 0xa5)
> +
>  /*****************************************************************************/
>  #ifdef CONFIG_DISTRO_DEFAULTS
>  /*****************************************************************************/
> -- 
> 2.34.1
> 

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Etienne Carriere Sept. 5, 2022, 7:18 p.m. UTC | #2
Hello Sughosh,

On Fri, 26 Aug 2022 at 11:57, Sughosh Ganu <sughosh.ganu@linaro.org> wrote:
>
> Enabling capsule update functionality on the platform requires
> populating information on the images that are to be updated using the
> functionality. Do so for the DK2 board.
>
> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> ---
> Changes since V8:
> * Use STM32MP_FIP_IMAGE_GUID for the FIP GUID value as suggested by
>   Yann
>
>  board/st/stm32mp1/stm32mp1.c       | 23 +++++++++++++++++++++++
>  include/configs/stm32mp15_common.h |  4 ++++
>  2 files changed, 27 insertions(+)
>
> diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
> index 9496890d16..bfec0a710d 100644
> --- a/board/st/stm32mp1/stm32mp1.c
> +++ b/board/st/stm32mp1/stm32mp1.c
> @@ -11,6 +11,7 @@
>  #include <clk.h>
>  #include <config.h>
>  #include <dm.h>
> +#include <efi_loader.h>
>  #include <env.h>
>  #include <env_internal.h>
>  #include <fdt_simplefb.h>
> @@ -87,6 +88,16 @@
>  #define USB_START_LOW_THRESHOLD_UV     1230000
>  #define USB_START_HIGH_THRESHOLD_UV    2150000
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +struct efi_fw_image fw_images[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 */
> +
>  int board_early_init_f(void)
>  {
>         /* nothing to do, only used in SPL */
> @@ -670,6 +681,18 @@ int board_init(void)
>
>         setup_led(LEDST_ON);
>
> +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> +       if (board_is_stm32mp15x_dk2()) {

Sorry for this late comment.
Should this be restricted to mp15-dk2?
I would remove the test and apply when CONFIG_EFI_HAVE_CAPSULE_SUPPORT
is enable.


> +               efi_guid_t image_type_guid = STM32MP_FIP_IMAGE_GUID;
> +               guidcpy(&fw_images[0].image_type_id, &image_type_guid);
> +               fw_images[0].fw_name = u"STM32MP-FIP";
> +               /*
> +                * For FWU multi bank update, the image
> +                * index will be computed at runtime
> +                */
> +               fw_images[0].image_index = 0;
> +       }
> +#endif
>         return 0;
>  }
>
> diff --git a/include/configs/stm32mp15_common.h b/include/configs/stm32mp15_common.h
> index c5412ffeb3..bb19dae945 100644
> --- a/include/configs/stm32mp15_common.h
> +++ b/include/configs/stm32mp15_common.h
> @@ -34,6 +34,10 @@
>  #define CONFIG_SERVERIP                 192.168.1.1
>  #endif
>
> +#define STM32MP_FIP_IMAGE_GUID \
> +       EFI_GUID(0x19d5df83, 0x11b0, 0x457b, 0xbe, 0x2c, \
> +                0x75, 0x59, 0xc1, 0x31, 0x42, 0xa5)
> +
>  /*****************************************************************************/
>  #ifdef CONFIG_DISTRO_DEFAULTS
>  /*****************************************************************************/
> --
> 2.34.1
>
Sughosh Ganu Sept. 6, 2022, 7:08 a.m. UTC | #3
hi Etienne,

On Tue, 6 Sept 2022 at 00:49, Etienne Carriere
<etienne.carriere@linaro.org> wrote:
>
> Hello Sughosh,
>
> On Fri, 26 Aug 2022 at 11:57, Sughosh Ganu <sughosh.ganu@linaro.org> wrote:
> >
> > Enabling capsule update functionality on the platform requires
> > populating information on the images that are to be updated using the
> > functionality. Do so for the DK2 board.
> >
> > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> > ---
> > Changes since V8:
> > * Use STM32MP_FIP_IMAGE_GUID for the FIP GUID value as suggested by
> >   Yann
> >
> >  board/st/stm32mp1/stm32mp1.c       | 23 +++++++++++++++++++++++
> >  include/configs/stm32mp15_common.h |  4 ++++
> >  2 files changed, 27 insertions(+)
> >
> > diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
> > index 9496890d16..bfec0a710d 100644
> > --- a/board/st/stm32mp1/stm32mp1.c
> > +++ b/board/st/stm32mp1/stm32mp1.c
> > @@ -11,6 +11,7 @@
> >  #include <clk.h>
> >  #include <config.h>
> >  #include <dm.h>
> > +#include <efi_loader.h>
> >  #include <env.h>
> >  #include <env_internal.h>
> >  #include <fdt_simplefb.h>
> > @@ -87,6 +88,16 @@
> >  #define USB_START_LOW_THRESHOLD_UV     1230000
> >  #define USB_START_HIGH_THRESHOLD_UV    2150000
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +struct efi_fw_image fw_images[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 */
> > +
> >  int board_early_init_f(void)
> >  {
> >         /* nothing to do, only used in SPL */
> > @@ -670,6 +681,18 @@ int board_init(void)
> >
> >         setup_led(LEDST_ON);
> >
> > +#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
> > +       if (board_is_stm32mp15x_dk2()) {
>
> Sorry for this late comment.
> Should this be restricted to mp15-dk2?
> I would remove the test and apply when CONFIG_EFI_HAVE_CAPSULE_SUPPORT
> is enable.

You are right. With the changes made in the V9 version of this patch,
I believe this check is redundant. I will remove this in the next
version. Thanks.

-sughosh


>
>
> > +               efi_guid_t image_type_guid = STM32MP_FIP_IMAGE_GUID;
> > +               guidcpy(&fw_images[0].image_type_id, &image_type_guid);
> > +               fw_images[0].fw_name = u"STM32MP-FIP";
> > +               /*
> > +                * For FWU multi bank update, the image
> > +                * index will be computed at runtime
> > +                */
> > +               fw_images[0].image_index = 0;
> > +       }
> > +#endif
> >         return 0;
> >  }
> >
> > diff --git a/include/configs/stm32mp15_common.h b/include/configs/stm32mp15_common.h
> > index c5412ffeb3..bb19dae945 100644
> > --- a/include/configs/stm32mp15_common.h
> > +++ b/include/configs/stm32mp15_common.h
> > @@ -34,6 +34,10 @@
> >  #define CONFIG_SERVERIP                 192.168.1.1
> >  #endif
> >
> > +#define STM32MP_FIP_IMAGE_GUID \
> > +       EFI_GUID(0x19d5df83, 0x11b0, 0x457b, 0xbe, 0x2c, \
> > +                0x75, 0x59, 0xc1, 0x31, 0x42, 0xa5)
> > +
> >  /*****************************************************************************/
> >  #ifdef CONFIG_DISTRO_DEFAULTS
> >  /*****************************************************************************/
> > --
> > 2.34.1
> >
diff mbox series

Patch

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 9496890d16..bfec0a710d 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -11,6 +11,7 @@ 
 #include <clk.h>
 #include <config.h>
 #include <dm.h>
+#include <efi_loader.h>
 #include <env.h>
 #include <env_internal.h>
 #include <fdt_simplefb.h>
@@ -87,6 +88,16 @@ 
 #define USB_START_LOW_THRESHOLD_UV	1230000
 #define USB_START_HIGH_THRESHOLD_UV	2150000
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[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 */
+
 int board_early_init_f(void)
 {
 	/* nothing to do, only used in SPL */
@@ -670,6 +681,18 @@  int board_init(void)
 
 	setup_led(LEDST_ON);
 
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+	if (board_is_stm32mp15x_dk2()) {
+		efi_guid_t image_type_guid = STM32MP_FIP_IMAGE_GUID;
+		guidcpy(&fw_images[0].image_type_id, &image_type_guid);
+		fw_images[0].fw_name = u"STM32MP-FIP";
+		/*
+		 * For FWU multi bank update, the image
+		 * index will be computed at runtime
+		 */
+		fw_images[0].image_index = 0;
+	}
+#endif
 	return 0;
 }
 
diff --git a/include/configs/stm32mp15_common.h b/include/configs/stm32mp15_common.h
index c5412ffeb3..bb19dae945 100644
--- a/include/configs/stm32mp15_common.h
+++ b/include/configs/stm32mp15_common.h
@@ -34,6 +34,10 @@ 
 #define CONFIG_SERVERIP                 192.168.1.1
 #endif
 
+#define STM32MP_FIP_IMAGE_GUID \
+	EFI_GUID(0x19d5df83, 0x11b0, 0x457b, 0xbe, 0x2c, \
+		 0x75, 0x59, 0xc1, 0x31, 0x42, 0xa5)
+
 /*****************************************************************************/
 #ifdef CONFIG_DISTRO_DEFAULTS
 /*****************************************************************************/