X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=Nt32Pkg%2FFvbServicesRuntimeDxe%2FFWBlockService.c;h=03f1f44dafde5b3145f86859cb1d439f3ccdbd67;hb=822925013278733ac7f03c35fece2df3e8bc3614;hp=8d1b7e3c28818a7a44abf26e4fd149ed6d3e57dd;hpb=eb9203646f2f05dff08a2852fe3a862d1c4fc5bd;p=mirror_edk2.git diff --git a/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c b/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c index 8d1b7e3c28..03f1f44daf 100644 --- a/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c +++ b/Nt32Pkg/FvbServicesRuntimeDxe/FWBlockService.c @@ -1,7 +1,7 @@ /**@file -Copyright (c) 2006 - 2007, Intel Corporation -All rights reserved. This program and the accompanying materials +Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
+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 http://opensource.org/licenses/bsd-license.php @@ -29,7 +29,6 @@ Revision History // #include #include -#include #include // // The Library classes this module consumes @@ -946,19 +945,15 @@ Returns: break; } - NumOfLba = VA_ARG (args, UINT32); + NumOfLba = VA_ARG (args, UINTN); // // Check input parameters // - if (NumOfLba == 0) { + if ((NumOfLba == 0) || ((StartingLba + NumOfLba) > NumOfBlocks)) { VA_END (args); return EFI_INVALID_PARAMETER; } - - if ((StartingLba + NumOfLba) > NumOfBlocks) { - return EFI_INVALID_PARAMETER; - } } while (1); VA_END (args); @@ -970,7 +965,7 @@ Returns: break; } - NumOfLba = VA_ARG (args, UINT32); + NumOfLba = VA_ARG (args, UINTN); while (NumOfLba > 0) { Status = FvbEraseBlock (FvbDevice->Instance, StartingLba, mFvbModuleGlobal, EfiGoneVirtual ()); @@ -1105,10 +1100,6 @@ Returns: --*/ { - UINT16 *Ptr; - UINT16 HeaderLength; - UINT16 Checksum; - // // Verify the header revision, header signature, length // Length of FvBlock cannot be 2**64-1 @@ -1125,26 +1116,10 @@ Returns: // // Verify the header checksum // - HeaderLength = (UINT16) (FwVolHeader->HeaderLength / 2); - Ptr = (UINT16 *) FwVolHeader; - Checksum = 0; - while (HeaderLength > 0) { - Checksum = (UINT16)(Checksum + (*Ptr)); - HeaderLength--; - Ptr++; - } - - if (Checksum != 0) { + if (CalculateCheckSum16 ((UINT16 *) FwVolHeader, FwVolHeader->HeaderLength) != 0) { 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; } @@ -1181,7 +1156,7 @@ Returns: UINTN NumOfBlocks; EFI_PEI_HOB_POINTERS FvHob; - // + // // Get the DXE services table // DxeServices = gDS; @@ -1360,7 +1335,7 @@ Returns: &gEfiFirmwareVolumeBlockProtocolGuid, &FvbDevice->FwVolBlockInstance, &gEfiDevicePathProtocolGuid, - &FvbDevice->DevicePath, + FvbDevice->DevicePath, NULL ); ASSERT_EFI_ERROR (Status); @@ -1390,15 +1365,6 @@ Returns: ASSERT (FALSE); } - Status = gBS->InstallMultipleProtocolInterfaces ( - &FwbHandle, - &gEfiAlternateFvBlockGuid, - NULL, - NULL - ); - - ASSERT_EFI_ERROR (Status); - FwhInstance = (EFI_FW_VOL_INSTANCE *) ( (UINTN) ((UINT8 *) FwhInstance) + FwVolHeader->HeaderLength +