33UINT8 mFvAttributes2[] = { 17, 18, 19, 20, 21, 22, 23, 24 };
45 IN EFI_FFS_FILE_ATTRIBUTES FfsAttributes
51 DataAlignment = (UINT8)((FfsAttributes & FFS_ATTRIB_DATA_ALIGNMENT) >> 3);
52 ASSERT (DataAlignment < 8);
54 if ((FfsAttributes & FFS_ATTRIB_DATA_ALIGNMENT_2) != 0) {
60 if ((FfsAttributes & FFS_ATTRIB_FIXED) == FFS_ATTRIB_FIXED) {
61 FileAttribute |= EFI_FV_FILE_ATTRIB_FIXED;
118 IN OUT EFI_FV_FILETYPE *FileType,
132 FvDevice = FV_DEVICE_FROM_THIS (This);
135 if (EFI_ERROR (Status)) {
142 if ((FvAttributes & EFI_FV2_READ_STATUS) == 0) {
143 return EFI_ACCESS_DENIED;
146 if (*FileType > EFI_FV_FILETYPE_MM_CORE_STANDALONE) {
150 return EFI_NOT_FOUND;
153 KeyValue = (
UINTN *)Key;
155 if (*KeyValue == 0) {
159 Link = &FvDevice->FfsFileListHeader;
167 if (Link->ForwardLink == &FvDevice->FfsFileListHeader) {
171 return EFI_NOT_FOUND;
180 *KeyValue = (
UINTN)FfsFileEntry;
182 if (FfsFileHeader->
Type == EFI_FV_FILETYPE_FFS_PAD) {
196 if (*FileType == FfsFileHeader->
Type) {
207 *FileType = FfsFileHeader->
Type;
210 if ((FvDevice->FwVolHeader->
Attributes & EFI_FVB2_MEMORY_MAPPED) == EFI_FVB2_MEMORY_MAPPED) {
211 *Attributes |= EFI_FV_FILE_ATTRIB_MEMORY_MAPPED;
217 if (IS_FFS_FILE2 (FfsFileHeader)) {
271 IN OUT VOID **Buffer,
273 OUT EFI_FV_FILETYPE *FoundType,
275 OUT UINT32 *AuthenticationStatus
281 EFI_FV_FILETYPE LocalFoundType;
286 UINTN InputBufferSize;
289 if (NameGuid ==
NULL) {
290 return EFI_INVALID_PARAMETER;
293 FvDevice = FV_DEVICE_FROM_THIS (This);
299 FvDevice->LastKey = 0;
310 if (EFI_ERROR (Status)) {
311 return EFI_NOT_FOUND;
313 }
while (!
CompareGuid (&SearchNameGuid, NameGuid));
318 FfsHeader = FvDevice->LastKey->FfsHeader;
319 if (FvDevice->IsMemoryMapped) {
323 if (!FvDevice->LastKey->FileCached) {
327 WholeFileSize = IS_FFS_FILE2 (FfsHeader) ? FFS_FILE2_SIZE (FfsHeader) :
FFS_FILE_SIZE (FfsHeader);
329 if (FfsHeader ==
NULL) {
330 return EFI_OUT_OF_RESOURCES;
336 FvDevice->LastKey->FfsHeader = FfsHeader;
337 FvDevice->LastKey->FileCached =
TRUE;
344 InputBufferSize = *BufferSize;
349 *FoundType = FfsHeader->
Type;
351 if ((FvDevice->FwVolHeader->
Attributes & EFI_FVB2_MEMORY_MAPPED) == EFI_FVB2_MEMORY_MAPPED) {
352 *FileAttributes |= EFI_FV_FILE_ATTRIB_MEMORY_MAPPED;
358 *AuthenticationStatus = FvDevice->AuthenticationStatus;
359 *BufferSize = FileSize;
361 if (Buffer ==
NULL) {
371 if (IS_FFS_FILE2 (FfsHeader)) {
378 if (*Buffer ==
NULL) {
383 if (*Buffer ==
NULL) {
384 return EFI_OUT_OF_RESOURCES;
386 }
else if (FileSize > InputBufferSize) {
390 Status = EFI_WARN_BUFFER_TOO_SMALL;
391 FileSize = InputBufferSize;
397 CopyMem (*Buffer, SrcPtr, FileSize);
435 IN EFI_SECTION_TYPE SectionType,
437 IN OUT VOID **Buffer,
439 OUT UINT32 *AuthenticationStatus
444 EFI_FV_FILETYPE FileType;
450 if ((NameGuid ==
NULL) || (Buffer ==
NULL)) {
451 return EFI_INVALID_PARAMETER;
454 FvDevice = FV_DEVICE_FROM_THIS (This);
473 if (EFI_ERROR (Status)) {
477 if (IS_FFS_FILE2 (FfsEntry->FfsHeader)) {
486 if (FileType == EFI_FV_FILETYPE_RAW) {
487 Status = EFI_NOT_FOUND;
494 if (FfsEntry->StreamHandle == 0) {
498 &FfsEntry->StreamHandle
500 if (EFI_ERROR (Status)) {
509 FfsEntry->StreamHandle,
510 (SectionType == 0) ?
NULL : &SectionType,
512 (SectionType == 0) ? 0 : SectionInstance,
515 AuthenticationStatus,
519 if (!EFI_ERROR (Status)) {
523 *AuthenticationStatus |= FvDevice->AuthenticationStatus;
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
EFI_STATUS EFIAPI GetSection(IN UINTN SectionStreamHandle, IN EFI_SECTION_TYPE *SectionType, IN EFI_GUID *SectionDefinitionGuid, IN UINTN SectionInstance, IN VOID **Buffer, IN OUT UINTN *BufferSize, OUT UINT32 *AuthenticationStatus, IN BOOLEAN IsFfs3Fv)
EFI_STATUS EFIAPI OpenSectionStream(IN UINTN SectionStreamLength, IN VOID *SectionStream, OUT UINTN *SectionStreamHandle)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
EFI_STATUS EFIAPI FvGetVolumeAttributes(IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, OUT EFI_FV_ATTRIBUTES *Attributes)
EFI_STATUS EFIAPI FvReadFile(IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, IN CONST EFI_GUID *NameGuid, IN OUT VOID **Buffer, IN OUT UINTN *BufferSize, OUT EFI_FV_FILETYPE *FoundType, OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes, OUT UINT32 *AuthenticationStatus)
EFI_FV_FILE_ATTRIBUTES FfsAttributes2FvFileAttributes(IN EFI_FFS_FILE_ATTRIBUTES FfsAttributes)
EFI_STATUS EFIAPI FvGetNextFile(IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, IN OUT VOID *Key, IN OUT EFI_FV_FILETYPE *FileType, OUT EFI_GUID *NameGuid, OUT EFI_FV_FILE_ATTRIBUTES *Attributes, OUT UINTN *Size)
EFI_STATUS EFIAPI FvReadFileSection(IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, IN CONST EFI_GUID *NameGuid, IN EFI_SECTION_TYPE SectionType, IN UINTN SectionInstance, IN OUT VOID **Buffer, IN OUT UINTN *BufferSize, OUT UINT32 *AuthenticationStatus)
#define EFI_FV_FILETYPE_ALL
#define FFS_FILE_SIZE(FfsFileHeaderPtr)
UINT32 EFI_FV_FILE_ATTRIBUTES
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_FFS_FILE_ATTRIBUTES Attributes
EFI_FVB_ATTRIBUTES_2 Attributes