@@ -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(&fw_images[i].image_type_id, &image_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(&fw_images[i].image_type_id, &image_type_guid)) {
fw_images[i].image_index = index;
break;
@@ -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 */
@@ -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)
@@ -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[] = {
@@ -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)
@@ -29,10 +29,10 @@ struct efi_fw_image fw_images[] = {
struct efi_capsule_update_info update_info = {
.dfu_string = "sf 0:0=flash-bin raw 0x400 0x1f0000",
+ .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)
@@ -40,10 +40,10 @@ struct efi_fw_image fw_images[] = {
struct efi_capsule_update_info update_info = {
.dfu_string = "sf 0:0=u-boot-bin raw 0x210000 0x1d0000;"
"u-boot-env raw 0x3e0000 0x20000",
+ .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)
@@ -18,10 +18,10 @@
static struct efi_fw_image fw_images[ROCKPI4_UPDATABLE_IMAGES] = {0};
struct efi_capsule_update_info update_info = {
+ .num_images = ROCKPI4_UPDATABLE_IMAGES,
.images = fw_images,
};
-u8 num_image_type_guids = ROCKPI4_UPDATABLE_IMAGES;
#endif
#ifndef CONFIG_SPL_BUILD
@@ -67,10 +67,10 @@ struct efi_fw_image fw_images[] = {
struct efi_capsule_update_info update_info = {
.dfu_string = "sf 0:0=u-boot-bin raw 0x100000 0x50000;"
"u-boot-env raw 0x150000 0x200000",
+ .num_images = ARRAY_SIZE(fw_images),
.images = fw_images,
};
-u8 num_image_type_guids = ARRAY_SIZE(fw_images);
#endif /* EFI_HAVE_CAPSULE_SUPPORT */
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
@@ -41,10 +41,10 @@ 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",
+ .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 sc2a11_mem_map[] = {
@@ -92,10 +92,10 @@
struct efi_fw_image fw_images[1];
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 */
int board_early_init_f(void)
@@ -52,10 +52,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 */
#define EEPROM_HEADER_MAGIC 0xdaaddeed
@@ -1078,15 +1078,16 @@ struct efi_fw_image {
* platforms which enable capsule updates
*
* @dfu_string: String used to populate dfu_alt_info
+ * @num_images: The number of images array entries
* @images: Pointer to an array of updatable images
*/
struct efi_capsule_update_info {
const char *dfu_string;
+ int num_images;
struct efi_fw_image *images;
};
extern struct efi_capsule_update_info update_info;
-extern u8 num_image_type_guids;
/**
* Install the ESRT system table.
@@ -131,7 +131,7 @@ static efi_status_t efi_fill_image_desc_array(
struct efi_fw_image *fw_array;
int i;
- total_size = sizeof(*image_info) * num_image_type_guids;
+ total_size = sizeof(*image_info) * update_info.num_images;
if (*image_info_size < total_size) {
*image_info_size = total_size;
@@ -141,13 +141,13 @@ static efi_status_t efi_fill_image_desc_array(
*image_info_size = total_size;
fw_array = update_info.images;
- *descriptor_count = num_image_type_guids;
+ *descriptor_count = update_info.num_images;
*descriptor_version = EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION;
*descriptor_size = sizeof(*image_info);
*package_version = 0xffffffff; /* not supported */
*package_version_name = NULL; /* not supported */
- for (i = 0; i < num_image_type_guids; i++) {
+ for (i = 0; i < update_info.num_images; i++) {
image_info[i].image_index = fw_array[i].image_index;
image_info[i].image_type_id = fw_array[i].image_type_id;
image_info[i].image_id = fw_array[i].image_index;
@@ -151,7 +151,7 @@ static int fwu_get_image_type_id(u8 *image_index, efi_guid_t *image_type_id)
index = *image_index;
image = update_info.images;
- for (i = 0; i < num_image_type_guids; i++) {
+ for (i = 0; i < update_info.num_images; i++) {
if (index == image[i].image_index) {
guidcpy(image_type_id, &image[i].image_type_id);
return 0;