]>
Commit | Line | Data |
---|---|---|
2eaedc95 SG |
1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
2 | /* | |
3 | * Copyright (c) 2022, Linaro Limited | |
4 | */ | |
5 | ||
6 | #if !defined _FWU_MDATA_H_ | |
7 | #define _FWU_MDATA_H_ | |
8 | ||
2974e2cd | 9 | #include <linux/compiler_attributes.h> |
2eaedc95 SG |
10 | #include <efi.h> |
11 | ||
12 | /** | |
13 | * struct fwu_image_bank_info - firmware image information | |
48d93253 | 14 | * @image_guid: Guid value of the image in this bank |
2eaedc95 SG |
15 | * @accepted: Acceptance status of the image |
16 | * @reserved: Reserved | |
17 | * | |
18 | * The structure contains image specific fields which are | |
19 | * used to identify the image and to specify the image's | |
20 | * acceptance status | |
21 | */ | |
22 | struct fwu_image_bank_info { | |
48d93253 | 23 | efi_guid_t image_guid; |
2eaedc95 SG |
24 | uint32_t accepted; |
25 | uint32_t reserved; | |
2974e2cd | 26 | } __packed; |
2eaedc95 SG |
27 | |
28 | /** | |
29 | * struct fwu_image_entry - information for a particular type of image | |
48d93253 SG |
30 | * @image_type_guid: Guid value for identifying the image type |
31 | * @location_guid: Guid of the storage volume where the image is located | |
2eaedc95 SG |
32 | * @img_bank_info: Array containing properties of images |
33 | * | |
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. | |
37 | */ | |
38 | struct fwu_image_entry { | |
48d93253 SG |
39 | efi_guid_t image_type_guid; |
40 | efi_guid_t location_guid; | |
2eaedc95 | 41 | struct fwu_image_bank_info img_bank_info[CONFIG_FWU_NUM_BANKS]; |
2974e2cd | 42 | } __packed; |
2eaedc95 | 43 | |
48d93253 SG |
44 | /** |
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 | |
51 | * | |
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. | |
56 | */ | |
57 | struct fwu_fw_store_desc { | |
58 | uint8_t num_banks; | |
59 | uint8_t reserved; | |
60 | uint16_t num_images; | |
61 | uint16_t img_entry_size; | |
62 | uint16_t bank_info_entry_size; | |
63 | ||
64 | struct fwu_image_entry img_entry[CONFIG_FWU_NUM_IMAGES_PER_BANK]; | |
65 | } __packed; | |
66 | ||
67 | #if defined(CONFIG_FWU_MDATA_V1) | |
2eaedc95 SG |
68 | /** |
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 | |
76 | * be updated | |
77 | * | |
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 | |
81 | * individual images | |
82 | */ | |
83 | struct fwu_mdata { | |
84 | uint32_t crc32; | |
85 | uint32_t version; | |
86 | uint32_t active_index; | |
87 | uint32_t previous_active_index; | |
88 | ||
89 | struct fwu_image_entry img_entry[CONFIG_FWU_NUM_IMAGES_PER_BANK]; | |
2974e2cd | 90 | } __packed; |
2eaedc95 | 91 | |
48d93253 SG |
92 | #else /* CONFIG_FWU_MDATA_V1 */ |
93 | /** | |
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 | |
101 | * image descriptors | |
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 | |
106 | * | |
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. | |
110 | */ | |
111 | struct fwu_mdata { | |
112 | uint32_t crc32; | |
113 | uint32_t version; | |
114 | uint32_t active_index; | |
115 | uint32_t previous_active_index; | |
116 | uint32_t metadata_size; | |
117 | uint16_t desc_offset; | |
118 | uint16_t reserved1; | |
119 | uint8_t bank_state[4]; | |
120 | uint32_t reserved2; | |
121 | ||
122 | // struct fwu_fw_store_desc fw_desc; | |
123 | } __packed; | |
124 | ||
125 | #endif /* CONFIG_FWU_MDATA_V1 */ | |
126 | ||
2eaedc95 | 127 | #endif /* _FWU_MDATA_H_ */ |