]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/FirmwareVolume2.h
Detab
[mirror_edk2.git] / MdePkg / Include / Protocol / FirmwareVolume2.h
CommitLineData
d1f95000 1/** @file\r
2 The Firmware Volume Protocol provides file-level access to the firmware volume. \r
3 Each firmware volume driver must produce an instance of the \r
4 Firmware Volume Protocol if the firmware volume is to be visible to\r
5 the system during the DXE phase. The Firmware Volume Protocol also provides\r
6 mechanisms for determining and modifying some attributes of the firmware volume.\r
7\r
4ca9b6c4 8 Copyright (c) 2006 - 2008, Intel Corporation \r
d1f95000 9 All rights reserved. This program and the accompanying materials \r
10 are licensed and made available under the terms and conditions of the BSD License \r
11 which accompanies this distribution. The full text of the license may be found at \r
12 http://opensource.org/licenses/bsd-license.php \r
13\r
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
16\r
d1f95000 17 @par Revision Reference: PI\r
18 Version 1.00.\r
19\r
20**/\r
21\r
22#ifndef __FIRMWARE_VOLUME2_H__\r
23#define __FIRMWARE_VOLUME2_H__\r
24\r
25#define EFI_FIRMWARE_VOLUME2_PROTOCOL_GUID \\r
22142dbf 26 { 0x220e73b6, 0x6bdb, 0x4413, { 0x84, 0x5, 0xb9, 0x74, 0xb1, 0x8, 0x61, 0x9a } }\r
d1f95000 27\r
28typedef struct _EFI_FIRMWARE_VOLUME2_PROTOCOL EFI_FIRMWARE_VOLUME2_PROTOCOL;\r
29\r
30\r
99e8ed21 31///\r
32/// EFI_FV_ATTRIBUTES\r
33///\r
d1f95000 34typedef UINT64 EFI_FV_ATTRIBUTES;\r
35\r
36//\r
37// EFI_FV_ATTRIBUTES bit definitions\r
38//\r
39// EFI_FV_ATTRIBUTES bit semantics\r
40#define EFI_FV2_READ_DISABLE_CAP 0x0000000000000001ULL\r
41#define EFI_FV2_READ_ENABLE_CAP 0x0000000000000002ULL\r
42#define EFI_FV2_READ_STATUS 0x0000000000000004ULL\r
43#define EFI_FV2_WRITE_DISABLE_CAP 0x0000000000000008ULL\r
44#define EFI_FV2_WRITE_ENABLE_CAP 0x0000000000000010ULL\r
45#define EFI_FV2_WRITE_STATUS 0x0000000000000020ULL\r
46#define EFI_FV2_LOCK_CAP 0x0000000000000040ULL\r
47#define EFI_FV2_LOCK_STATUS 0x0000000000000080ULL\r
48#define EFI_FV2_WRITE_POLICY_RELIABLE 0x0000000000000100ULL\r
49#define EFI_FV2_READ_LOCK_CAP 0x0000000000001000ULL\r
50#define EFI_FV2_READ_LOCK_STATUS 0x0000000000002000ULL\r
51#define EFI_FV2_WRITE_LOCK_CAP 0x0000000000004000ULL\r
52#define EFI_FV2_WRITE_LOCK_STATUS 0x0000000000008000ULL\r
53#define EFI_FV2_ALIGNMENT 0x00000000001F0000ULL\r
54#define EFI_FV2_ALIGNMENT_1 0x0000000000000000ULL\r
55#define EFI_FV2_ALIGNMENT_2 0x0000000000010000ULL\r
56#define EFI_FV2_ALIGNMENT_4 0x0000000000020000ULL\r
57#define EFI_FV2_ALIGNMENT_8 0x0000000000030000ULL\r
58#define EFI_FV2_ALIGNMENT_16 0x0000000000040000ULL\r
59#define EFI_FV2_ALIGNMENT_32 0x0000000000050000ULL\r
60#define EFI_FV2_ALIGNMENT_64 0x0000000000060000ULL\r
61#define EFI_FV2_ALIGNMENT_128 0x0000000000070000ULL\r
62#define EFI_FV2_ALIGNMENT_256 0x0000000000080000ULL\r
63#define EFI_FV2_ALIGNMENT_512 0x0000000000090000ULL\r
64#define EFI_FV2_ALIGNMENT_1K 0x00000000000A0000ULL\r
65#define EFI_FV2_ALIGNMENT_2K 0x00000000000B0000ULL\r
66#define EFI_FV2_ALIGNMENT_4K 0x00000000000C0000ULL\r
67#define EFI_FV2_ALIGNMENT_8K 0x00000000000D0000ULL\r
68#define EFI_FV2_ALIGNMENT_16K 0x00000000000E0000ULL\r
69#define EFI_FV2_ALIGNMENT_32K 0x00000000000F0000ULL\r
70#define EFI_FV2_ALIGNMENT_64K 0x0000000000100000ULL\r
71#define EFI_FV2_ALIGNMENT_128K 0x0000000000110000ULL\r
72#define EFI_FV2_ALIGNMENT_256K 0x0000000000120000ULL\r
73#define EFI_FV2_ALIGNMENT_512K 0x0000000000130000ULL\r
74#define EFI_FV2_ALIGNMENT_1M 0x0000000000140000ULL\r
75#define EFI_FV2_ALIGNMENT_2M 0x0000000000150000ULL\r
76#define EFI_FV2_ALIGNMENT_4M 0x0000000000160000ULL\r
77#define EFI_FV2_ALIGNMENT_8M 0x0000000000170000ULL\r
78#define EFI_FV2_ALIGNMENT_16M 0x0000000000180000ULL\r
79#define EFI_FV2_ALIGNMENT_32M 0x0000000000190000ULL\r
80#define EFI_FV2_ALIGNMENT_64M 0x00000000001A0000ULL\r
81#define EFI_FV2_ALIGNMENT_128M 0x00000000001B0000ULL\r
82#define EFI_FV2_ALIGNMENT_256M 0x00000000001C0000ULL\r
83#define EFI_FV2_ALIGNMENT_512M 0x00000000001D0000ULL\r
84#define EFI_FV2_ALIGNMENT_1G 0x00000000001E0000ULL\r
85#define EFI_FV2_ALIGNMENT_2G 0x00000000001F0000ULL\r
86\r
87/**\r
eecd469b
LG
88 Returns the attributes and current settings of the firmware volume.\r
89\r
d1f95000 90 Because of constraints imposed by the underlying firmware\r
91 storage, an instance of the Firmware Volume Protocol may not\r
92 be to able to support all possible variations of this\r
93 architecture. These constraints and the current state of the\r
94 firmware volume are exposed to the caller using the\r
95 GetVolumeAttributes() function. GetVolumeAttributes() is\r
50615d1f 96 callable only from TPL_NOTIFY and below. Behavior of\r
97 GetVolumeAttributes() at any EFI_TPL above TPL_NOTIFY is\r
4ca9b6c4
LG
98 undefined.\r
99\r
100 @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance.\r
d1f95000 101 \r
102 @param FvAttributes Pointer to an EFI_FV_ATTRIBUTES in which\r
103 the attributes and current settings are\r
104 returned.\r
105\r
106\r
107 @retval EFI_SUCCESS The firmware volume attributes were\r
108 returned.\r
109\r
110**/\r
111typedef\r
112EFI_STATUS\r
8b13229b 113(EFIAPI * EFI_FV_GET_ATTRIBUTES)(\r
d1f95000 114 IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
115 OUT EFI_FV_ATTRIBUTES *FvAttributes\r
116);\r
117\r
118\r
119/**\r
eecd469b
LG
120 Modifies the current settings of the firmware volume according to the input parameter.\r
121 \r
d1f95000 122 The SetVolumeAttributes() function is used to set configurable\r
123 firmware volume attributes. Only EFI_FV_READ_STATUS,\r
124 EFI_FV_WRITE_STATUS, and EFI_FV_LOCK_STATUS may be modified, and\r
125 then only in accordance with the declared capabilities. All\r
126 other bits of FvAttributes are ignored on input. On successful\r
127 return, all bits of *FvAttributes are valid and it contains the\r
128 completed EFI_FV_ATTRIBUTES for the volume. To modify an\r
129 attribute, the corresponding status bit in the EFI_FV_ATTRIBUTES\r
130 is set to the desired value on input. The EFI_FV_LOCK_STATUS bit\r
131 does not affect the ability to read or write the firmware\r
132 volume. Rather, once the EFI_FV_LOCK_STATUS bit is set, it\r
133 prevents further modification to all the attribute bits.\r
50615d1f 134 SetVolumeAttributes() is callable only from TPL_NOTIFY and\r
d1f95000 135 below. Behavior of SetVolumeAttributes() at any EFI_TPL above\r
4ca9b6c4 136 TPL_NOTIFY is undefined.\r
d1f95000 137\r
4ca9b6c4 138 @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance.\r
d1f95000 139 \r
140 @param FvAttributes On input, FvAttributes is a pointer to\r
141 an EFI_FV_ATTRIBUTES containing the\r
142 desired firmware volume settings. On\r
143 successful return, it contains the new\r
144 settings of the firmware volume. On\r
145 unsuccessful return, FvAttributes is not\r
146 modified and the firmware volume\r
147 settings are not changed.\r
148 \r
4ca9b6c4
LG
149 @retval EFI_SUCCESS The requested firmware volume attributes\r
150 were set and the resulting\r
151 EFI_FV_ATTRIBUTES is returned in\r
152 FvAttributes.\r
d1f95000 153\r
154 @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_READ_STATUS\r
155 is set to 1 on input, but the\r
156 device does not support enabling\r
157 reads\r
158 (FvAttributes:EFI_FV_READ_ENABLE\r
159 is clear on return from\r
160 GetVolumeAttributes()). Actual\r
161 volume attributes are unchanged.\r
162\r
163 @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_READ_STATUS\r
164 is cleared to 0 on input, but\r
165 the device does not support\r
166 disabling reads\r
167 (FvAttributes:EFI_FV_READ_DISABL\r
168 is clear on return from\r
169 GetVolumeAttributes()). Actual\r
170 volume attributes are unchanged.\r
171\r
172 @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_WRITE_STATUS\r
173 is set to 1 on input, but the\r
174 device does not support enabling\r
175 writes\r
176 (FvAttributes:EFI_FV_WRITE_ENABL\r
177 is clear on return from\r
178 GetVolumeAttributes()). Actual\r
179 volume attributes are unchanged.\r
180\r
181 @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_WRITE_STATUS\r
182 is cleared to 0 on input, but\r
183 the device does not support\r
184 disabling writes\r
185 (FvAttributes:EFI_FV_WRITE_DISAB\r
186 is clear on return from\r
187 GetVolumeAttributes()). Actual\r
188 volume attributes are unchanged.\r
189\r
190 @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_LOCK_STATUS\r
191 is set on input, but the device\r
192 does not support locking\r
193 (FvAttributes:EFI_FV_LOCK_CAP is\r
194 clear on return from\r
195 GetVolumeAttributes()). Actual\r
196 volume attributes are unchanged.\r
197\r
198 @retval EFI_ACCESS_DENIED Device is locked and does not\r
199 allow attribute modification\r
200 (FvAttributes:EFI_FV_LOCK_STATUS\r
201 is set on return from\r
202 GetVolumeAttributes()). Actual\r
203 volume attributes are unchanged.\r
204\r
205**/\r
206typedef\r
207EFI_STATUS\r
8b13229b 208(EFIAPI * EFI_FV_SET_ATTRIBUTES)(\r
d1f95000 209 IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
210 IN OUT EFI_FV_ATTRIBUTES *FvAttributes\r
211);\r
212\r
213\r
214/**\r
eecd469b
LG
215 Retrieves a file and/or file information from the firmware volume.\r
216\r
d1f95000 217 ReadFile() is used to retrieve any file from a firmware volume\r
218 during the DXE phase. The actual binary encoding of the file in\r
219 the firmware volume media may be in any arbitrary format as long\r
eecd469b
LG
220 as it does the following: It is accessed using the Firmware\r
221 Volume Protocol. The image that is returned follows the image\r
d1f95000 222 format defined in Code Definitions: PI Firmware File Format.\r
223 If the input value of Buffer==NULL, it indicates the caller is\r
224 requesting only that the type, attributes, and size of the\r
225 file be returned and that there is no output buffer. In this\r
226 case, the following occurs:\r
227 - BufferSize is returned with the size that is required to\r
228 successfully complete the read.\r
229 - The output parameters FoundType and *FileAttributes are\r
230 returned with valid values.\r
231 - The returned value of *AuthenticationStatus is undefined.\r
232\r
233 If the input value of Buffer!=NULL, the output buffer is\r
234 specified by a double indirection of the Buffer parameter. The\r
235 input value of *Buffer is used to determine if the output\r
236 buffer is caller allocated or is dynamically allocated by\r
237 ReadFile(). If the input value of *Buffer!=NULL, it indicates\r
238 the output buffer is caller allocated. In this case, the input\r
239 value of *BufferSize indicates the size of the\r
240 caller-allocated output buffer. If the output buffer is not\r
241 large enough to contain the entire requested output, it is\r
242 filled up to the point that the output buffer is exhausted and\r
243 EFI_WARN_BUFFER_TOO_SMALL is returned, and then BufferSize is\r
244 returned with the size required to successfully complete the\r
245 read. All other output parameters are returned with valid\r
246 values. If the input value of *Buffer==NULL, it indicates the\r
247 output buffer is to be allocated by ReadFile(). In this case,\r
248 ReadFile() will allocate an appropriately sized buffer from\r
249 boot services pool memory, which will be returned in Buffer.\r
250 The size of the new buffer is returned in BufferSize and all\r
251 other output parameters are returned with valid values.\r
50615d1f 252 ReadFile() is callable only from TPL_NOTIFY and below.\r
253 Behavior of ReadFile() at any EFI_TPL above TPL_NOTIFY is\r
4ca9b6c4
LG
254 undefined.\r
255\r
256 @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance.\r
d1f95000 257 \r
4ca9b6c4
LG
258 @param NameGuid Pointer to an EFI_GUID, which is the file\r
259 name. All firmware file names are EFI_GUIDs.\r
260 A single firmware volume must not have two\r
261 valid files with the same file name\r
262 EFI_GUID.\r
d1f95000 263 \r
4ca9b6c4
LG
264 @param Buffer Pointer to a pointer to a buffer in which the\r
265 file contents are returned, not including the\r
266 file header.\r
267\r
268 @param BufferSize Pointer to a caller-allocated UINTN. It\r
269 indicates the size of the memory\r
270 represented by Buffer.\r
d1f95000 271 \r
4ca9b6c4 272 @param FoundType Pointer to a caller-allocated EFI_FV_FILETYPE.\r
d1f95000 273 \r
4ca9b6c4
LG
274 @param FileAttributes Pointer to a caller-allocated\r
275 EFI_FV_FILE_ATTRIBUTES.\r
d1f95000 276 \r
277 @param AuthenticationStatus Pointer to a caller-allocated\r
278 UINT32 in which the\r
279 authentication status is\r
280 returned.\r
281 \r
4ca9b6c4 282 @retval EFI_SUCCESS The call completed successfully.\r
d1f95000 283 \r
284 @retval EFI_WARN_BUFFER_TOO_SMALL The buffer is too small to\r
285 contain the requested\r
286 output. The buffer is\r
287 filled and the output is\r
288 truncated.\r
289\r
4ca9b6c4 290 @retval EFI_OUT_OF_RESOURCES An allocation failure occurred.\r
d1f95000 291\r
4ca9b6c4 292 @retval EFI_NOT_FOUND Name was not found in the firmware volume.\r
d1f95000 293\r
4ca9b6c4
LG
294 @retval EFI_DEVICE_ERROR A hardware error occurred when\r
295 attempting to access the firmware volume.\r
d1f95000 296\r
4ca9b6c4
LG
297 @retval EFI_ACCESS_DENIED The firmware volume is configured to\r
298 isallow reads.\r
d1f95000 299\r
300**/\r
301typedef\r
302EFI_STATUS\r
8b13229b 303(EFIAPI * EFI_FV_READ_FILE)(\r
d1f95000 304 IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
305 IN CONST EFI_GUID *NameGuid,\r
306 IN OUT VOID **Buffer,\r
307 IN OUT UINTN *BufferSize,\r
308 OUT EFI_FV_FILETYPE *FoundType,\r
309 OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes,\r
310 OUT UINT32 *AuthenticationStatus\r
311);\r
312\r
313\r
314\r
315/**\r
eecd469b
LG
316 Locates the requested section within a file and returns it in a buffer.\r
317\r
d1f95000 318 ReadSection() is used to retrieve a specific section from a file\r
319 within a firmware volume. The section returned is determined\r
320 using a depth-first, left-to-right search algorithm through all\r
eecd469b 321 sections found in the specified file. The output buffer is specified by a double indirection\r
d1f95000 322 of the Buffer parameter. The input value of Buffer is used to\r
323 determine if the output buffer is caller allocated or is\r
324 dynamically allocated by ReadSection(). If the input value of\r
325 Buffer!=NULL, it indicates that the output buffer is caller\r
326 allocated. In this case, the input value of *BufferSize\r
327 indicates the size of the caller-allocated output buffer. If\r
328 the output buffer is not large enough to contain the entire\r
329 requested output, it is filled up to the point that the output\r
330 buffer is exhausted and EFI_WARN_BUFFER_TOO_SMALL is returned,\r
331 and then BufferSize is returned with the size that is required\r
332 to successfully complete the read. All other\r
333 output parameters are returned with valid values. If the input\r
334 value of *Buffer==NULL, it indicates the output buffer is to\r
335 be allocated by ReadSection(). In this case, ReadSection()\r
336 will allocate an appropriately sized buffer from boot services\r
337 pool memory, which will be returned in *Buffer. The size of\r
338 the new buffer is returned in *BufferSize and all other output\r
339 parameters are returned with valid values. ReadSection() is\r
50615d1f 340 callable only from TPL_NOTIFY and below. Behavior of\r
341 ReadSection() at any EFI_TPL above TPL_NOTIFY is\r
4ca9b6c4
LG
342 undefined.\r
343\r
344 @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance.\r
345 \r
346 @param NameGuid Pointer to an EFI_GUID, which indicates the\r
347 file name from which the requested section\r
348 will be read.\r
349 \r
350 @param SectionType Indicates the section type to return.\r
351 SectionType in conjunction with\r
352 SectionInstance indicates which section to\r
353 return.\r
354 \r
355 @param SectionInstance Indicates which instance of sections\r
356 with a type of SectionType to return.\r
357 SectionType in conjunction with\r
358 SectionInstance indicates which\r
359 section to return. SectionInstance is\r
360 zero based.\r
361 \r
362 @param Buffer Pointer to a pointer to a buffer in which the\r
363 section contents are returned, not including\r
364 the section header.\r
365 \r
366 @param BufferSize Pointer to a caller-allocated UINTN. It\r
367 indicates the size of the memory\r
368 represented by Buffer.\r
d1f95000 369 \r
370 @param AuthenticationStatus Pointer to a caller-allocated\r
371 UINT32 in which the authentication\r
372 status is returned.\r
373 \r
374 \r
375 @retval EFI_SUCCESS The call completed successfully.\r
376 \r
377 @retval EFI_WARN_BUFFER_TOO_SMALL The caller-allocated\r
378 buffer is too small to\r
379 contain the requested\r
380 output. The buffer is\r
381 filled and the output is\r
382 truncated.\r
383 \r
384 @retval EFI_OUT_OF_RESOURCES An allocation failure occurred.\r
385 \r
386 @retval EFI_NOT_FOUND The requested file was not found in\r
387 the firmware volume. EFI_NOT_FOUND The\r
388 requested section was not found in the\r
389 specified file.\r
390 \r
391 @retval EFI_DEVICE_ERROR A hardware error occurred when\r
392 attempting to access the firmware\r
393 volume.\r
394 \r
395 @retval EFI_ACCESS_DENIED The firmware volume is configured to\r
396 disallow reads. EFI_PROTOCOL_ERROR\r
397 The requested section was not found,\r
398 but the file could not be fully\r
399 parsed because a required\r
400 GUIDED_SECTION_EXTRACTION_PROTOCOL\r
401 was not found. It is possible the\r
402 requested section exists within the\r
403 file and could be successfully\r
404 extracted once the required\r
405 GUIDED_SECTION_EXTRACTION_PROTOCOL\r
406 is published.\r
407\r
408**/\r
409typedef\r
410EFI_STATUS\r
8b13229b 411(EFIAPI * EFI_FV_READ_SECTION)(\r
d1f95000 412 IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
413 IN CONST EFI_GUID *NameGuid,\r
de339b9d 414 IN EFI_SECTION_TYPE SectionType,\r
415 IN UINTN SectionInstance,\r
d1f95000 416 IN OUT VOID **Buffer,\r
417 IN OUT UINTN *BufferSize,\r
418 OUT UINT32 *AuthenticationStatus\r
419);\r
420\r
421//\r
422// EFI_FV_WRITE_POLICY\r
423//\r
424typedef UINT32 EFI_FV_WRITE_POLICY;\r
425#define EFI_FV_UNRELIABLE_WRITE 0x00000000\r
426#define EFI_FV_RELIABLE_WRITE 0x00000001\r
427\r
428//\r
429// EFI_FV_WRITE_FILE_DATA\r
430//\r
431typedef struct {\r
74fec708
LG
432 ///\r
433 /// Pointer to a GUID, which is the file name to be written.\r
434 ///\r
d1f95000 435 EFI_GUID *NameGuid;\r
74fec708
LG
436 ///\r
437 /// Indicates the type of file to be written.\r
438 ///\r
d1f95000 439 EFI_FV_FILETYPE Type;\r
74fec708
LG
440 ///\r
441 /// Indicates the attributes for the file to be written.\r
442 ///\r
d1f95000 443 EFI_FV_FILE_ATTRIBUTES FileAttributes;\r
74fec708
LG
444 ///\r
445 /// Pointer to a buffer containing the file to be written.\r
446 ///\r
d1f95000 447 VOID *Buffer;\r
74fec708
LG
448 ///\r
449 /// Indicates the size of the file image contained in Buffer.\r
450 ///\r
d1f95000 451 UINT32 BufferSize;\r
452} EFI_FV_WRITE_FILE_DATA;\r
453\r
454/**\r
eecd469b
LG
455 Locates the requested section within a file and returns it in a buffer.\r
456\r
d1f95000 457 WriteFile() is used to write one or more files to a firmware\r
458 volume. Each file to be written is described by an\r
459 EFI_FV_WRITE_FILE_DATA structure. The caller must ensure that\r
460 any required alignment for all files listed in the FileData\r
461 array is compatible with the firmware volume. Firmware volume\r
462 capabilities can be determined using the GetVolumeAttributes()\r
463 call. Similarly, if the WritePolicy is set to\r
464 EFI_FV_RELIABLE_WRITE, the caller must check the firmware volume\r
465 capabilities to ensure EFI_FV_RELIABLE_WRITE is supported by the\r
466 firmware volume. EFI_FV_UNRELIABLE_WRITE must always be\r
467 supported. Writing a file with a size of zero\r
468 (FileData[n].BufferSize == 0) deletes the file from the firmware\r
469 volume if it exists. Deleting a file must be done one at a time.\r
470 Deleting a file as part of a multiple file write is not allowed.\r
471 Platform Initialization Specification VOLUME 3 Shared\r
472 Architectural Elements 84 August 21, 2006 Version 1.0\r
50615d1f 473 WriteFile() is callable only from TPL_NOTIFY and below.\r
474 Behavior of WriteFile() at any EFI_TPL above TPL_NOTIFY is\r
4ca9b6c4 475 undefined. \r
d1f95000 476\r
4ca9b6c4 477 @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance.\r
d1f95000 478\r
4ca9b6c4 479 @param NumberOfFiles Indicates the number of elements in the array pointed to by FileData\r
d1f95000 480\r
4ca9b6c4
LG
481 @param WritePolicy Indicates the level of reliability for the\r
482 write in the event of a power failure or\r
483 other system failure during the write\r
484 operation.\r
485 \r
486 @param FileData Pointer to an array of\r
487 EFI_FV_WRITE_FILE_DATA. Each element of\r
488 FileData[] represents a file to be written.\r
d1f95000 489\r
490\r
4ca9b6c4 491 @retval EFI_SUCCESS The write completed successfully.\r
d1f95000 492 \r
4ca9b6c4
LG
493 @retval EFI_OUT_OF_RESOURCES The firmware volume does not\r
494 have enough free space to\r
495 storefile(s).\r
d1f95000 496 \r
4ca9b6c4
LG
497 @retval EFI_DEVICE_ERROR A hardware error occurred when\r
498 attempting to access the firmware volume.\r
d1f95000 499 \r
4ca9b6c4
LG
500 @retval EFI_WRITE_PROTECTED The firmware volume is\r
501 configured to disallow writes.\r
d1f95000 502 \r
4ca9b6c4
LG
503 @retval EFI_NOT_FOUND A delete was requested, but the\r
504 requested file was not found in the\r
505 firmware volume.\r
d1f95000 506 \r
507 @retval EFI_INVALID_PARAMETER A delete was requested with a\r
508 multiple file write.\r
509 \r
510 @retval EFI_INVALID_PARAMETER An unsupported WritePolicy was\r
511 requested.\r
512\r
513 @retval EFI_INVALID_PARAMETER An unknown file type was\r
514 specified.\r
515\r
516 @retval EFI_INVALID_PARAMETER A file system specific error\r
517 has occurred.\r
518 \r
519**/\r
520typedef\r
521EFI_STATUS \r
8b13229b 522(EFIAPI * EFI_FV_WRITE_FILE)(\r
d1f95000 523 IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
4bad02f2 524 IN UINT32 NumberOfFiles,\r
525 IN EFI_FV_WRITE_POLICY WritePolicy,\r
526 IN EFI_FV_WRITE_FILE_DATA *FileData\r
d1f95000 527);\r
528\r
529\r
530/**\r
ee6c452c 531 Retrieves information about the next file in the firmware volume store \r
532 that matches the search criteria.\r
eecd469b 533\r
d1f95000 534 GetNextFile() is the interface that is used to search a firmware\r
535 volume for a particular file. It is called successively until\r
536 the desired file is located or the function returns\r
537 EFI_NOT_FOUND. To filter uninteresting files from the output,\r
538 the type of file to search for may be specified in FileType. For\r
539 example, if *FileType is EFI_FV_FILETYPE_DRIVER, only files of\r
540 this type will be returned in the output. If *FileType is\r
541 EFI_FV_FILETYPE_ALL, no filtering of file types is done. The Key\r
542 parameter is used to indicate a starting point of the search. If\r
543 the buffer *Key is completely initialized to zero, the search\r
544 re-initialized and starts at the beginning. Subsequent calls to\r
545 GetNextFile() must maintain the value of *Key returned by the\r
546 immediately previous call. The actual contents of *Key are\r
547 implementation specific and no semantic content is implied.\r
50615d1f 548 GetNextFile() is callable only from TPL_NOTIFY and below.\r
549 Behavior of GetNextFile() at any EFI_TPL above TPL_NOTIFY is\r
4ca9b6c4
LG
550 undefined. \r
551\r
552 @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance.\r
553\r
554 @param Key Pointer to a caller-allocated buffer that contains implementation-specific data that is\r
555 used to track where to begin the search for the next file. The size of the buffer must be\r
556 at least This->KeySize bytes long. To re-initialize the search and begin from the\r
557 beginning of the firmware volume, the entire buffer must be cleared to zero. Other\r
558 than clearing the buffer to initiate a new search, the caller must not modify the data in\r
559 the buffer between calls to GetNextFile().\r
d1f95000 560\r
561 @param FileType Pointer to a caller-allocated\r
562 EFI_FV_FILETYPE. The GetNextFile() API can\r
563 filter its search for files based on the\r
564 value of the FileType input. A *FileType\r
565 input of EFI_FV_FILETYPE_ALL causes\r
566 GetNextFile() to search for files of all\r
567 types. If a file is found, the file's type\r
568 is returned in FileType. *FileType is not\r
569 modified if no file is found.\r
570\r
571 @param NameGuid Pointer to a caller-allocated EFI_GUID. If a\r
572 matching file is found, the file's name is\r
573 returned in NameGuid. If no matching file is\r
574 found, *NameGuid is not modified.\r
575\r
576 @param Attributes Pointer to a caller-allocated\r
577 EFI_FV_FILE_ATTRIBUTES. If a matching file\r
578 is found, the file's attributes are returned\r
579 in Attributes. If no matching file is found,\r
580 Attributes is not modified. Type\r
581 EFI_FV_FILE_ATTRIBUTES is defined in\r
582 ReadFile().\r
583\r
4ca9b6c4
LG
584 @param Size Pointer to a caller-allocated UINTN. If a\r
585 matching file is found, the file's size is\r
586 returned in *Size. If no matching file is found,\r
587 Size is not modified.\r
d1f95000 588\r
4ca9b6c4
LG
589 @retval EFI_SUCCESS The output parameters are filled with data\r
590 obtained from the first matching file that\r
591 was found.\r
d1f95000 592\r
4ca9b6c4 593 @retval FI_NOT_FOUND No files of type FileType were found.\r
d1f95000 594\r
595\r
596 @retval EFI_DEVICE_ERROR A hardware error occurred when\r
597 attempting to access the firmware\r
598 volume.\r
599\r
600 @retval EFI_ACCESS_DENIED The firmware volume is configured to\r
601 disallow reads.\r
602\r
603 \r
604**/\r
605typedef\r
606EFI_STATUS\r
8b13229b 607(EFIAPI * EFI_FV_GET_NEXT_FILE)(\r
d1f95000 608 IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
609 IN OUT VOID *Key,\r
610 IN OUT EFI_FV_FILETYPE *FileType,\r
611 OUT EFI_GUID *NameGuid,\r
612 OUT EFI_FV_FILE_ATTRIBUTES *Attributes,\r
613 OUT UINTN *Size\r
614);\r
615\r
616/**\r
eecd469b
LG
617 Return information about a firmware volume.\r
618\r
d1f95000 619 The GetInfo() function returns information of type\r
620 InformationType for the requested firmware volume. If the volume\r
621 does not support the requested information type, then\r
622 EFI_UNSUPPORTED is returned. If the buffer is not large enough\r
623 to hold the requested structure, EFI_BUFFER_TOO_SMALL is\r
624 returned and the BufferSize is set to the size of buffer that is\r
625 required to make the request. The information types defined by\r
626 this specification are required information types that all file\r
627 systems must support.\r
628\r
4ca9b6c4
LG
629 @param This A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL\r
630 instance that is the file handle the requested\r
631 information is for.\r
d1f95000 632 \r
633 @param InformationType The type identifier for the\r
634 information being requested.\r
635 \r
4ca9b6c4
LG
636 @param BufferSize On input, the size of Buffer. On output,\r
637 the amount of data returned in Buffer. In\r
638 both cases, the size is measured in bytes.\r
d1f95000 639 \r
4ca9b6c4
LG
640 @param Buffer A pointer to the data buffer to return. The\r
641 buffer's type is indicated by InformationType.\r
d1f95000 642 \r
643 \r
4ca9b6c4 644 @retval EFI_SUCCESS The information was retrieved.\r
d1f95000 645 \r
4ca9b6c4 646 @retval EFI_UNSUPPORTED The InformationType is not known.\r
d1f95000 647 \r
4ca9b6c4 648 @retval EFI_NO_MEDIA The device has no medium.\r
d1f95000 649 \r
4ca9b6c4 650 @retval EFI_DEVICE_ERROR The device reported an error.\r
d1f95000 651 \r
652 @retval EFI_VOLUME_CORRUPTED The file system structures are\r
653 corrupted.\r
654 \r
655 @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to\r
656 read the current directory\r
657 entry. BufferSize has been\r
658 updated with the size needed to\r
659 complete the request.\r
660\r
661\r
662**/\r
663typedef\r
664EFI_STATUS\r
8b13229b 665(EFIAPI *EFI_FV_GET_INFO)(\r
d1f95000 666 IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
667 IN CONST EFI_GUID *InformationType,\r
668 IN OUT UINTN *BufferSize,\r
669 OUT VOID *Buffer\r
670);\r
671\r
672\r
673/**\r
eecd469b 674 Sets information about a firmware volume.\r
d1f95000 675\r
676 The SetInfo() function sets information of type InformationType\r
677 on the requested firmware volume.\r
678\r
679\r
4ca9b6c4
LG
680 @param This A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL\r
681 instance that is the file handle the information\r
682 is for.\r
d1f95000 683\r
684 @param InformationType The type identifier for the\r
685 information being set.\r
686\r
4ca9b6c4 687 @param BufferSize The size, in bytes, of Buffer.\r
d1f95000 688\r
4ca9b6c4
LG
689 @param Buffer A pointer to the data buffer to write. The\r
690 buffer's type is indicated by InformationType.\r
d1f95000 691\r
4ca9b6c4 692 @retval EFI_SUCCESS The information was set.\r
d1f95000 693\r
4ca9b6c4 694 @retval EFI_UNSUPPORTED The InformationType is not known.\r
d1f95000 695\r
4ca9b6c4 696 @retval EFI_NO_MEDIA The device has no medium.\r
d1f95000 697\r
4ca9b6c4 698 @retval EFI_DEVICE_ERROR The device reported an error.\r
d1f95000 699\r
700 @retval EFI_VOLUME_CORRUPTED The file system structures are\r
701 corrupted.\r
702\r
703\r
4ca9b6c4 704 @retval EFI_WRITE_PROTECTED The media is read only.\r
d1f95000 705\r
4ca9b6c4 706 @retval EFI_VOLUME_FULL The volume is full.\r
d1f95000 707\r
4ca9b6c4
LG
708 @retval EFI_BAD_BUFFER_SIZE BufferSize is smaller than the\r
709 size of the type indicated by\r
710 InformationType.\r
d1f95000 711\r
712**/\r
713typedef\r
714EFI_STATUS\r
8b13229b 715(EFIAPI *EFI_FV_SET_INFO)(\r
d1f95000 716 IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r
717 IN CONST EFI_GUID *InformationType,\r
718 IN UINTN BufferSize,\r
719 IN CONST VOID *Buffer\r
720);\r
721\r
722\r
44717a39 723///\r
724/// The Firmware Volume Protocol contains the file-level\r
725/// abstraction to the firmware volume as well as some firmware\r
726/// volume attribute reporting and configuration services. The\r
727/// Firmware Volume Protocol is the interface used by all parts of\r
728/// DXE that are not directly involved with managing the firmware\r
729/// volume itself. This abstraction allows many varied types of\r
730/// firmware volume implementations. A firmware volume may be a\r
731/// flash device or it may be a file in the UEFI system partition,\r
732/// for example. This level of firmware volume implementation\r
733/// detail is not visible to the consumers of the Firmware Volume\r
734/// Protocol.\r
735///\r
d1f95000 736struct _EFI_FIRMWARE_VOLUME2_PROTOCOL {\r
737 EFI_FV_GET_ATTRIBUTES GetVolumeAttributes;\r
738 EFI_FV_SET_ATTRIBUTES SetVolumeAttributes;\r
739 EFI_FV_READ_FILE ReadFile;\r
740 EFI_FV_READ_SECTION ReadSection;\r
741 EFI_FV_WRITE_FILE WriteFile;\r
742 EFI_FV_GET_NEXT_FILE GetNextFile;\r
a4e0b060 743 \r
744 ///\r
745 /// Data field that indicates the size in bytes\r
746 /// of the Key input buffer for the\r
747 /// GetNextFile() API. \r
748 ///\r
d1f95000 749 UINT32 KeySize;\r
a4e0b060 750 \r
751 ///\r
752 /// Handle of the parent firmware volume.\r
753 ///\r
d1f95000 754 EFI_HANDLE ParentHandle;\r
755 EFI_FV_GET_INFO GetInfo;\r
756 EFI_FV_SET_INFO SetInfo;\r
757};\r
758\r
759\r
760extern EFI_GUID gEfiFirmwareVolume2ProtocolGuid;\r
761\r
762#endif\r