]>
Commit | Line | Data |
---|---|---|
4259256b | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2006 - 2008 Intel Corporation. <BR>\r | |
4 | All rights reserved. This program and the accompanying materials\r | |
5 | are licensed and made available under the terms and conditions of the BSD License\r | |
6 | which accompanies this distribution. The full text of the license may be found at\r | |
7 | http://opensource.org/licenses/bsd-license.php\r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
11 | Module Name:\r | |
12 | \r | |
13 | FvToFv2Thunk.c\r | |
14 | \r | |
15 | Abstract:\r | |
16 | \r | |
17 | DXE driver \r | |
18 | \r | |
19 | --*/\r | |
20 | \r | |
21 | #include <PiDxe.h>\r | |
22 | #include <Protocol/FirmwareVolume2.h>\r | |
23 | #include <Protocol/FirmwareVolume.h>\r | |
24 | #include <Library/BaseLib.h>\r | |
25 | #include <Library/DebugLib.h>\r | |
26 | #include <Library/UefiBootServicesTableLib.h>\r | |
27 | #include <Library/UefiDriverEntryPoint.h>\r | |
28 | #include <Library/UefiLib.h>\r | |
29 | #include <Library/MemoryAllocationLib.h>\r | |
30 | \r | |
31 | /**\r | |
32 | Retrieves attributes, insures positive polarity of attribute bits, returns\r | |
33 | resulting attributes in output parameter\r | |
34 | \r | |
35 | @param This Calling context\r | |
36 | @param Attributes output buffer which contains attributes\r | |
37 | \r | |
38 | @retval EFI_INVALID_PARAMETER\r | |
39 | @retval EFI_SUCCESS\r | |
40 | \r | |
41 | **/\r | |
42 | EFI_STATUS\r | |
43 | EFIAPI\r | |
44 | FvGetVolumeAttributes (\r | |
45 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r | |
46 | OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes\r | |
47 | );\r | |
48 | \r | |
49 | /**\r | |
50 | Sets volume attributes\r | |
51 | \r | |
52 | @param This Calling context\r | |
53 | @param Attributes Buffer which contains attributes\r | |
54 | \r | |
55 | @retval EFI_INVALID_PARAMETER\r | |
56 | @retval EFI_DEVICE_ERROR\r | |
57 | @retval EFI_SUCCESS\r | |
58 | \r | |
59 | **/\r | |
60 | EFI_STATUS\r | |
61 | EFIAPI\r | |
62 | FvSetVolumeAttributes (\r | |
63 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r | |
64 | IN OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes\r | |
65 | );\r | |
66 | \r | |
67 | /**\r | |
68 | Read the requested file (NameGuid) and returns data in Buffer.\r | |
69 | \r | |
70 | @param This Calling context\r | |
71 | @param NameGuid Filename identifying which file to read\r | |
72 | @param Buffer Pointer to pointer to buffer in which contents of file are returned.\r | |
73 | <br>\r | |
74 | If Buffer is NULL, only type, attributes, and size are returned as\r | |
75 | there is no output buffer.\r | |
76 | <br>\r | |
77 | If Buffer != NULL and *Buffer == NULL, the output buffer is allocated\r | |
78 | from BS pool by ReadFile\r | |
79 | <br>\r | |
80 | If Buffer != NULL and *Buffer != NULL, the output buffer has been\r | |
81 | allocated by the caller and is being passed in.\r | |
82 | @param BufferSize Indicates the buffer size passed in, and on output the size\r | |
83 | required to complete the read\r | |
84 | @param FoundType Indicates the type of the file who's data is returned\r | |
85 | @param FileAttributes Indicates the attributes of the file who's data is resturned\r | |
86 | @param AuthenticationStatus Indicates the authentication status of the data\r | |
87 | \r | |
88 | @retval EFI_SUCCESS\r | |
89 | @retval EFI_WARN_BUFFER_TOO_SMALL\r | |
90 | @retval EFI_NOT_FOUND\r | |
91 | @retval EFI_DEVICE_ERROR\r | |
92 | @retval EFI_ACCESS_DENIED\r | |
93 | \r | |
94 | **/\r | |
95 | EFI_STATUS\r | |
96 | EFIAPI\r | |
97 | FvReadFile (\r | |
98 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r | |
99 | IN EFI_GUID *NameGuid,\r | |
100 | IN OUT VOID **Buffer,\r | |
101 | IN OUT UINTN *BufferSize,\r | |
102 | OUT EFI_FV_FILETYPE *FoundType,\r | |
103 | OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes,\r | |
104 | OUT UINT32 *AuthenticationStatus\r | |
105 | );\r | |
106 | \r | |
107 | /**\r | |
108 | Read the requested section from the specified file and returns data in Buffer.\r | |
109 | \r | |
110 | @param This Calling context\r | |
111 | @param NameGuid Filename identifying the file from which to read\r | |
112 | @param SectionType Indicates what section type to retrieve\r | |
113 | @param SectionInstance Indicates which instance of SectionType to retrieve\r | |
114 | @param Buffer Pointer to pointer to buffer in which contents of file are returned.\r | |
115 | <br>\r | |
116 | If Buffer is NULL, only type, attributes, and size are returned as\r | |
117 | there is no output buffer.\r | |
118 | <br>\r | |
119 | If Buffer != NULL and *Buffer == NULL, the output buffer is allocated\r | |
120 | from BS pool by ReadFile\r | |
121 | <br>\r | |
122 | If Buffer != NULL and *Buffer != NULL, the output buffer has been\r | |
123 | allocated by the caller and is being passed in.\r | |
124 | @param BufferSize Indicates the buffer size passed in, and on output the size\r | |
125 | required to complete the read\r | |
126 | @param AuthenticationStatus Indicates the authentication status of the data\r | |
127 | \r | |
128 | @retval EFI_SUCCESS\r | |
129 | @retval EFI_WARN_BUFFER_TOO_SMALL\r | |
130 | @retval EFI_OUT_OF_RESOURCES\r | |
131 | @retval EFI_NOT_FOUND\r | |
132 | @retval EFI_DEVICE_ERROR\r | |
133 | @retval EFI_ACCESS_DENIED\r | |
134 | \r | |
135 | **/\r | |
136 | EFI_STATUS\r | |
137 | EFIAPI \r | |
138 | FvReadSection (\r | |
139 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r | |
140 | IN EFI_GUID *NameGuid,\r | |
141 | IN EFI_SECTION_TYPE SectionType,\r | |
142 | IN UINTN SectionInstance,\r | |
143 | IN OUT VOID **Buffer,\r | |
144 | IN OUT UINTN *BufferSize,\r | |
145 | OUT UINT32 *AuthenticationStatus\r | |
146 | );\r | |
147 | \r | |
148 | /**\r | |
149 | Write the supplied file (NameGuid) to the FV.\r | |
150 | \r | |
151 | @param This Calling context\r | |
152 | @param NumberOfFiles Indicates the number of file records pointed to by FileData\r | |
153 | @param WritePolicy Indicates the level of reliability of the write with respect to\r | |
154 | things like power failure events.\r | |
155 | @param FileData A pointer to an array of EFI_FV_WRITE_FILE_DATA structures. Each\r | |
156 | element in the array indicates a file to write, and there are\r | |
157 | NumberOfFiles elements in the input array.\r | |
158 | \r | |
159 | @retval EFI_SUCCESS\r | |
160 | @retval EFI_OUT_OF_RESOURCES\r | |
161 | @retval EFI_DEVICE_ERROR\r | |
162 | @retval EFI_WRITE_PROTECTED\r | |
163 | @retval EFI_NOT_FOUND\r | |
164 | @retval EFI_INVALID_PARAMETER\r | |
165 | \r | |
166 | **/\r | |
167 | EFI_STATUS\r | |
168 | EFIAPI \r | |
169 | FvWriteFile (\r | |
170 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r | |
171 | IN UINT32 NumberOfFiles,\r | |
172 | IN FRAMEWORK_EFI_FV_WRITE_POLICY WritePolicy,\r | |
173 | IN FRAMEWORK_EFI_FV_WRITE_FILE_DATA *FileData\r | |
174 | );\r | |
175 | \r | |
176 | /**\r | |
177 | Given the input key, search for the next matching file in the volume.\r | |
178 | \r | |
179 | @param This Calling context\r | |
180 | @param Key Pointer to a caller allocated buffer that contains an implementation\r | |
181 | specific key that is used to track where to begin searching on\r | |
182 | successive calls.\r | |
183 | @param FileType Indicates the file type to filter for\r | |
184 | @param NameGuid Guid filename of the file found\r | |
185 | @param Attributes Attributes of the file found\r | |
186 | @param Size Size in bytes of the file found\r | |
187 | \r | |
188 | @retval EFI_SUCCESS\r | |
189 | @retval EFI_NOT_FOUND\r | |
190 | @retval EFI_DEVICE_ERROR\r | |
191 | @retval EFI_ACCESS_DENIED\r | |
192 | \r | |
193 | **/\r | |
194 | EFI_STATUS\r | |
195 | EFIAPI \r | |
196 | FvGetNextFile (\r | |
197 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r | |
198 | IN OUT VOID *Key,\r | |
199 | IN OUT EFI_FV_FILETYPE *FileType,\r | |
200 | OUT EFI_GUID *NameGuid,\r | |
201 | OUT EFI_FV_FILE_ATTRIBUTES *Attributes,\r | |
202 | OUT UINTN *Size\r | |
203 | );\r | |
204 | \r | |
205 | #define FIRMWARE_VOLUME_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('f', 'v', 't', 'h')\r | |
206 | \r | |
207 | typedef struct {\r | |
208 | UINTN Signature;\r | |
209 | EFI_FIRMWARE_VOLUME_PROTOCOL FirmwareVolume;\r | |
210 | EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;\r | |
211 | } FIRMWARE_VOLUME_PRIVATE_DATA;\r | |
212 | \r | |
213 | #define FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS(a) CR (a, FIRMWARE_VOLUME_PRIVATE_DATA, FirmwareVolume, FIRMWARE_VOLUME_PRIVATE_DATA_SIGNATURE)\r | |
214 | \r | |
215 | //\r | |
216 | // Firmware Volume Protocol template\r | |
217 | //\r | |
218 | EFI_EVENT mFvRegistration;\r | |
219 | \r | |
220 | FIRMWARE_VOLUME_PRIVATE_DATA gFirmwareVolumePrivateDataTemplate = {\r | |
221 | FIRMWARE_VOLUME_PRIVATE_DATA_SIGNATURE,\r | |
222 | {\r | |
223 | FvGetVolumeAttributes,\r | |
224 | FvSetVolumeAttributes,\r | |
225 | FvReadFile,\r | |
226 | FvReadSection,\r | |
227 | FvWriteFile,\r | |
228 | FvGetNextFile,\r | |
229 | 0,\r | |
230 | NULL\r | |
231 | },\r | |
232 | NULL\r | |
233 | };\r | |
234 | \r | |
235 | //\r | |
236 | // Module globals\r | |
237 | //\r | |
238 | \r | |
239 | VOID\r | |
240 | EFIAPI\r | |
241 | FvNotificationEvent (\r | |
242 | IN EFI_EVENT Event,\r | |
243 | IN VOID *Context\r | |
244 | )\r | |
245 | {\r | |
246 | EFI_STATUS Status;\r | |
247 | UINTN BufferSize;\r | |
248 | EFI_HANDLE Handle;\r | |
249 | FIRMWARE_VOLUME_PRIVATE_DATA *Private;\r | |
250 | EFI_FIRMWARE_VOLUME_PROTOCOL *FirmwareVolume;\r | |
251 | \r | |
252 | while (TRUE) {\r | |
253 | BufferSize = sizeof (Handle);\r | |
254 | Status = gBS->LocateHandle (\r | |
255 | ByRegisterNotify,\r | |
256 | &gEfiFirmwareVolume2ProtocolGuid,\r | |
257 | mFvRegistration,\r | |
258 | &BufferSize,\r | |
259 | &Handle\r | |
260 | );\r | |
261 | if (EFI_ERROR (Status)) {\r | |
262 | //\r | |
263 | // Exit Path of While Loop....\r | |
264 | //\r | |
265 | break;\r | |
266 | }\r | |
267 | \r | |
268 | //\r | |
269 | // Skip this handle if the Firmware Volume Protocol is already installed\r | |
270 | //\r | |
271 | Status = gBS->HandleProtocol (\r | |
272 | Handle,\r | |
273 | &gEfiFirmwareVolumeProtocolGuid,\r | |
274 | (VOID **)&FirmwareVolume\r | |
275 | );\r | |
276 | if (!EFI_ERROR (Status)) {\r | |
277 | continue;\r | |
278 | }\r | |
279 | \r | |
280 | //\r | |
281 | // Allocate private data structure\r | |
282 | //\r | |
283 | Private = AllocateCopyPool (sizeof (FIRMWARE_VOLUME_PRIVATE_DATA), &gFirmwareVolumePrivateDataTemplate);\r | |
284 | if (Private == NULL) {\r | |
285 | continue;\r | |
286 | }\r | |
287 | \r | |
288 | //\r | |
289 | // Retrieve the Firmware Volume2 Protocol\r | |
290 | //\r | |
291 | Status = gBS->HandleProtocol (\r | |
292 | Handle,\r | |
293 | &gEfiFirmwareVolume2ProtocolGuid,\r | |
294 | (VOID **)&Private->FirmwareVolume2\r | |
295 | );\r | |
296 | ASSERT_EFI_ERROR (Status);\r | |
297 | \r | |
298 | //\r | |
299 | // Fill in rest of private data structure\r | |
300 | //\r | |
301 | Private->FirmwareVolume.KeySize = Private->FirmwareVolume2->KeySize;\r | |
302 | Private->FirmwareVolume.ParentHandle = Private->FirmwareVolume2->ParentHandle;\r | |
303 | \r | |
304 | //\r | |
305 | // Install Firmware Volume Protocol onto same handle\r | |
306 | //\r | |
307 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
308 | &Handle,\r | |
309 | &gEfiFirmwareVolumeProtocolGuid,\r | |
310 | &Private->FirmwareVolume,\r | |
311 | NULL\r | |
312 | );\r | |
313 | ASSERT_EFI_ERROR (Status);\r | |
314 | }\r | |
315 | }\r | |
316 | \r | |
317 | \r | |
318 | /**\r | |
319 | The user Entry Point for DXE driver. The user code starts with this function\r | |
320 | as the real entry point for the image goes into a library that calls this \r | |
321 | function.\r | |
322 | \r | |
323 | @param[in] ImageHandle The firmware allocated handle for the EFI image. \r | |
324 | @param[in] SystemTable A pointer to the EFI System Table.\r | |
325 | \r | |
326 | @retval EFI_SUCCESS The entry point is executed successfully.\r | |
327 | @retval other Some error occurs when executing this entry point.\r | |
328 | \r | |
329 | **/\r | |
330 | EFI_STATUS\r | |
331 | EFIAPI\r | |
332 | InitializeFirmwareVolume2 (\r | |
333 | IN EFI_HANDLE ImageHandle,\r | |
334 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
335 | )\r | |
336 | {\r | |
337 | EfiCreateProtocolNotifyEvent (\r | |
338 | &gEfiFirmwareVolume2ProtocolGuid,\r | |
339 | TPL_CALLBACK,\r | |
340 | FvNotificationEvent,\r | |
341 | NULL,\r | |
342 | &mFvRegistration\r | |
343 | );\r | |
344 | return EFI_SUCCESS;\r | |
345 | }\r | |
346 | \r | |
347 | /**\r | |
348 | Retrieves attributes, insures positive polarity of attribute bits, returns\r | |
349 | resulting attributes in output parameter\r | |
350 | \r | |
351 | @param This Calling context\r | |
352 | @param Attributes output buffer which contains attributes\r | |
353 | \r | |
354 | @retval EFI_INVALID_PARAMETER\r | |
355 | @retval EFI_SUCCESS\r | |
356 | \r | |
357 | **/\r | |
358 | EFI_STATUS\r | |
359 | EFIAPI\r | |
360 | FvGetVolumeAttributes (\r | |
361 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r | |
362 | OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes\r | |
363 | )\r | |
364 | {\r | |
365 | EFI_STATUS Status;\r | |
366 | FIRMWARE_VOLUME_PRIVATE_DATA *Private;\r | |
367 | EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;\r | |
368 | \r | |
369 | Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This);\r | |
370 | FirmwareVolume2 = Private->FirmwareVolume2;\r | |
371 | \r | |
372 | Status = FirmwareVolume2->GetVolumeAttributes (\r | |
373 | FirmwareVolume2,\r | |
374 | Attributes\r | |
375 | );\r | |
376 | if (!EFI_ERROR (Status)) {\r | |
377 | *Attributes = (*Attributes & 0x1ff) | ((UINTN)EFI_FV_ALIGNMENT_2 << ((*Attributes & EFI_FV2_ALIGNMENT) >> 16));\r | |
378 | }\r | |
379 | return Status;\r | |
380 | }\r | |
381 | \r | |
382 | /**\r | |
383 | Sets volume attributes\r | |
384 | \r | |
385 | @param This Calling context\r | |
386 | @param Attributes Buffer which contains attributes\r | |
387 | \r | |
388 | @retval EFI_INVALID_PARAMETER\r | |
389 | @retval EFI_DEVICE_ERROR\r | |
390 | @retval EFI_SUCCESS\r | |
391 | \r | |
392 | **/\r | |
393 | EFI_STATUS\r | |
394 | EFIAPI\r | |
395 | FvSetVolumeAttributes (\r | |
396 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r | |
397 | IN OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes\r | |
398 | )\r | |
399 | {\r | |
400 | FIRMWARE_VOLUME_PRIVATE_DATA *Private;\r | |
401 | EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;\r | |
402 | INTN Alignment;\r | |
403 | EFI_FV_ATTRIBUTES Fv2Attributes; \r | |
404 | \r | |
405 | Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This);\r | |
406 | FirmwareVolume2 = Private->FirmwareVolume2;\r | |
407 | \r | |
408 | Fv2Attributes = (*Attributes & 0x1ff);\r | |
409 | Alignment = LowBitSet64 (RShiftU64 (*Attributes, 16) & 0xffff);\r | |
410 | if (Alignment != -1) {\r | |
411 | Fv2Attributes |= LShiftU64 (Alignment, 16);\r | |
412 | }\r | |
413 | return FirmwareVolume2->SetVolumeAttributes (\r | |
414 | FirmwareVolume2,\r | |
415 | &Fv2Attributes\r | |
416 | );\r | |
417 | }\r | |
418 | \r | |
419 | /**\r | |
420 | Read the requested file (NameGuid) and returns data in Buffer.\r | |
421 | \r | |
422 | @param This Calling context\r | |
423 | @param NameGuid Filename identifying which file to read\r | |
424 | @param Buffer Pointer to pointer to buffer in which contents of file are returned.\r | |
425 | <br>\r | |
426 | If Buffer is NULL, only type, attributes, and size are returned as\r | |
427 | there is no output buffer.\r | |
428 | <br>\r | |
429 | If Buffer != NULL and *Buffer == NULL, the output buffer is allocated\r | |
430 | from BS pool by ReadFile\r | |
431 | <br>\r | |
432 | If Buffer != NULL and *Buffer != NULL, the output buffer has been\r | |
433 | allocated by the caller and is being passed in.\r | |
434 | @param BufferSize Indicates the buffer size passed in, and on output the size\r | |
435 | required to complete the read\r | |
436 | @param FoundType Indicates the type of the file who's data is returned\r | |
437 | @param FileAttributes Indicates the attributes of the file who's data is resturned\r | |
438 | @param AuthenticationStatus Indicates the authentication status of the data\r | |
439 | \r | |
440 | @retval EFI_SUCCESS\r | |
441 | @retval EFI_WARN_BUFFER_TOO_SMALL\r | |
442 | @retval EFI_NOT_FOUND\r | |
443 | @retval EFI_DEVICE_ERROR\r | |
444 | @retval EFI_ACCESS_DENIED\r | |
445 | \r | |
446 | **/\r | |
447 | EFI_STATUS\r | |
448 | EFIAPI\r | |
449 | FvReadFile (\r | |
450 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r | |
451 | IN EFI_GUID *NameGuid,\r | |
452 | IN OUT VOID **Buffer,\r | |
453 | IN OUT UINTN *BufferSize,\r | |
454 | OUT EFI_FV_FILETYPE *FoundType,\r | |
455 | OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes,\r | |
456 | OUT UINT32 *AuthenticationStatus\r | |
457 | )\r | |
458 | {\r | |
459 | FIRMWARE_VOLUME_PRIVATE_DATA *Private;\r | |
460 | EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;\r | |
461 | \r | |
462 | Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This);\r | |
463 | FirmwareVolume2 = Private->FirmwareVolume2;\r | |
464 | \r | |
465 | return FirmwareVolume2->ReadFile (\r | |
466 | FirmwareVolume2,\r | |
467 | NameGuid,\r | |
468 | Buffer,\r | |
469 | BufferSize,\r | |
470 | FoundType,\r | |
471 | FileAttributes,\r | |
472 | AuthenticationStatus\r | |
473 | );\r | |
474 | }\r | |
475 | \r | |
476 | /**\r | |
477 | Read the requested section from the specified file and returns data in Buffer.\r | |
478 | \r | |
479 | @param This Calling context\r | |
480 | @param NameGuid Filename identifying the file from which to read\r | |
481 | @param SectionType Indicates what section type to retrieve\r | |
482 | @param SectionInstance Indicates which instance of SectionType to retrieve\r | |
483 | @param Buffer Pointer to pointer to buffer in which contents of file are returned.\r | |
484 | <br>\r | |
485 | If Buffer is NULL, only type, attributes, and size are returned as\r | |
486 | there is no output buffer.\r | |
487 | <br>\r | |
488 | If Buffer != NULL and *Buffer == NULL, the output buffer is allocated\r | |
489 | from BS pool by ReadFile\r | |
490 | <br>\r | |
491 | If Buffer != NULL and *Buffer != NULL, the output buffer has been\r | |
492 | allocated by the caller and is being passed in.\r | |
493 | @param BufferSize Indicates the buffer size passed in, and on output the size\r | |
494 | required to complete the read\r | |
495 | @param AuthenticationStatus Indicates the authentication status of the data\r | |
496 | \r | |
497 | @retval EFI_SUCCESS\r | |
498 | @retval EFI_WARN_BUFFER_TOO_SMALL\r | |
499 | @retval EFI_OUT_OF_RESOURCES\r | |
500 | @retval EFI_NOT_FOUND\r | |
501 | @retval EFI_DEVICE_ERROR\r | |
502 | @retval EFI_ACCESS_DENIED\r | |
503 | \r | |
504 | **/\r | |
505 | EFI_STATUS\r | |
506 | EFIAPI \r | |
507 | FvReadSection (\r | |
508 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r | |
509 | IN EFI_GUID *NameGuid,\r | |
510 | IN EFI_SECTION_TYPE SectionType,\r | |
511 | IN UINTN SectionInstance,\r | |
512 | IN OUT VOID **Buffer,\r | |
513 | IN OUT UINTN *BufferSize,\r | |
514 | OUT UINT32 *AuthenticationStatus\r | |
515 | )\r | |
516 | {\r | |
517 | FIRMWARE_VOLUME_PRIVATE_DATA *Private;\r | |
518 | EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;\r | |
519 | \r | |
520 | Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This);\r | |
521 | FirmwareVolume2 = Private->FirmwareVolume2;\r | |
522 | \r | |
523 | return FirmwareVolume2->ReadSection (\r | |
524 | FirmwareVolume2,\r | |
525 | NameGuid,\r | |
526 | SectionType,\r | |
527 | SectionInstance,\r | |
528 | Buffer,\r | |
529 | BufferSize,\r | |
530 | AuthenticationStatus\r | |
531 | );\r | |
532 | }\r | |
533 | \r | |
534 | /**\r | |
535 | Write the supplied file (NameGuid) to the FV.\r | |
536 | \r | |
537 | @param This Calling context\r | |
538 | @param NumberOfFiles Indicates the number of file records pointed to by FileData\r | |
539 | @param WritePolicy Indicates the level of reliability of the write with respect to\r | |
540 | things like power failure events.\r | |
541 | @param FileData A pointer to an array of EFI_FV_WRITE_FILE_DATA structures. Each\r | |
542 | element in the array indicates a file to write, and there are\r | |
543 | NumberOfFiles elements in the input array.\r | |
544 | \r | |
545 | @retval EFI_SUCCESS\r | |
546 | @retval EFI_OUT_OF_RESOURCES\r | |
547 | @retval EFI_DEVICE_ERROR\r | |
548 | @retval EFI_WRITE_PROTECTED\r | |
549 | @retval EFI_NOT_FOUND\r | |
550 | @retval EFI_INVALID_PARAMETER\r | |
551 | \r | |
552 | **/\r | |
553 | EFI_STATUS\r | |
554 | EFIAPI \r | |
555 | FvWriteFile (\r | |
556 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r | |
557 | IN UINT32 NumberOfFiles,\r | |
558 | IN FRAMEWORK_EFI_FV_WRITE_POLICY WritePolicy,\r | |
559 | IN FRAMEWORK_EFI_FV_WRITE_FILE_DATA *FileData\r | |
560 | )\r | |
561 | {\r | |
562 | FIRMWARE_VOLUME_PRIVATE_DATA *Private;\r | |
563 | EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;\r | |
564 | \r | |
565 | Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This);\r | |
566 | FirmwareVolume2 = Private->FirmwareVolume2;\r | |
567 | \r | |
568 | return FirmwareVolume2->WriteFile (\r | |
569 | FirmwareVolume2,\r | |
570 | NumberOfFiles,\r | |
571 | WritePolicy,\r | |
572 | (EFI_FV_WRITE_FILE_DATA *)FileData\r | |
573 | );\r | |
574 | }\r | |
575 | \r | |
576 | /**\r | |
577 | Given the input key, search for the next matching file in the volume.\r | |
578 | \r | |
579 | @param This Calling context\r | |
580 | @param Key Pointer to a caller allocated buffer that contains an implementation\r | |
581 | specific key that is used to track where to begin searching on\r | |
582 | successive calls.\r | |
583 | @param FileType Indicates the file type to filter for\r | |
584 | @param NameGuid Guid filename of the file found\r | |
585 | @param Attributes Attributes of the file found\r | |
586 | @param Size Size in bytes of the file found\r | |
587 | \r | |
588 | @retval EFI_SUCCESS\r | |
589 | @retval EFI_NOT_FOUND\r | |
590 | @retval EFI_DEVICE_ERROR\r | |
591 | @retval EFI_ACCESS_DENIED\r | |
592 | \r | |
593 | **/\r | |
594 | EFI_STATUS\r | |
595 | EFIAPI \r | |
596 | FvGetNextFile (\r | |
597 | IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,\r | |
598 | IN OUT VOID *Key,\r | |
599 | IN OUT EFI_FV_FILETYPE *FileType,\r | |
600 | OUT EFI_GUID *NameGuid,\r | |
601 | OUT EFI_FV_FILE_ATTRIBUTES *Attributes,\r | |
602 | OUT UINTN *Size\r | |
603 | )\r | |
604 | {\r | |
605 | FIRMWARE_VOLUME_PRIVATE_DATA *Private;\r | |
606 | EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;\r | |
607 | \r | |
608 | Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This);\r | |
609 | FirmwareVolume2 = Private->FirmwareVolume2;\r | |
610 | \r | |
611 | return FirmwareVolume2->GetNextFile (\r | |
612 | FirmwareVolume2,\r | |
613 | Key,\r | |
614 | FileType,\r | |
615 | NameGuid,\r | |
616 | Attributes,\r | |
617 | Size\r | |
618 | );\r | |
619 | }\r |