/** @file\r
Implements functions to read firmware file\r
\r
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
UINTN *KeyValue;\r
LIST_ENTRY *Link;\r
FFS_FILE_LIST_ENTRY *FfsFileEntry;\r
- UINTN FileLength;\r
\r
FvDevice = FV_DEVICE_FROM_THIS (This);\r
\r
CopyGuid (NameGuid, &FfsFileHeader->Name);\r
*Attributes = FfsAttributes2FvFileAttributes (FfsFileHeader->Attributes);\r
\r
- //\r
- // Read four bytes out of the 3 byte array and throw out extra data\r
- //\r
- FileLength = *(UINT32 *)&FfsFileHeader->Size[0] & 0x00FFFFFF;\r
-\r
//\r
// we need to substract the header size\r
//\r
- *Size = FileLength - sizeof(EFI_FFS_FILE_HEADER);\r
+ if (IS_FFS_FILE2 (FfsFileHeader)) {\r
+ *Size = FFS_FILE2_SIZE (FfsFileHeader) - sizeof (EFI_FFS_FILE_HEADER2);\r
+ } else {\r
+ *Size = FFS_FILE_SIZE (FfsFileHeader) - sizeof (EFI_FFS_FILE_HEADER);\r
+ }\r
\r
return EFI_SUCCESS;\r
}\r
//\r
// Skip over file header\r
//\r
- SrcPtr = ((UINT8 *)FfsHeader) + sizeof (EFI_FFS_FILE_HEADER);\r
+ if (IS_FFS_FILE2 (FfsHeader)) {\r
+ SrcPtr = ((UINT8 *) FfsHeader) + sizeof (EFI_FFS_FILE_HEADER2);\r
+ } else {\r
+ SrcPtr = ((UINT8 *) FfsHeader) + sizeof (EFI_FFS_FILE_HEADER);\r
+ }\r
\r
Status = EFI_SUCCESS;\r
if (*Buffer == NULL) {\r
}\r
\r
//\r
- // Use FfsEntry to cache Section Extraction Protocol Inforomation\r
+ // Use FfsEntry to cache Section Extraction Protocol Information\r
//\r
if (FfsEntry->StreamHandle == 0) {\r
Status = OpenSectionStream (\r
(SectionType == 0) ? 0 : SectionInstance,\r
Buffer,\r
BufferSize,\r
- AuthenticationStatus\r
+ AuthenticationStatus,\r
+ FvDevice->IsFfs3Fv\r
);\r
\r
//\r