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