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