Re: [PATCH v6 1/8] efi_loader: add the number of image entries in efi_capsule_update_info
On Fri, May 19, 2023 at 07:32:07PM +0900, Masahisa Kojima wrote: > The number of image array entries global variable is required > to support EFI capsule update. This information is exposed as a > num_image_type_guids variable, but this information > should be included in the efi_capsule_update_info structure. > > This commit adds the num_images member in the > efi_capsule_update_info structure. All board files supporting > EFI capsule update are updated. > > Signed-off-by: Masahisa Kojima > --- > Newly created in v6 > > arch/arm/mach-rockchip/board.c | 4 ++-- > board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c| 2 +- > board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c | 2 +- > board/emulation/qemu-arm/qemu-arm.c| 2 +- > board/kontron/pitx_imx8m/pitx_imx8m.c | 2 +- > board/kontron/sl-mx8mm/sl-mx8mm.c | 2 +- > board/kontron/sl28/sl28.c | 2 +- > board/rockchip/evb_rk3399/evb-rk3399.c | 2 +- > board/sandbox/sandbox.c| 2 +- > board/socionext/developerbox/developerbox.c| 2 +- > board/st/stm32mp1/stm32mp1.c | 2 +- > board/xilinx/common/board.c| 2 +- > include/efi_loader.h | 3 ++- > lib/efi_loader/efi_firmware.c | 6 +++--- > lib/fwu_updates/fwu.c | 2 +- > 15 files changed, 19 insertions(+), 18 deletions(-) > > diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c > index f1f70c81d0..8daa74b3eb 100644 > --- a/arch/arm/mach-rockchip/board.c > +++ b/arch/arm/mach-rockchip/board.c > @@ -41,7 +41,7 @@ static bool updatable_image(struct disk_partition *info) > uuid_str_to_bin(info->type_guid, image_type_guid.b, > UUID_STR_FORMAT_GUID); > > - for (i = 0; i < num_image_type_guids; i++) { > + for (i = 0; i < update_info.num_images; i++) { > if (!guidcmp(_images[i].image_type_id, _type_guid)) { > ret = true; > break; > @@ -59,7 +59,7 @@ static void set_image_index(struct disk_partition *info, > int index) > uuid_str_to_bin(info->type_guid, image_type_guid.b, > UUID_STR_FORMAT_GUID); > > - for (i = 0; i < num_image_type_guids; i++) { > + for (i = 0; i < update_info.num_images; i++) { > if (!guidcmp(_images[i].image_type_id, _type_guid)) { > fw_images[i].image_index = index; > break; > diff --git a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > index 466174679e..b79a2380aa 100644 > --- a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > +++ b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > @@ -54,10 +54,10 @@ struct efi_fw_image fw_images[] = { > > struct efi_capsule_update_info update_info = { > .dfu_string = "mmc 2=flash-bin raw 0 0x1B00 mmcpart 1", > + .num_images = ARRAY_SIZE(fw_images), > .images = fw_images, > }; > > -u8 num_image_type_guids = ARRAY_SIZE(fw_images); > #endif /* EFI_HAVE_CAPSULE_SUPPORT */ > > > 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 b373e45df9..af070ec315 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 > @@ -50,10 +50,10 @@ struct efi_fw_image fw_images[] = { > > struct efi_capsule_update_info update_info = { > .dfu_string = "mmc 2=flash-bin raw 0x42 0x1D00 mmcpart 1", > + .num_images = ARRAY_SIZE(fw_images), > .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) > diff --git a/board/emulation/qemu-arm/qemu-arm.c > b/board/emulation/qemu-arm/qemu-arm.c > index 34ed3e8ae6..dfea0d92a3 100644 > --- a/board/emulation/qemu-arm/qemu-arm.c > +++ b/board/emulation/qemu-arm/qemu-arm.c > @@ -47,10 +47,10 @@ struct efi_fw_image fw_images[] = { > }; > > struct efi_capsule_update_info update_info = { > + .num_images = ARRAY_SIZE(fw_images) > .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[] = { > diff --git a/board/kontron/pitx_imx8m/pitx_imx8m.c > b/board/kontron/pitx_imx8m/pitx_imx8m.c > index fcda86bc1b..4548e7c1df 100644 > --- a/board/kontron/pitx_imx8m/pitx_imx8m.c > +++ b/board/kontron/pitx_imx8m/pitx_imx8m.c > @@ -43,10 +43,10 @@ struct efi_fw_image fw_images[] = { > > struct efi_capsule_update_info update_info = { > .dfu_string = "mmc 0=flash-bin raw 0x42 0x1000 mmcpart 1", > + .num_images = ARRAY_SIZE(fw_images),
Re: [PATCH v6 1/8] efi_loader: add the number of image entries in efi_capsule_update_info
On Fri, May 19, 2023 at 07:32:07PM +0900, Masahisa Kojima wrote: > The number of image array entries global variable is required > to support EFI capsule update. This information is exposed as a > num_image_type_guids variable, but this information > should be included in the efi_capsule_update_info structure. > > This commit adds the num_images member in the > efi_capsule_update_info structure. All board files supporting > EFI capsule update are updated. > > Signed-off-by: Masahisa Kojima > --- > Newly created in v6 > > arch/arm/mach-rockchip/board.c | 4 ++-- > board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c| 2 +- > board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c | 2 +- > board/emulation/qemu-arm/qemu-arm.c| 2 +- > board/kontron/pitx_imx8m/pitx_imx8m.c | 2 +- > board/kontron/sl-mx8mm/sl-mx8mm.c | 2 +- > board/kontron/sl28/sl28.c | 2 +- > board/rockchip/evb_rk3399/evb-rk3399.c | 2 +- > board/sandbox/sandbox.c| 2 +- > board/socionext/developerbox/developerbox.c| 2 +- > board/st/stm32mp1/stm32mp1.c | 2 +- > board/xilinx/common/board.c| 2 +- > include/efi_loader.h | 3 ++- > lib/efi_loader/efi_firmware.c | 6 +++--- > lib/fwu_updates/fwu.c | 2 +- > 15 files changed, 19 insertions(+), 18 deletions(-) > > diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c > index f1f70c81d0..8daa74b3eb 100644 > --- a/arch/arm/mach-rockchip/board.c > +++ b/arch/arm/mach-rockchip/board.c > @@ -41,7 +41,7 @@ static bool updatable_image(struct disk_partition *info) > uuid_str_to_bin(info->type_guid, image_type_guid.b, > UUID_STR_FORMAT_GUID); > > - for (i = 0; i < num_image_type_guids; i++) { > + for (i = 0; i < update_info.num_images; i++) { > if (!guidcmp(_images[i].image_type_id, _type_guid)) { > ret = true; > break; > @@ -59,7 +59,7 @@ static void set_image_index(struct disk_partition *info, > int index) > uuid_str_to_bin(info->type_guid, image_type_guid.b, > UUID_STR_FORMAT_GUID); > > - for (i = 0; i < num_image_type_guids; i++) { > + for (i = 0; i < update_info.num_images; i++) { > if (!guidcmp(_images[i].image_type_id, _type_guid)) { > fw_images[i].image_index = index; > break; > diff --git a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > index 466174679e..b79a2380aa 100644 > --- a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > +++ b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c > @@ -54,10 +54,10 @@ struct efi_fw_image fw_images[] = { > > struct efi_capsule_update_info update_info = { > .dfu_string = "mmc 2=flash-bin raw 0 0x1B00 mmcpart 1", > + .num_images = ARRAY_SIZE(fw_images), > .images = fw_images, > }; > > -u8 num_image_type_guids = ARRAY_SIZE(fw_images); > #endif /* EFI_HAVE_CAPSULE_SUPPORT */ > > > 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 b373e45df9..af070ec315 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 > @@ -50,10 +50,10 @@ struct efi_fw_image fw_images[] = { > > struct efi_capsule_update_info update_info = { > .dfu_string = "mmc 2=flash-bin raw 0x42 0x1D00 mmcpart 1", > + .num_images = ARRAY_SIZE(fw_images), > .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) > diff --git a/board/emulation/qemu-arm/qemu-arm.c > b/board/emulation/qemu-arm/qemu-arm.c > index 34ed3e8ae6..dfea0d92a3 100644 > --- a/board/emulation/qemu-arm/qemu-arm.c > +++ b/board/emulation/qemu-arm/qemu-arm.c > @@ -47,10 +47,10 @@ struct efi_fw_image fw_images[] = { > }; > > struct efi_capsule_update_info update_info = { > + .num_images = ARRAY_SIZE(fw_images) > .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[] = { > diff --git a/board/kontron/pitx_imx8m/pitx_imx8m.c > b/board/kontron/pitx_imx8m/pitx_imx8m.c > index fcda86bc1b..4548e7c1df 100644 > --- a/board/kontron/pitx_imx8m/pitx_imx8m.c > +++ b/board/kontron/pitx_imx8m/pitx_imx8m.c > @@ -43,10 +43,10 @@ struct efi_fw_image fw_images[] = { > > struct efi_capsule_update_info update_info = { > .dfu_string = "mmc 0=flash-bin raw 0x42 0x1000 mmcpart 1", > + .num_images = ARRAY_SIZE(fw_images),
[PATCH v6 1/8] efi_loader: add the number of image entries in efi_capsule_update_info
The number of image array entries global variable is required to support EFI capsule update. This information is exposed as a num_image_type_guids variable, but this information should be included in the efi_capsule_update_info structure. This commit adds the num_images member in the efi_capsule_update_info structure. All board files supporting EFI capsule update are updated. Signed-off-by: Masahisa Kojima --- Newly created in v6 arch/arm/mach-rockchip/board.c | 4 ++-- board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c| 2 +- board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c | 2 +- board/emulation/qemu-arm/qemu-arm.c| 2 +- board/kontron/pitx_imx8m/pitx_imx8m.c | 2 +- board/kontron/sl-mx8mm/sl-mx8mm.c | 2 +- board/kontron/sl28/sl28.c | 2 +- board/rockchip/evb_rk3399/evb-rk3399.c | 2 +- board/sandbox/sandbox.c| 2 +- board/socionext/developerbox/developerbox.c| 2 +- board/st/stm32mp1/stm32mp1.c | 2 +- board/xilinx/common/board.c| 2 +- include/efi_loader.h | 3 ++- lib/efi_loader/efi_firmware.c | 6 +++--- lib/fwu_updates/fwu.c | 2 +- 15 files changed, 19 insertions(+), 18 deletions(-) diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c index f1f70c81d0..8daa74b3eb 100644 --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -41,7 +41,7 @@ static bool updatable_image(struct disk_partition *info) uuid_str_to_bin(info->type_guid, image_type_guid.b, UUID_STR_FORMAT_GUID); - for (i = 0; i < num_image_type_guids; i++) { + for (i = 0; i < update_info.num_images; i++) { if (!guidcmp(_images[i].image_type_id, _type_guid)) { ret = true; break; @@ -59,7 +59,7 @@ static void set_image_index(struct disk_partition *info, int index) uuid_str_to_bin(info->type_guid, image_type_guid.b, UUID_STR_FORMAT_GUID); - for (i = 0; i < num_image_type_guids; i++) { + for (i = 0; i < update_info.num_images; i++) { if (!guidcmp(_images[i].image_type_id, _type_guid)) { fw_images[i].image_index = index; break; diff --git a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c index 466174679e..b79a2380aa 100644 --- a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c +++ b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c @@ -54,10 +54,10 @@ struct efi_fw_image fw_images[] = { struct efi_capsule_update_info update_info = { .dfu_string = "mmc 2=flash-bin raw 0 0x1B00 mmcpart 1", + .num_images = ARRAY_SIZE(fw_images), .images = fw_images, }; -u8 num_image_type_guids = ARRAY_SIZE(fw_images); #endif /* EFI_HAVE_CAPSULE_SUPPORT */ 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 b373e45df9..af070ec315 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 @@ -50,10 +50,10 @@ struct efi_fw_image fw_images[] = { struct efi_capsule_update_info update_info = { .dfu_string = "mmc 2=flash-bin raw 0x42 0x1D00 mmcpart 1", + .num_images = ARRAY_SIZE(fw_images), .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) diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c index 34ed3e8ae6..dfea0d92a3 100644 --- a/board/emulation/qemu-arm/qemu-arm.c +++ b/board/emulation/qemu-arm/qemu-arm.c @@ -47,10 +47,10 @@ struct efi_fw_image fw_images[] = { }; struct efi_capsule_update_info update_info = { + .num_images = ARRAY_SIZE(fw_images) .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[] = { diff --git a/board/kontron/pitx_imx8m/pitx_imx8m.c b/board/kontron/pitx_imx8m/pitx_imx8m.c index fcda86bc1b..4548e7c1df 100644 --- a/board/kontron/pitx_imx8m/pitx_imx8m.c +++ b/board/kontron/pitx_imx8m/pitx_imx8m.c @@ -43,10 +43,10 @@ struct efi_fw_image fw_images[] = { struct efi_capsule_update_info update_info = { .dfu_string = "mmc 0=flash-bin raw 0x42 0x1000 mmcpart 1", + .num_images = ARRAY_SIZE(fw_images), .images = fw_images, }; -u8 num_image_type_guids = ARRAY_SIZE(fw_images); #endif /* EFI_HAVE_CAPSULE_SUPPORT */ int board_early_init_f(void) diff --git a/board/kontron/sl-mx8mm/sl-mx8mm.c