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
This commit is contained in:
lzeng14
2011-10-27 09:23:19 +00:00
parent 890e54170e
commit 6c85d16217
7 changed files with 150 additions and 56 deletions

View File

@@ -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);
@@ -201,15 +200,14 @@ FvGetNextFile (
CopyGuid (NameGuid, &FfsFileHeader->Name);
*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
);
//