Commit | Line | Data |
---|---|---|
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 |
28 | typedef 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 | 34 | typedef 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 | |
111 | typedef\r | |
112 | EFI_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 | |
206 | typedef\r | |
207 | EFI_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 | |
301 | typedef\r | |
302 | EFI_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 | |
409 | typedef\r | |
410 | EFI_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 | |
424 | typedef 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 | |
431 | typedef struct {\r | |
432 | EFI_GUID *NameGuid;\r | |
433 | EFI_FV_FILETYPE Type;\r | |
434 | EFI_FV_FILE_ATTRIBUTES FileAttributes;\r | |
435 | VOID *Buffer;\r | |
436 | UINT32 BufferSize;\r | |
437 | } EFI_FV_WRITE_FILE_DATA;\r | |
438 | \r | |
439 | /**\r | |
eecd469b LG |
440 | Locates the requested section within a file and returns it in a buffer.\r |
441 | \r | |
d1f95000 | 442 | WriteFile() is used to write one or more files to a firmware\r |
443 | volume. Each file to be written is described by an\r | |
444 | EFI_FV_WRITE_FILE_DATA structure. The caller must ensure that\r | |
445 | any required alignment for all files listed in the FileData\r | |
446 | array is compatible with the firmware volume. Firmware volume\r | |
447 | capabilities can be determined using the GetVolumeAttributes()\r | |
448 | call. Similarly, if the WritePolicy is set to\r | |
449 | EFI_FV_RELIABLE_WRITE, the caller must check the firmware volume\r | |
450 | capabilities to ensure EFI_FV_RELIABLE_WRITE is supported by the\r | |
451 | firmware volume. EFI_FV_UNRELIABLE_WRITE must always be\r | |
452 | supported. Writing a file with a size of zero\r | |
453 | (FileData[n].BufferSize == 0) deletes the file from the firmware\r | |
454 | volume if it exists. Deleting a file must be done one at a time.\r | |
455 | Deleting a file as part of a multiple file write is not allowed.\r | |
456 | Platform Initialization Specification VOLUME 3 Shared\r | |
457 | Architectural Elements 84 August 21, 2006 Version 1.0\r | |
50615d1f | 458 | WriteFile() is callable only from TPL_NOTIFY and below.\r |
459 | Behavior of WriteFile() at any EFI_TPL above TPL_NOTIFY is\r | |
4ca9b6c4 | 460 | undefined. \r |
d1f95000 | 461 | \r |
4ca9b6c4 | 462 | @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance.\r |
d1f95000 | 463 | \r |
4ca9b6c4 | 464 | @param NumberOfFiles Indicates the number of elements in the array pointed to by FileData\r |
d1f95000 | 465 | \r |
4ca9b6c4 LG |
466 | @param WritePolicy Indicates the level of reliability for the\r |
467 | write in the event of a power failure or\r | |
468 | other system failure during the write\r | |
469 | operation.\r | |
470 | \r | |
471 | @param FileData Pointer to an array of\r | |
472 | EFI_FV_WRITE_FILE_DATA. Each element of\r | |
473 | FileData[] represents a file to be written.\r | |
d1f95000 | 474 | \r |
475 | \r | |
4ca9b6c4 | 476 | @retval EFI_SUCCESS The write completed successfully.\r |
d1f95000 | 477 | \r |
4ca9b6c4 LG |
478 | @retval EFI_OUT_OF_RESOURCES The firmware volume does not\r |
479 | have enough free space to\r | |
480 | storefile(s).\r | |
d1f95000 | 481 | \r |
4ca9b6c4 LG |
482 | @retval EFI_DEVICE_ERROR A hardware error occurred when\r |
483 | attempting to access the firmware volume.\r | |
d1f95000 | 484 | \r |
4ca9b6c4 LG |
485 | @retval EFI_WRITE_PROTECTED The firmware volume is\r |
486 | configured to disallow writes.\r | |
d1f95000 | 487 | \r |
4ca9b6c4 LG |
488 | @retval EFI_NOT_FOUND A delete was requested, but the\r |
489 | requested file was not found in the\r | |
490 | firmware volume.\r | |
d1f95000 | 491 | \r |
492 | @retval EFI_INVALID_PARAMETER A delete was requested with a\r | |
493 | multiple file write.\r | |
494 | \r | |
495 | @retval EFI_INVALID_PARAMETER An unsupported WritePolicy was\r | |
496 | requested.\r | |
497 | \r | |
498 | @retval EFI_INVALID_PARAMETER An unknown file type was\r | |
499 | specified.\r | |
500 | \r | |
501 | @retval EFI_INVALID_PARAMETER A file system specific error\r | |
502 | has occurred.\r | |
503 | \r | |
504 | **/\r | |
505 | typedef\r | |
506 | EFI_STATUS \r | |
8b13229b | 507 | (EFIAPI * EFI_FV_WRITE_FILE)(\r |
d1f95000 | 508 | IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r |
4bad02f2 | 509 | IN UINT32 NumberOfFiles,\r |
510 | IN EFI_FV_WRITE_POLICY WritePolicy,\r | |
511 | IN EFI_FV_WRITE_FILE_DATA *FileData\r | |
d1f95000 | 512 | );\r |
513 | \r | |
514 | \r | |
515 | /**\r | |
eecd469b LG |
516 | Retrieves information about the next file in the firmware volume store \r |
517 | that matches the search criteria.\r | |
518 | \r | |
d1f95000 | 519 | GetNextFile() is the interface that is used to search a firmware\r |
520 | volume for a particular file. It is called successively until\r | |
521 | the desired file is located or the function returns\r | |
522 | EFI_NOT_FOUND. To filter uninteresting files from the output,\r | |
523 | the type of file to search for may be specified in FileType. For\r | |
524 | example, if *FileType is EFI_FV_FILETYPE_DRIVER, only files of\r | |
525 | this type will be returned in the output. If *FileType is\r | |
526 | EFI_FV_FILETYPE_ALL, no filtering of file types is done. The Key\r | |
527 | parameter is used to indicate a starting point of the search. If\r | |
528 | the buffer *Key is completely initialized to zero, the search\r | |
529 | re-initialized and starts at the beginning. Subsequent calls to\r | |
530 | GetNextFile() must maintain the value of *Key returned by the\r | |
531 | immediately previous call. The actual contents of *Key are\r | |
532 | implementation specific and no semantic content is implied.\r | |
50615d1f | 533 | GetNextFile() is callable only from TPL_NOTIFY and below.\r |
534 | Behavior of GetNextFile() at any EFI_TPL above TPL_NOTIFY is\r | |
4ca9b6c4 LG |
535 | undefined. \r |
536 | \r | |
537 | @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL instance.\r | |
538 | \r | |
539 | @param Key Pointer to a caller-allocated buffer that contains implementation-specific data that is\r | |
540 | used to track where to begin the search for the next file. The size of the buffer must be\r | |
541 | at least This->KeySize bytes long. To re-initialize the search and begin from the\r | |
542 | beginning of the firmware volume, the entire buffer must be cleared to zero. Other\r | |
543 | than clearing the buffer to initiate a new search, the caller must not modify the data in\r | |
544 | the buffer between calls to GetNextFile().\r | |
d1f95000 | 545 | \r |
546 | @param FileType Pointer to a caller-allocated\r | |
547 | EFI_FV_FILETYPE. The GetNextFile() API can\r | |
548 | filter its search for files based on the\r | |
549 | value of the FileType input. A *FileType\r | |
550 | input of EFI_FV_FILETYPE_ALL causes\r | |
551 | GetNextFile() to search for files of all\r | |
552 | types. If a file is found, the file's type\r | |
553 | is returned in FileType. *FileType is not\r | |
554 | modified if no file is found.\r | |
555 | \r | |
556 | @param NameGuid Pointer to a caller-allocated EFI_GUID. If a\r | |
557 | matching file is found, the file's name is\r | |
558 | returned in NameGuid. If no matching file is\r | |
559 | found, *NameGuid is not modified.\r | |
560 | \r | |
561 | @param Attributes Pointer to a caller-allocated\r | |
562 | EFI_FV_FILE_ATTRIBUTES. If a matching file\r | |
563 | is found, the file's attributes are returned\r | |
564 | in Attributes. If no matching file is found,\r | |
565 | Attributes is not modified. Type\r | |
566 | EFI_FV_FILE_ATTRIBUTES is defined in\r | |
567 | ReadFile().\r | |
568 | \r | |
4ca9b6c4 LG |
569 | @param Size Pointer to a caller-allocated UINTN. If a\r |
570 | matching file is found, the file's size is\r | |
571 | returned in *Size. If no matching file is found,\r | |
572 | Size is not modified.\r | |
d1f95000 | 573 | \r |
4ca9b6c4 LG |
574 | @retval EFI_SUCCESS The output parameters are filled with data\r |
575 | obtained from the first matching file that\r | |
576 | was found.\r | |
d1f95000 | 577 | \r |
4ca9b6c4 | 578 | @retval FI_NOT_FOUND No files of type FileType were found.\r |
d1f95000 | 579 | \r |
580 | \r | |
581 | @retval EFI_DEVICE_ERROR A hardware error occurred when\r | |
582 | attempting to access the firmware\r | |
583 | volume.\r | |
584 | \r | |
585 | @retval EFI_ACCESS_DENIED The firmware volume is configured to\r | |
586 | disallow reads.\r | |
587 | \r | |
588 | \r | |
589 | **/\r | |
590 | typedef\r | |
591 | EFI_STATUS\r | |
8b13229b | 592 | (EFIAPI * EFI_FV_GET_NEXT_FILE)(\r |
d1f95000 | 593 | IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r |
594 | IN OUT VOID *Key,\r | |
595 | IN OUT EFI_FV_FILETYPE *FileType,\r | |
596 | OUT EFI_GUID *NameGuid,\r | |
597 | OUT EFI_FV_FILE_ATTRIBUTES *Attributes,\r | |
598 | OUT UINTN *Size\r | |
599 | );\r | |
600 | \r | |
601 | /**\r | |
eecd469b LG |
602 | Return information about a firmware volume.\r |
603 | \r | |
d1f95000 | 604 | The GetInfo() function returns information of type\r |
605 | InformationType for the requested firmware volume. If the volume\r | |
606 | does not support the requested information type, then\r | |
607 | EFI_UNSUPPORTED is returned. If the buffer is not large enough\r | |
608 | to hold the requested structure, EFI_BUFFER_TOO_SMALL is\r | |
609 | returned and the BufferSize is set to the size of buffer that is\r | |
610 | required to make the request. The information types defined by\r | |
611 | this specification are required information types that all file\r | |
612 | systems must support.\r | |
613 | \r | |
4ca9b6c4 LG |
614 | @param This A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL\r |
615 | instance that is the file handle the requested\r | |
616 | information is for.\r | |
d1f95000 | 617 | \r |
618 | @param InformationType The type identifier for the\r | |
619 | information being requested.\r | |
620 | \r | |
4ca9b6c4 LG |
621 | @param BufferSize On input, the size of Buffer. On output,\r |
622 | the amount of data returned in Buffer. In\r | |
623 | both cases, the size is measured in bytes.\r | |
d1f95000 | 624 | \r |
4ca9b6c4 LG |
625 | @param Buffer A pointer to the data buffer to return. The\r |
626 | buffer's type is indicated by InformationType.\r | |
d1f95000 | 627 | \r |
628 | \r | |
4ca9b6c4 | 629 | @retval EFI_SUCCESS The information was retrieved.\r |
d1f95000 | 630 | \r |
4ca9b6c4 | 631 | @retval EFI_UNSUPPORTED The InformationType is not known.\r |
d1f95000 | 632 | \r |
4ca9b6c4 | 633 | @retval EFI_NO_MEDIA The device has no medium.\r |
d1f95000 | 634 | \r |
4ca9b6c4 | 635 | @retval EFI_DEVICE_ERROR The device reported an error.\r |
d1f95000 | 636 | \r |
637 | @retval EFI_VOLUME_CORRUPTED The file system structures are\r | |
638 | corrupted.\r | |
639 | \r | |
640 | @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to\r | |
641 | read the current directory\r | |
642 | entry. BufferSize has been\r | |
643 | updated with the size needed to\r | |
644 | complete the request.\r | |
645 | \r | |
646 | \r | |
647 | **/\r | |
648 | typedef\r | |
649 | EFI_STATUS\r | |
8b13229b | 650 | (EFIAPI *EFI_FV_GET_INFO)(\r |
d1f95000 | 651 | IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r |
652 | IN CONST EFI_GUID *InformationType,\r | |
653 | IN OUT UINTN *BufferSize,\r | |
654 | OUT VOID *Buffer\r | |
655 | );\r | |
656 | \r | |
657 | \r | |
658 | /**\r | |
eecd469b | 659 | Sets information about a firmware volume.\r |
d1f95000 | 660 | \r |
661 | The SetInfo() function sets information of type InformationType\r | |
662 | on the requested firmware volume.\r | |
663 | \r | |
664 | \r | |
4ca9b6c4 LG |
665 | @param This A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL\r |
666 | instance that is the file handle the information\r | |
667 | is for.\r | |
d1f95000 | 668 | \r |
669 | @param InformationType The type identifier for the\r | |
670 | information being set.\r | |
671 | \r | |
4ca9b6c4 | 672 | @param BufferSize The size, in bytes, of Buffer.\r |
d1f95000 | 673 | \r |
4ca9b6c4 LG |
674 | @param Buffer A pointer to the data buffer to write. The\r |
675 | buffer's type is indicated by InformationType.\r | |
d1f95000 | 676 | \r |
4ca9b6c4 | 677 | @retval EFI_SUCCESS The information was set.\r |
d1f95000 | 678 | \r |
4ca9b6c4 | 679 | @retval EFI_UNSUPPORTED The InformationType is not known.\r |
d1f95000 | 680 | \r |
4ca9b6c4 | 681 | @retval EFI_NO_MEDIA The device has no medium.\r |
d1f95000 | 682 | \r |
4ca9b6c4 | 683 | @retval EFI_DEVICE_ERROR The device reported an error.\r |
d1f95000 | 684 | \r |
685 | @retval EFI_VOLUME_CORRUPTED The file system structures are\r | |
686 | corrupted.\r | |
687 | \r | |
688 | \r | |
4ca9b6c4 | 689 | @retval EFI_WRITE_PROTECTED The media is read only.\r |
d1f95000 | 690 | \r |
4ca9b6c4 | 691 | @retval EFI_VOLUME_FULL The volume is full.\r |
d1f95000 | 692 | \r |
4ca9b6c4 LG |
693 | @retval EFI_BAD_BUFFER_SIZE BufferSize is smaller than the\r |
694 | size of the type indicated by\r | |
695 | InformationType.\r | |
d1f95000 | 696 | \r |
697 | **/\r | |
698 | typedef\r | |
699 | EFI_STATUS\r | |
8b13229b | 700 | (EFIAPI *EFI_FV_SET_INFO)(\r |
d1f95000 | 701 | IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This,\r |
702 | IN CONST EFI_GUID *InformationType,\r | |
703 | IN UINTN BufferSize,\r | |
704 | IN CONST VOID *Buffer\r | |
705 | );\r | |
706 | \r | |
707 | \r | |
44717a39 | 708 | ///\r |
709 | /// The Firmware Volume Protocol contains the file-level\r | |
710 | /// abstraction to the firmware volume as well as some firmware\r | |
711 | /// volume attribute reporting and configuration services. The\r | |
712 | /// Firmware Volume Protocol is the interface used by all parts of\r | |
713 | /// DXE that are not directly involved with managing the firmware\r | |
714 | /// volume itself. This abstraction allows many varied types of\r | |
715 | /// firmware volume implementations. A firmware volume may be a\r | |
716 | /// flash device or it may be a file in the UEFI system partition,\r | |
717 | /// for example. This level of firmware volume implementation\r | |
718 | /// detail is not visible to the consumers of the Firmware Volume\r | |
719 | /// Protocol.\r | |
720 | ///\r | |
d1f95000 | 721 | struct _EFI_FIRMWARE_VOLUME2_PROTOCOL {\r |
722 | EFI_FV_GET_ATTRIBUTES GetVolumeAttributes;\r | |
723 | EFI_FV_SET_ATTRIBUTES SetVolumeAttributes;\r | |
724 | EFI_FV_READ_FILE ReadFile;\r | |
725 | EFI_FV_READ_SECTION ReadSection;\r | |
726 | EFI_FV_WRITE_FILE WriteFile;\r | |
727 | EFI_FV_GET_NEXT_FILE GetNextFile;\r | |
a4e0b060 | 728 | \r |
729 | ///\r | |
730 | /// Data field that indicates the size in bytes\r | |
731 | /// of the Key input buffer for the\r | |
732 | /// GetNextFile() API. \r | |
733 | ///\r | |
d1f95000 | 734 | UINT32 KeySize;\r |
a4e0b060 | 735 | \r |
736 | ///\r | |
737 | /// Handle of the parent firmware volume.\r | |
738 | ///\r | |
d1f95000 | 739 | EFI_HANDLE ParentHandle;\r |
740 | EFI_FV_GET_INFO GetInfo;\r | |
741 | EFI_FV_SET_INFO SetInfo;\r | |
742 | };\r | |
743 | \r | |
744 | \r | |
745 | extern EFI_GUID gEfiFirmwareVolume2ProtocolGuid;\r | |
746 | \r | |
747 | #endif\r |