summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c
diff options
context:
space:
mode:
authorlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-27 09:23:19 +0000
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-27 09:23:19 +0000
commit6c85d1621713403f20e5c013fa8db161a1c8c4f3 (patch)
tree79e2cfaeeca73423da66f80dd5219da26ca2155b /MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c
parent890e54170e8f85d1357ac3614f7ad1465050ff0c (diff)
downloadedk2-platforms-6c85d1621713403f20e5c013fa8db161a1c8c4f3.tar.xz
Add core FFS3 support, DxeCore.
Signed-off-by: lzeng14 Reviewed-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12584 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c')
-rw-r--r--MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c b/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c
index 0b53af27d1..52f84919d1 100644
--- a/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c
+++ b/MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c
@@ -1,7 +1,7 @@
/** @file
Implements functions to read firmware file
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -119,7 +119,6 @@ FvGetNextFile (
UINTN *KeyValue;
LIST_ENTRY *Link;
FFS_FILE_LIST_ENTRY *FfsFileEntry;
- UINTN FileLength;
FvDevice = FV_DEVICE_FROM_THIS (This);
@@ -202,14 +201,13 @@ FvGetNextFile (
*Attributes = FfsAttributes2FvFileAttributes (FfsFileHeader->Attributes);
//
- // Read four bytes out of the 3 byte array and throw out extra data
- //
- FileLength = *(UINT32 *)&FfsFileHeader->Size[0] & 0x00FFFFFF;
-
- //
// we need to substract the header size
//
- *Size = FileLength - sizeof(EFI_FFS_FILE_HEADER);
+ if (IS_FFS_FILE2 (FfsFileHeader)) {
+ *Size = FFS_FILE2_SIZE (FfsFileHeader) - sizeof (EFI_FFS_FILE_HEADER2);
+ } else {
+ *Size = FFS_FILE_SIZE (FfsFileHeader) - sizeof (EFI_FFS_FILE_HEADER);
+ }
return EFI_SUCCESS;
}
@@ -333,7 +331,11 @@ FvReadFile (
//
// Skip over file header
//
- SrcPtr = ((UINT8 *)FfsHeader) + sizeof (EFI_FFS_FILE_HEADER);
+ if (IS_FFS_FILE2 (FfsHeader)) {
+ SrcPtr = ((UINT8 *) FfsHeader) + sizeof (EFI_FFS_FILE_HEADER2);
+ } else {
+ SrcPtr = ((UINT8 *) FfsHeader) + sizeof (EFI_FFS_FILE_HEADER);
+ }
Status = EFI_SUCCESS;
if (*Buffer == NULL) {
@@ -447,7 +449,7 @@ FvReadFileSection (
}
//
- // Use FfsEntry to cache Section Extraction Protocol Inforomation
+ // Use FfsEntry to cache Section Extraction Protocol Information
//
if (FfsEntry->StreamHandle == 0) {
Status = OpenSectionStream (
@@ -470,7 +472,8 @@ FvReadFileSection (
(SectionType == 0) ? 0 : SectionInstance,
Buffer,
BufferSize,
- AuthenticationStatus
+ AuthenticationStatus,
+ FvDevice->IsFfs3Fv
);
//