Update Nt32 FVB driver to provide the valid FvHeader that header checksum is zero.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7930 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2009-03-24 07:57:42 +00:00
parent 5547062df5
commit 121ac75720
2 changed files with 14 additions and 30 deletions

View File

@ -1104,10 +1104,6 @@ Returns:
--*/ --*/
{ {
UINT16 *Ptr;
UINT16 HeaderLength;
UINT16 Checksum;
// //
// Verify the header revision, header signature, length // Verify the header revision, header signature, length
// Length of FvBlock cannot be 2**64-1 // Length of FvBlock cannot be 2**64-1
@ -1124,26 +1120,10 @@ Returns:
// //
// Verify the header checksum // Verify the header checksum
// //
HeaderLength = (UINT16) (FwVolHeader->HeaderLength / 2); if (CalculateCheckSum16 ((UINT16 *) FwVolHeader, FwVolHeader->HeaderLength) != 0) {
Ptr = (UINT16 *) FwVolHeader;
Checksum = 0;
while (HeaderLength > 0) {
Checksum = (UINT16)(Checksum + (*Ptr));
HeaderLength--;
Ptr++;
}
if (Checksum != 0) {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
//
// PI specification defines the name guid of FV exists in extension header.
//
if (FwVolHeader->ExtHeaderOffset == 0) {
return EFI_NOT_FOUND;
}
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -1180,7 +1160,7 @@ Returns:
UINTN NumOfBlocks; UINTN NumOfBlocks;
EFI_PEI_HOB_POINTERS FvHob; EFI_PEI_HOB_POINTERS FvHob;
// //
// Get the DXE services table // Get the DXE services table
// //
DxeServices = gDS; DxeServices = gDS;

View File

@ -70,14 +70,16 @@ EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo[] = {
EFI_FIRMWARE_FILE_SYSTEM2_GUID, EFI_FIRMWARE_FILE_SYSTEM2_GUID,
FixedPcdGet32 (PcdWinNtFlashFvRecoverySize), FixedPcdGet32 (PcdWinNtFlashFvRecoverySize),
EFI_FVH_SIGNATURE, EFI_FVH_SIGNATURE,
EFI_FVB2_READ_ENABLED_CAP | EFI_FVB2_MEMORY_MAPPED |
EFI_FVB2_READ_ENABLED_CAP |
EFI_FVB2_READ_STATUS | EFI_FVB2_READ_STATUS |
EFI_FVB2_WRITE_ENABLED_CAP | EFI_FVB2_WRITE_ENABLED_CAP |
EFI_FVB2_WRITE_STATUS | EFI_FVB2_WRITE_STATUS |
EFI_FVB2_ERASE_POLARITY, EFI_FVB2_ERASE_POLARITY |
EFI_FVB2_ALIGNMENT_16,
sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENTRY), sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENTRY),
0, // CheckSum 0xE947, // CheckSum
0, // ExtHeaderOffset 0, // ExtHeaderOffset
{ {
0, 0,
}, // Reserved[1] }, // Reserved[1]
@ -110,14 +112,16 @@ EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo[] = {
FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) + FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize) +
FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize), FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize),
EFI_FVH_SIGNATURE, EFI_FVH_SIGNATURE,
EFI_FVB2_READ_ENABLED_CAP | EFI_FVB2_MEMORY_MAPPED |
EFI_FVB2_READ_ENABLED_CAP |
EFI_FVB2_READ_STATUS | EFI_FVB2_READ_STATUS |
EFI_FVB2_WRITE_ENABLED_CAP | EFI_FVB2_WRITE_ENABLED_CAP |
EFI_FVB2_WRITE_STATUS | EFI_FVB2_WRITE_STATUS |
EFI_FVB2_ERASE_POLARITY, EFI_FVB2_ERASE_POLARITY |
EFI_FVB2_ALIGNMENT_16,
sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENTRY), sizeof (EFI_FIRMWARE_VOLUME_HEADER) + sizeof (EFI_FV_BLOCK_MAP_ENTRY),
0, // CheckSum 0xFBFF, // CheckSum
0, // ExtHeaderOffset 0, // ExtHeaderOffset
{ {
0, 0,
}, // Reserved[1] }, // Reserved[1]