1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (c) 2022, Linaro Limited
6 #if !defined _FWU_MDATA_H_
9 #include <linux/compiler_attributes.h>
13 * struct fwu_image_bank_info - firmware image information
14 * @image_guid: Guid value of the image in this bank
15 * @accepted: Acceptance status of the image
18 * The structure contains image specific fields which are
19 * used to identify the image and to specify the image's
22 struct fwu_image_bank_info {
23 efi_guid_t image_guid;
29 * struct fwu_image_entry - information for a particular type of image
30 * @image_type_guid: Guid value for identifying the image type
31 * @location_guid: Guid of the storage volume where the image is located
32 * @img_bank_info: Array containing properties of images
34 * This structure contains information on various types of updatable
35 * firmware images. Each image type then contains an array of image
36 * information per bank.
38 struct fwu_image_entry {
39 efi_guid_t image_type_guid;
40 efi_guid_t location_guid;
41 struct fwu_image_bank_info img_bank_info[CONFIG_FWU_NUM_BANKS];
45 * struct fwu_fw_store_desc - FWU updatable image information
46 * @num_banks: Number of firmware banks
47 * @num_images: Number of images per bank
48 * @img_entry_size: The size of the img_entry array
49 * @bank_info_entry_size: The size of the img_bank_info array
50 * @img_entry: Array of image entries each giving information on a image
52 * This image descriptor structure contains information on the number of
53 * updatable banks and images per bank. It also gives the total sizes of
54 * the fwu_image_entry and fwu_image_bank_info arrays. This structure is
55 * only present in version 2 of the metadata structure.
57 struct fwu_fw_store_desc {
61 uint16_t img_entry_size;
62 uint16_t bank_info_entry_size;
64 struct fwu_image_entry img_entry[CONFIG_FWU_NUM_IMAGES_PER_BANK];
67 #if defined(CONFIG_FWU_MDATA_V1)
69 * struct fwu_mdata - FWU metadata structure for multi-bank updates
70 * @crc32: crc32 value for the FWU metadata
71 * @version: FWU metadata version
72 * @active_index: Index of the bank currently used for booting images
73 * @previous_active_inde: Index of the bank used before the current bank
74 * being used for booting
75 * @img_entry: Array of information on various firmware images that can
78 * This structure is used to store all the needed information for performing
79 * multi bank updates on the platform. This contains info on the bank being
80 * used to boot along with the information needed for identification of
86 uint32_t active_index;
87 uint32_t previous_active_index;
89 struct fwu_image_entry img_entry[CONFIG_FWU_NUM_IMAGES_PER_BANK];
92 #else /* CONFIG_FWU_MDATA_V1 */
94 * struct fwu_mdata - FWU metadata structure for multi-bank updates
95 * @crc32: crc32 value for the FWU metadata
96 * @version: FWU metadata version
97 * @active_index: Index of the bank currently used for booting images
98 * @previous_active_inde: Index of the bank used before the current bank
99 * being used for booting
100 * @metadata_size: Size of the entire metadata structure, including the
102 * @desc_offset: The offset from the start of this structure where the
103 * image descriptor structure starts. 0 if absent
104 * @bank_state: State of each bank, valid, invalid or accepted
105 * @fw_desc: The structure describing the FWU updatable images
107 * This is the top level structure used to store all information for performing
108 * multi bank updates on the platform. This contains info on the bank being
109 * used to boot along with the information on state of individual banks.
114 uint32_t active_index;
115 uint32_t previous_active_index;
116 uint32_t metadata_size;
117 uint16_t desc_offset;
119 uint8_t bank_state[4];
122 // struct fwu_fw_store_desc fw_desc;
125 #endif /* CONFIG_FWU_MDATA_V1 */
127 #endif /* _FWU_MDATA_H_ */