]>
Commit | Line | Data |
---|---|---|
b522c77b HW |
1 | /** @file\r |
2 | This file declares the Firmware Volume Protocol.\r | |
3 | \r | |
4 | The Firmware Volume Protocol provides file-level access to the firmware volume.\r | |
5 | Each firmware volume driver must produce an instance of the Firmware Volume\r | |
6 | Protocol if the firmware volume is to be visible to the system. The Firmware\r | |
7 | Volume Protocol also provides mechanisms for determining and modifying some\r | |
8 | attributes of the firmware volume.\r | |
9 | \r | |
10 | Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
11 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
12 | \r | |
13 | @par Revision Reference:\r | |
14 | This protocol is defined in Firmware Volume specification.\r | |
15 | Version 0.9.\r | |
16 | \r | |
17 | **/\r | |
18 | \r | |
19 | #ifndef _FIRMWARE_VOLUME_H_\r | |
20 | #define _FIRMWARE_VOLUME_H_\r | |
21 | \r | |
b522c77b HW |
22 | //\r |
23 | // Firmware Volume Protocol GUID definition\r | |
24 | //\r | |
25 | #define EFI_FIRMWARE_VOLUME_PROTOCOL_GUID \\r | |
26 | { \\r | |
27 | 0x389F751F, 0x1838, 0x4388, {0x83, 0x90, 0xCD, 0x81, 0x54, 0xBD, 0x27, 0xF8 } \\r | |
28 | }\r | |
29 | \r | |
ac0a286f | 30 | #define FV_DEVICE_SIGNATURE SIGNATURE_32 ('_', 'F', 'V', '_')\r |
b522c77b | 31 | \r |
ac0a286f | 32 | typedef struct _EFI_FIRMWARE_VOLUME_PROTOCOL EFI_FIRMWARE_VOLUME_PROTOCOL;\r |
b522c77b HW |
33 | \r |
34 | //\r | |
35 | // FRAMEWORK_EFI_FV_ATTRIBUTES bit definitions\r | |
36 | //\r | |
ac0a286f | 37 | typedef UINT64 FRAMEWORK_EFI_FV_ATTRIBUTES;\r |
b522c77b HW |
38 | \r |
39 | //\r | |
40 | // ************************************************************\r | |
41 | // FRAMEWORK_EFI_FV_ATTRIBUTES bit definitions\r | |
42 | // ************************************************************\r | |
43 | //\r | |
ac0a286f MK |
44 | #define EFI_FV_READ_DISABLE_CAP 0x0000000000000001ULL\r |
45 | #define EFI_FV_READ_ENABLE_CAP 0x0000000000000002ULL\r | |
46 | #define EFI_FV_READ_STATUS 0x0000000000000004ULL\r | |
b522c77b | 47 | \r |
ac0a286f MK |
48 | #define EFI_FV_WRITE_DISABLE_CAP 0x0000000000000008ULL\r |
49 | #define EFI_FV_WRITE_ENABLE_CAP 0x0000000000000010ULL\r | |
50 | #define EFI_FV_WRITE_STATUS 0x0000000000000020ULL\r | |
b522c77b HW |
51 | \r |
52 | #define EFI_FV_LOCK_CAP 0x0000000000000040ULL\r | |
53 | #define EFI_FV_LOCK_STATUS 0x0000000000000080ULL\r | |
54 | #define EFI_FV_WRITE_POLICY_RELIABLE 0x0000000000000100ULL\r | |
55 | \r | |
ac0a286f MK |
56 | #define EFI_FV_ALIGNMENT_CAP 0x0000000000008000ULL\r |
57 | #define EFI_FV_ALIGNMENT_2 0x0000000000010000ULL\r | |
58 | #define EFI_FV_ALIGNMENT_4 0x0000000000020000ULL\r | |
59 | #define EFI_FV_ALIGNMENT_8 0x0000000000040000ULL\r | |
60 | #define EFI_FV_ALIGNMENT_16 0x0000000000080000ULL\r | |
61 | #define EFI_FV_ALIGNMENT_32 0x0000000000100000ULL\r | |
62 | #define EFI_FV_ALIGNMENT_64 0x0000000000200000ULL\r | |
63 | #define EFI_FV_ALIGNMENT_128 0x0000000000400000ULL\r | |
64 | #define EFI_FV_ALIGNMENT_256 0x0000000000800000ULL\r | |
65 | #define EFI_FV_ALIGNMENT_512 0x0000000001000000ULL\r | |
66 | #define EFI_FV_ALIGNMENT_1K 0x0000000002000000ULL\r | |
67 | #define EFI_FV_ALIGNMENT_2K 0x0000000004000000ULL\r | |
68 | #define EFI_FV_ALIGNMENT_4K 0x0000000008000000ULL\r | |
69 | #define EFI_FV_ALIGNMENT_8K 0x0000000010000000ULL\r | |
70 | #define EFI_FV_ALIGNMENT_16K 0x0000000020000000ULL\r | |
71 | #define EFI_FV_ALIGNMENT_32K 0x0000000040000000ULL\r | |
72 | #define EFI_FV_ALIGNMENT_64K 0x0000000080000000ULL\r | |
b522c77b HW |
73 | \r |
74 | //\r | |
75 | // Protocol API definitions\r | |
76 | //\r | |
77 | \r | |
78 | /**\r | |
79 | Retrieves attributes, insures positive polarity of attribute bits, and returns\r | |
80 | resulting attributes in an output parameter.\r | |
81 | \r | |
82 | @param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.\r | |
83 | @param Attributes Output buffer containing attributes.\r | |
84 | \r | |
85 | @retval EFI_SUCCESS The firmware volume attributes were returned.\r | |
86 | **/\r | |
87 | typedef\r | |
88 | EFI_STATUS\r | |
89 | (EFIAPI *FRAMEWORK_EFI_FV_GET_ATTRIBUTES)(\r | |
90 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r | |
91 | OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes\r | |
92 | );\r | |
93 | \r | |
94 | /**\r | |
95 | Sets volume attributes\r | |
96 | \r | |
97 | @param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.\r | |
98 | @param Attributes On input, Attributes is a pointer to an\r | |
99 | EFI_FV_ATTRIBUTES containing the desired firmware\r | |
100 | volume settings. On successful return, it contains\r | |
101 | the new settings of the firmware volume. On\r | |
102 | unsuccessful return, Attributes is not modified\r | |
103 | and the firmware volume settings are not changed.\r | |
104 | \r | |
105 | @retval EFI_INVALID_PARAMETER A bit in Attributes was invalid.\r | |
106 | @retval EFI_SUCCESS The requested firmware volume attributes were set\r | |
107 | and the resulting EFI_FV_ATTRIBUTES is returned in\r | |
108 | Attributes.\r | |
109 | @retval EFI_ACCESS_DENIED The Device is locked and does not permit modification.\r | |
110 | \r | |
111 | **/\r | |
112 | typedef\r | |
113 | EFI_STATUS\r | |
114 | (EFIAPI *FRAMEWORK_EFI_FV_SET_ATTRIBUTES)(\r | |
115 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r | |
116 | IN OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes\r | |
117 | );\r | |
118 | \r | |
119 | /**\r | |
120 | Read the requested file (NameGuid) or file information from the firmware volume\r | |
121 | and returns data in Buffer.\r | |
122 | \r | |
123 | @param This The EFI_FIRMWARE_VOLUME_PROTOCOL instance.\r | |
124 | @param NameGuid The pointer to EFI_GUID, which is the filename of\r | |
125 | the file to read.\r | |
126 | @param Buffer The pointer to pointer to buffer in which contents of file are returned.\r | |
127 | <br>\r | |
128 | If Buffer is NULL, only type, attributes, and size\r | |
129 | are returned as there is no output buffer.\r | |
130 | <br>\r | |
131 | If Buffer != NULL and *Buffer == NULL, the output\r | |
132 | buffer is allocated from BS pool by ReadFile.\r | |
133 | <br>\r | |
134 | If Buffer != NULL and *Buffer != NULL, the output\r | |
135 | buffer has been allocated by the caller and is being\r | |
136 | passed in.\r | |
137 | @param BufferSize On input: The buffer size. On output: The size\r | |
138 | required to complete the read.\r | |
139 | @param FoundType The pointer to the type of the file whose data\r | |
140 | is returned.\r | |
141 | @param FileAttributes The pointer to attributes of the file whose data\r | |
142 | is returned.\r | |
143 | @param AuthenticationStatus The pointer to the authentication status of the data.\r | |
144 | \r | |
145 | @retval EFI_SUCCESS The call completed successfully.\r | |
146 | @retval EFI_WARN_BUFFER_TOO_SMALL The buffer is too small to contain the requested output.\r | |
147 | The buffer filled, and the output is truncated.\r | |
148 | @retval EFI_NOT_FOUND NameGuid was not found in the firmware volume.\r | |
149 | @retval EFI_DEVICE_ERROR A hardware error occurred when attempting to\r | |
150 | access the firmware volume.\r | |
151 | @retval EFI_ACCESS_DENIED The firmware volume is configured to disallow reads.\r | |
152 | @retval EFI_OUT_OF_RESOURCES An allocation failure occurred.\r | |
153 | \r | |
154 | **/\r | |
155 | typedef\r | |
156 | EFI_STATUS\r | |
157 | (EFIAPI *FRAMEWORK_EFI_FV_READ_FILE)(\r | |
158 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r | |
159 | IN EFI_GUID *NameGuid,\r | |
160 | IN OUT VOID **Buffer,\r | |
161 | IN OUT UINTN *BufferSize,\r | |
162 | OUT EFI_FV_FILETYPE *FoundType,\r | |
163 | OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes,\r | |
164 | OUT UINT32 *AuthenticationStatus\r | |
165 | );\r | |
166 | \r | |
167 | /**\r | |
168 | Read the requested section from the specified file and returns data in Buffer.\r | |
169 | \r | |
170 | @param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.\r | |
171 | @param NameGuid Filename identifying the file from which to read.\r | |
172 | @param SectionType The section type to retrieve.\r | |
173 | @param SectionInstance The instance of SectionType to retrieve.\r | |
174 | @param Buffer Pointer to pointer to buffer in which contents of\r | |
175 | a file are returned.\r | |
176 | <br>\r | |
177 | If Buffer is NULL, only type, attributes, and size\r | |
178 | are returned as there is no output buffer.\r | |
179 | <br>\r | |
180 | If Buffer != NULL and *Buffer == NULL, the output\r | |
181 | buffer is allocated from BS pool by ReadFile.\r | |
182 | <br>\r | |
183 | If Buffer != NULL and *Buffer != NULL, the output\r | |
184 | buffer has been allocated by the caller and is being\r | |
185 | passed in.\r | |
186 | @param BufferSize The pointer to the buffer size passed in, and on\r | |
187 | output the size required to complete the read.\r | |
188 | @param AuthenticationStatus The pointer to the authentication status of the data.\r | |
189 | \r | |
190 | @retval EFI_SUCCESS The call completed successfully.\r | |
191 | @retval EFI_WARN_BUFFER_TOO_SMALL The buffer is too small to contain the requested output.\r | |
192 | The buffer is filled and the output is truncated.\r | |
193 | @retval EFI_OUT_OF_RESOURCES An allocation failure occurred.\r | |
194 | @retval EFI_NOT_FOUND The name was not found in the firmware volume.\r | |
195 | @retval EFI_DEVICE_ERROR A hardware error occurred when attempting to\r | |
196 | access the firmware volume.\r | |
197 | @retval EFI_ACCESS_DENIED The firmware volume is configured to disallow reads.\r | |
198 | \r | |
199 | **/\r | |
200 | typedef\r | |
201 | EFI_STATUS\r | |
202 | (EFIAPI *FRAMEWORK_EFI_FV_READ_SECTION)(\r | |
203 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r | |
204 | IN EFI_GUID *NameGuid,\r | |
205 | IN EFI_SECTION_TYPE SectionType,\r | |
206 | IN UINTN SectionInstance,\r | |
207 | IN OUT VOID **Buffer,\r | |
208 | IN OUT UINTN *BufferSize,\r | |
209 | OUT UINT32 *AuthenticationStatus\r | |
210 | );\r | |
211 | \r | |
ac0a286f | 212 | typedef UINT32 FRAMEWORK_EFI_FV_WRITE_POLICY;\r |
b522c77b | 213 | \r |
ac0a286f MK |
214 | #define FRAMEWORK_EFI_FV_UNRELIABLE_WRITE 0x00000000\r |
215 | #define FRAMEWORK_EFI_FV_RELIABLE_WRITE 0x00000001\r | |
b522c77b HW |
216 | \r |
217 | typedef struct {\r | |
ac0a286f MK |
218 | EFI_GUID *NameGuid;\r |
219 | EFI_FV_FILETYPE Type;\r | |
220 | EFI_FV_FILE_ATTRIBUTES FileAttributes;\r | |
221 | VOID *Buffer;\r | |
222 | UINT32 BufferSize;\r | |
b522c77b HW |
223 | } FRAMEWORK_EFI_FV_WRITE_FILE_DATA;\r |
224 | \r | |
225 | /**\r | |
226 | Write the supplied file (NameGuid) to the FV.\r | |
227 | \r | |
228 | @param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.\r | |
229 | @param NumberOfFiles Indicates the number of file records pointed to\r | |
230 | by FileData.\r | |
231 | @param WritePolicy Indicates the level of reliability of the write\r | |
232 | with respect to things like power failure events.\r | |
233 | @param FileData A pointer to an array of EFI_FV_WRITE_FILE_DATA\r | |
234 | structures. Each element in the array indicates\r | |
235 | a file to write, and there are NumberOfFiles\r | |
236 | elements in the input array.\r | |
237 | \r | |
238 | @retval EFI_SUCCESS The write completed successfully.\r | |
239 | @retval EFI_OUT_OF_RESOURCES The firmware volume does not have enough free\r | |
240 | space to store file(s).\r | |
241 | @retval EFI_DEVICE_ERROR A hardware error occurred when attempting to\r | |
242 | access the firmware volume.\r | |
243 | @retval EFI_WRITE_PROTECTED The firmware volume is configured to disallow writes.\r | |
244 | @retval EFI_NOT_FOUND A delete was requested, but the requested file was\r | |
245 | not found in the firmware volume.\r | |
246 | @retval EFI_INVALID_PARAMETER A delete was requested with a multiple file write.\r | |
247 | An unsupported WritePolicy was requested.\r | |
248 | An unknown file type was specified.\r | |
249 | A file system specific error has occurred.\r | |
250 | **/\r | |
251 | typedef\r | |
252 | EFI_STATUS\r | |
253 | (EFIAPI *FRAMEWORK_EFI_FV_WRITE_FILE)(\r | |
254 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r | |
255 | IN UINT32 NumberOfFiles,\r | |
256 | IN FRAMEWORK_EFI_FV_WRITE_POLICY WritePolicy,\r | |
257 | IN FRAMEWORK_EFI_FV_WRITE_FILE_DATA *FileData\r | |
258 | );\r | |
259 | \r | |
260 | /**\r | |
261 | Given the input key, search for the next matching file in the volume.\r | |
262 | \r | |
263 | @param This Indicates the EFI_FIRMWARE_VOLUME_PROTOCOL instance.\r | |
264 | @param Key Pointer to a caller allocated buffer that contains\r | |
265 | an implementation-specific key that is used to track\r | |
266 | where to begin searching on successive calls.\r | |
267 | @param FileType The pointer to the file type to filter for.\r | |
268 | @param NameGuid The pointer to Guid filename of the file found.\r | |
269 | @param Attributes The pointer to Attributes of the file found.\r | |
270 | @param Size The pointer to Size in bytes of the file found.\r | |
271 | \r | |
272 | @retval EFI_SUCCESS The output parameters are filled with data obtained from\r | |
273 | the first matching file that was found.\r | |
274 | @retval EFI_NOT_FOUND No files of type FileType were found.\r | |
275 | @retval EFI_DEVICE_ERROR A hardware error occurred when attempting to access\r | |
276 | the firmware volume.\r | |
277 | @retval EFI_ACCESS_DENIED The firmware volume is configured to disallow reads.\r | |
278 | \r | |
279 | **/\r | |
280 | typedef\r | |
281 | EFI_STATUS\r | |
282 | (EFIAPI *FRAMEWORK_EFI_FV_GET_NEXT_FILE)(\r | |
283 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r | |
284 | IN OUT VOID *Key,\r | |
285 | IN OUT EFI_FV_FILETYPE *FileType,\r | |
286 | OUT EFI_GUID *NameGuid,\r | |
287 | OUT EFI_FV_FILE_ATTRIBUTES *Attributes,\r | |
288 | OUT UINTN *Size\r | |
289 | );\r | |
290 | \r | |
291 | //\r | |
292 | // Protocol interface structure\r | |
293 | //\r | |
294 | struct _EFI_FIRMWARE_VOLUME_PROTOCOL {\r | |
295 | ///\r | |
296 | /// Retrieves volume capabilities and current settings.\r | |
297 | ///\r | |
ac0a286f | 298 | FRAMEWORK_EFI_FV_GET_ATTRIBUTES GetVolumeAttributes;\r |
b522c77b HW |
299 | \r |
300 | ///\r | |
301 | /// Modifies the current settings of the firmware volume.\r | |
302 | ///\r | |
ac0a286f | 303 | FRAMEWORK_EFI_FV_SET_ATTRIBUTES SetVolumeAttributes;\r |
b522c77b HW |
304 | \r |
305 | ///\r | |
306 | /// Reads an entire file from the firmware volume.\r | |
307 | ///\r | |
ac0a286f | 308 | FRAMEWORK_EFI_FV_READ_FILE ReadFile;\r |
b522c77b HW |
309 | \r |
310 | ///\r | |
311 | /// Reads a single section from a file into a buffer.\r | |
312 | ///\r | |
ac0a286f | 313 | FRAMEWORK_EFI_FV_READ_SECTION ReadSection;\r |
b522c77b HW |
314 | \r |
315 | ///\r | |
316 | /// Writes an entire file into the firmware volume.\r | |
317 | ///\r | |
ac0a286f | 318 | FRAMEWORK_EFI_FV_WRITE_FILE WriteFile;\r |
b522c77b HW |
319 | \r |
320 | ///\r | |
321 | /// Provides service to allow searching the firmware volume.\r | |
322 | ///\r | |
ac0a286f | 323 | FRAMEWORK_EFI_FV_GET_NEXT_FILE GetNextFile;\r |
b522c77b HW |
324 | \r |
325 | ///\r | |
326 | /// Data field that indicates the size in bytes of the Key input buffer for\r | |
327 | /// the GetNextFile() API.\r | |
328 | ///\r | |
ac0a286f | 329 | UINT32 KeySize;\r |
b522c77b HW |
330 | \r |
331 | ///\r | |
332 | /// Handle of the parent firmware volume.\r | |
333 | ///\r | |
ac0a286f | 334 | EFI_HANDLE ParentHandle;\r |
b522c77b HW |
335 | };\r |
336 | \r | |
ac0a286f | 337 | extern EFI_GUID gEfiFirmwareVolumeProtocolGuid;\r |
b522c77b HW |
338 | \r |
339 | #endif\r |