SignedCapsulePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the SignedCapsulePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
47d20b54f9
commit
b878648967
@ -7,7 +7,6 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#ifndef __EDKII_SYSTEM_FMP_CAPSULE_GUID_H__
|
||||
#define __EDKII_SYSTEM_FMP_CAPSULE_GUID_H__
|
||||
|
||||
|
@ -6,7 +6,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#ifndef __EDKII_SYSTEM_CAPSULE_LIB_H__
|
||||
#define __EDKII_SYSTEM_CAPSULE_LIB_H__
|
||||
|
||||
@ -145,4 +144,3 @@ CapsuleAuthenticateSystemFirmware (
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -24,7 +24,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#ifndef __INI_PARSING_LIB_H__
|
||||
#define __INI_PARSING_LIB_H__
|
||||
|
||||
@ -157,4 +156,3 @@ CloseIniFile (
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#ifndef __PLATFORM_FLASH_ACCESS_LIB_H__
|
||||
#define __PLATFORM_FLASH_ACCESS_LIB_H__
|
||||
|
||||
|
@ -182,12 +182,14 @@ GetFfsByName (
|
||||
FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)((UINTN)FvHeader + SIZE_4KB);
|
||||
continue;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "checking FV....0x%08x - 0x%x\n", FvHeader, FvHeader->FvLength));
|
||||
FvFound = TRUE;
|
||||
if (FvHeader->FvLength > FvSize) {
|
||||
DEBUG ((DEBUG_ERROR, "GetFfsByName - FvSize: 0x%08x, MaxSize - 0x%08x\n", (UINTN)FvHeader->FvLength, (UINTN)FvSize));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
FvSize = (UINTN)FvHeader->FvLength;
|
||||
|
||||
//
|
||||
@ -199,6 +201,7 @@ GetFfsByName (
|
||||
} else {
|
||||
FfsHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)FvHeader + FvHeader->HeaderLength);
|
||||
}
|
||||
|
||||
FfsHeader = (EFI_FFS_FILE_HEADER *)((UINTN)FvHeader + ALIGN_VALUE ((UINTN)FfsHeader - (UINTN)FvHeader, 8));
|
||||
|
||||
while ((UINTN)FfsHeader < (UINTN)FvHeader + FvSize - 1) {
|
||||
@ -207,6 +210,7 @@ GetFfsByName (
|
||||
if (TestLength > sizeof (EFI_FFS_FILE_HEADER)) {
|
||||
TestLength = sizeof (EFI_FFS_FILE_HEADER);
|
||||
}
|
||||
|
||||
if (IsBufferErased (1, FfsHeader, TestLength)) {
|
||||
break;
|
||||
}
|
||||
@ -218,7 +222,8 @@ GetFfsByName (
|
||||
}
|
||||
|
||||
if (CompareGuid (FileName, &FfsHeader->Name) &&
|
||||
((Type == EFI_FV_FILETYPE_ALL) || (FfsHeader->Type == Type))) {
|
||||
((Type == EFI_FV_FILETYPE_ALL) || (FfsHeader->Type == Type)))
|
||||
{
|
||||
*OutFfsBuffer = FfsHeader;
|
||||
*OutFfsBufferSize = FfsSize;
|
||||
return TRUE;
|
||||
@ -244,6 +249,7 @@ GetFfsByName (
|
||||
if (!FvFound) {
|
||||
DEBUG ((DEBUG_ERROR, "GetFfsByName - NO FV Found\n"));
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -283,6 +289,7 @@ ExtractDriverFvImage (
|
||||
} else {
|
||||
FileHeaderSize = sizeof (EFI_FFS_FILE_HEADER);
|
||||
}
|
||||
|
||||
*DriverFvImage = (UINT8 *)*DriverFvImage + FileHeaderSize;
|
||||
*DriverFvImageSize = *DriverFvImageSize - FileHeaderSize;
|
||||
|
||||
@ -325,6 +332,7 @@ ExtractConfigImage (
|
||||
} else {
|
||||
FileHeaderSize = sizeof (EFI_FFS_FILE_HEADER);
|
||||
}
|
||||
|
||||
*ConfigImage = (UINT8 *)*ConfigImage + FileHeaderSize;
|
||||
*ConfigImageSize = *ConfigImageSize - FileHeaderSize;
|
||||
|
||||
@ -373,22 +381,27 @@ ExtractAuthenticatedImage (
|
||||
DEBUG ((DEBUG_ERROR, "ExtractAuthenticatedImage - ImageSize too small\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ImageAuth->AuthInfo.Hdr.dwLength <= OFFSET_OF (WIN_CERTIFICATE_UEFI_GUID, CertData)) {
|
||||
DEBUG ((DEBUG_ERROR, "ExtractAuthenticatedImage - dwLength too small\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((UINTN)ImageAuth->AuthInfo.Hdr.dwLength > MAX_UINTN - sizeof (UINT64)) {
|
||||
DEBUG ((DEBUG_ERROR, "ExtractAuthenticatedImage - dwLength too big\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ImageSize <= sizeof (ImageAuth->MonotonicCount) + ImageAuth->AuthInfo.Hdr.dwLength) {
|
||||
DEBUG ((DEBUG_ERROR, "ExtractAuthenticatedImage - ImageSize too small\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ImageAuth->AuthInfo.Hdr.wRevision != 0x0200) {
|
||||
DEBUG ((DEBUG_ERROR, "ExtractAuthenticatedImage - wRevision: 0x%02x, expect - 0x%02x\n", (UINTN)ImageAuth->AuthInfo.Hdr.wRevision, (UINTN)0x0200));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ImageAuth->AuthInfo.Hdr.wCertificateType != WIN_CERT_TYPE_EFI_GUID) {
|
||||
DEBUG ((DEBUG_ERROR, "ExtractAuthenticatedImage - wCertificateType: 0x%02x, expect - 0x%02x\n", (UINTN)ImageAuth->AuthInfo.Hdr.wCertificateType, (UINTN)WIN_CERT_TYPE_EFI_GUID));
|
||||
return FALSE;
|
||||
@ -406,6 +419,7 @@ ExtractAuthenticatedImage (
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ASSERT (PublicKeyData != NULL);
|
||||
ASSERT (PublicKeyDataLength != 0);
|
||||
|
||||
@ -435,6 +449,7 @@ ExtractAuthenticatedImage (
|
||||
*LastAttemptStatus = LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
@ -442,9 +457,11 @@ ExtractAuthenticatedImage (
|
||||
if (AuthenticatedImage != NULL) {
|
||||
*AuthenticatedImage = (UINT8 *)ImageAuth + ImageAuth->AuthInfo.Hdr.dwLength + sizeof (ImageAuth->MonotonicCount);
|
||||
}
|
||||
|
||||
if (AuthenticatedImageSize != NULL) {
|
||||
*AuthenticatedImageSize = ImageSize - ImageAuth->AuthInfo.Hdr.dwLength - sizeof (ImageAuth->MonotonicCount);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -479,11 +496,13 @@ ExtractSystemFirmwareImageFmpInfo (
|
||||
if (!Result) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (IS_FFS_FILE2 (*ImageFmpInfo)) {
|
||||
FileHeaderSize = sizeof (EFI_FFS_FILE_HEADER2);
|
||||
} else {
|
||||
FileHeaderSize = sizeof (EFI_FFS_FILE_HEADER);
|
||||
}
|
||||
|
||||
*ImageFmpInfo = (VOID *)((UINT8 *)*ImageFmpInfo + FileHeaderSize);
|
||||
*ImageFmpInfoSize = *ImageFmpInfoSize - FileHeaderSize;
|
||||
|
||||
@ -491,11 +510,13 @@ ExtractSystemFirmwareImageFmpInfo (
|
||||
if (!Result) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (IS_SECTION2 (*ImageFmpInfo)) {
|
||||
SectionHeaderSize = sizeof (EFI_RAW_SECTION2);
|
||||
} else {
|
||||
SectionHeaderSize = sizeof (EFI_RAW_SECTION);
|
||||
}
|
||||
|
||||
*ImageFmpInfo = (VOID *)((UINT8 *)*ImageFmpInfo + SectionHeaderSize);
|
||||
*ImageFmpInfoSize = *ImageFmpInfoSize - SectionHeaderSize;
|
||||
|
||||
@ -536,11 +557,13 @@ ExtractSystemFirmwareImage (
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (IS_FFS_FILE2 (*SystemFirmwareImage)) {
|
||||
FileHeaderSize = sizeof (EFI_FFS_FILE_HEADER2);
|
||||
} else {
|
||||
FileHeaderSize = sizeof (EFI_FFS_FILE_HEADER);
|
||||
}
|
||||
|
||||
*SystemFirmwareImage = (UINT8 *)*SystemFirmwareImage + FileHeaderSize;
|
||||
*SystemFirmwareImageSize = *SystemFirmwareImageSize - FileHeaderSize;
|
||||
|
||||
@ -610,6 +633,7 @@ CapsuleAuthenticateSystemFirmware (
|
||||
DEBUG ((DEBUG_INFO, "ExtractSystemFirmwareImage - fail\n"));
|
||||
return EFI_SECURITY_VIOLATION;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "SystemFirmwareImage - 0x%x - 0x%x\n", SystemFirmwareImage, SystemFirmwareImageSize));
|
||||
|
||||
Result = ExtractSystemFirmwareImageFmpInfo (SystemFirmwareImage, SystemFirmwareImageSize, &ImageFmpInfo, &ImageFmpInfoSize);
|
||||
@ -668,7 +692,8 @@ EdkiiSystemCapsuleLibPcdCallBack (
|
||||
)
|
||||
{
|
||||
if (CompareGuid (CallBackGuid, &gEfiSignedCapsulePkgTokenSpaceGuid) &&
|
||||
CallBackToken == PcdToken (PcdEdkiiSystemFirmwareImageDescriptor)) {
|
||||
(CallBackToken == PcdToken (PcdEdkiiSystemFirmwareImageDescriptor)))
|
||||
{
|
||||
mImageFmpInfoSize = TokenDataSize;
|
||||
mImageFmpInfo = AllocateCopyPool (mImageFmpInfoSize, TokenData);
|
||||
ASSERT (mImageFmpInfo != NULL);
|
||||
@ -683,7 +708,8 @@ EdkiiSystemCapsuleLibPcdCallBack (
|
||||
}
|
||||
|
||||
if (CompareGuid (CallBackGuid, &gEfiSignedCapsulePkgTokenSpaceGuid) &&
|
||||
CallBackToken == PcdToken (PcdEdkiiSystemFirmwareFileGuid)) {
|
||||
(CallBackToken == PcdToken (PcdEdkiiSystemFirmwareFileGuid)))
|
||||
{
|
||||
CopyGuid (&mEdkiiSystemFirmwareFileGuid, TokenData);
|
||||
//
|
||||
// Cancel Callback after get the real set value
|
||||
@ -712,8 +738,9 @@ EdkiiSystemCapsuleLibConstructor (
|
||||
//
|
||||
// Verify Firmware Image Descriptor first
|
||||
//
|
||||
if (mImageFmpInfoSize < sizeof (EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR) ||
|
||||
mImageFmpInfo->Signature != EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR_SIGNATURE) {
|
||||
if ((mImageFmpInfoSize < sizeof (EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR)) ||
|
||||
(mImageFmpInfo->Signature != EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR_SIGNATURE))
|
||||
{
|
||||
//
|
||||
// SystemFirmwareImageDescriptor is not set.
|
||||
// Register PCD set callback to hook PCD value set.
|
||||
@ -741,5 +768,6 @@ EdkiiSystemCapsuleLibConstructor (
|
||||
EdkiiSystemCapsuleLibPcdCallBack
|
||||
);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -78,17 +78,20 @@ IsValidDigitalChar (
|
||||
IN BOOLEAN IncludeHex
|
||||
)
|
||||
{
|
||||
if (DigitalChar >= '0' && DigitalChar <= '9') {
|
||||
if ((DigitalChar >= '0') && (DigitalChar <= '9')) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (IncludeHex) {
|
||||
if (DigitalChar >= 'a' && DigitalChar <= 'f') {
|
||||
if ((DigitalChar >= 'a') && (DigitalChar <= 'f')) {
|
||||
return TRUE;
|
||||
}
|
||||
if (DigitalChar >= 'A' && DigitalChar <= 'F') {
|
||||
|
||||
if ((DigitalChar >= 'A') && (DigitalChar <= 'F')) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -105,18 +108,22 @@ IsValidNameChar (
|
||||
IN CHAR8 NameChar
|
||||
)
|
||||
{
|
||||
if (NameChar >= 'a' && NameChar <= 'z') {
|
||||
if ((NameChar >= 'a') && (NameChar <= 'z')) {
|
||||
return TRUE;
|
||||
}
|
||||
if (NameChar >= 'A' && NameChar <= 'Z') {
|
||||
|
||||
if ((NameChar >= 'A') && (NameChar <= 'Z')) {
|
||||
return TRUE;
|
||||
}
|
||||
if (NameChar >= '0' && NameChar <= '9') {
|
||||
|
||||
if ((NameChar >= '0') && (NameChar <= '9')) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (NameChar == '_') {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -138,11 +145,13 @@ IsValidDigital (
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
for (Index = 0; Index < Length; Index++) {
|
||||
if (!IsValidDigitalChar (Digital[Index], IncludeHex)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -182,12 +191,15 @@ IsValidHexString (
|
||||
if (Length <= 2) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (Hex[0] != '0') {
|
||||
return FALSE;
|
||||
}
|
||||
if (Hex[1] != 'x' && Hex[1] != 'X') {
|
||||
|
||||
if ((Hex[1] != 'x') && (Hex[1] != 'X')) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return IsValidDigital (&Hex[2], Length - 2, TRUE);
|
||||
}
|
||||
|
||||
@ -207,11 +219,13 @@ IsValidName (
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
|
||||
for (Index = 0; Index < Length; Index++) {
|
||||
if (!IsValidNameChar (Name[Index])) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -233,33 +247,43 @@ IsValidGuid (
|
||||
if (Length != sizeof ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") - 1) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!IS_HYPHEN (Value[8])) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!IS_HYPHEN (Value[13])) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!IS_HYPHEN (Value[18])) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!IS_HYPHEN (Value[23])) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!IsValidDigital (&Value[0], 8, TRUE)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!IsValidDigital (&Value[9], 4, TRUE)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!IsValidDigital (&Value[14], 4, TRUE)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!IsValidDigital (&Value[19], 4, TRUE)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!IsValidDigital (&Value[24], 12, TRUE)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -281,6 +305,7 @@ IsValidValue (
|
||||
if (IsValidName (Value, Length) || IsValidGuid (Value, Length)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -311,9 +336,11 @@ DumpIniSection (
|
||||
if (PtrSection->PtrSection != NULL) {
|
||||
DEBUG ((DEBUG_VERBOSE, "Section - %a\n", PtrSection->PtrSection));
|
||||
}
|
||||
|
||||
if (PtrSection->PtrEntry != NULL) {
|
||||
DEBUG ((DEBUG_VERBOSE, " Entry - %a\n", PtrSection->PtrEntry));
|
||||
}
|
||||
|
||||
if (PtrSection->PtrValue != NULL) {
|
||||
DEBUG ((DEBUG_VERBOSE, " Value - %a\n", PtrSection->PtrValue));
|
||||
}
|
||||
@ -352,9 +379,10 @@ ProfileGetLine (
|
||||
// 0x0D indicates a line break. Otherwise there is no line break
|
||||
//
|
||||
while ((UINTN)PtrBuf < PtrEnd) {
|
||||
if (*PtrBuf == 0x0D || *PtrBuf == 0x0A) {
|
||||
if ((*PtrBuf == 0x0D) || (*PtrBuf == 0x0A)) {
|
||||
break;
|
||||
}
|
||||
|
||||
PtrBuf++;
|
||||
}
|
||||
|
||||
@ -415,9 +443,11 @@ ProfileTrim (
|
||||
PtrBuf = (UINT8 *)((UINTN)Buffer + Length - 1);
|
||||
while (PtrBuf >= Buffer) {
|
||||
if ( (*PtrBuf != 0x0D) && (*PtrBuf != 0x0A)
|
||||
&& (*PtrBuf != 0x20) && (*PtrBuf != 0x09)) {
|
||||
&& (*PtrBuf != 0x20) && (*PtrBuf != 0x09))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
PtrBuf--;
|
||||
}
|
||||
|
||||
@ -438,9 +468,11 @@ ProfileTrim (
|
||||
//
|
||||
while (PtrBuf <= PtrEnd) {
|
||||
if ( (*PtrBuf != 0x0D) && (*PtrBuf != 0x0A)
|
||||
&& (*PtrBuf != 0x20) && (*PtrBuf != 0x09)) {
|
||||
&& (*PtrBuf != 0x20) && (*PtrBuf != 0x09))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
PtrBuf++;
|
||||
}
|
||||
|
||||
@ -504,6 +536,7 @@ ProfileGetComments (
|
||||
FreePool (CommentItem);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
CopyMem (CommentItem->PtrComment, Buffer, BufferSize);
|
||||
*(CommentItem->PtrComment + BufferSize) = '\0';
|
||||
|
||||
@ -543,14 +576,17 @@ ProfileGetSection (
|
||||
if (*PtrBuf == ']') {
|
||||
break;
|
||||
}
|
||||
|
||||
PtrBuf++;
|
||||
}
|
||||
|
||||
if (PtrBuf > PtrEnd) {
|
||||
//
|
||||
// Not found. Invalid line
|
||||
//
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (PtrBuf <= Buffer + 1) {
|
||||
// Empty name
|
||||
return EFI_NOT_FOUND;
|
||||
@ -643,14 +679,17 @@ ProfileGetEntry (
|
||||
if (*PtrBuf == '=') {
|
||||
break;
|
||||
}
|
||||
|
||||
PtrBuf++;
|
||||
}
|
||||
|
||||
if (PtrBuf > PtrEnd) {
|
||||
//
|
||||
// Not found. Invalid line
|
||||
//
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (PtrBuf <= Buffer) {
|
||||
// Empty name
|
||||
return EFI_NOT_FOUND;
|
||||
@ -682,6 +721,7 @@ ProfileGetEntry (
|
||||
if (*SectionHead == NULL) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
PtrSection = *SectionHead;
|
||||
|
||||
SectionItem = AllocatePool (sizeof (SECTION_ITEM));
|
||||
@ -703,6 +743,7 @@ ProfileGetEntry (
|
||||
if (SectionItem->PtrSection == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
CopyMem (SectionItem->PtrSection, PtrSection->PtrSection, PtrSection->SecNameLen + 1);
|
||||
|
||||
//
|
||||
@ -713,6 +754,7 @@ ProfileGetEntry (
|
||||
FreePool (SectionItem->PtrSection);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
CopyMem (SectionItem->PtrEntry, Buffer, Length);
|
||||
*(SectionItem->PtrEntry + Length) = '\0';
|
||||
|
||||
@ -722,17 +764,20 @@ ProfileGetEntry (
|
||||
PtrBuf = PtrBuf + 1;
|
||||
Buffer = PtrBuf;
|
||||
while (PtrBuf <= PtrEnd) {
|
||||
if (*PtrBuf == '#' || *PtrBuf == ';') {
|
||||
if ((*PtrBuf == '#') || (*PtrBuf == ';')) {
|
||||
break;
|
||||
}
|
||||
|
||||
PtrBuf++;
|
||||
}
|
||||
|
||||
if (PtrBuf <= Buffer) {
|
||||
// Empty name
|
||||
FreePool (SectionItem->PtrEntry);
|
||||
FreePool (SectionItem->PtrSection);
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
Length = PtrBuf - Buffer;
|
||||
ProfileTrim (
|
||||
Buffer,
|
||||
@ -763,6 +808,7 @@ ProfileGetEntry (
|
||||
FreePool (SectionItem->PtrSection);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
CopyMem (SectionItem->PtrValue, Buffer, Length);
|
||||
*(SectionItem->PtrValue + Length) = '\0';
|
||||
|
||||
@ -791,12 +837,15 @@ FreeAllList (
|
||||
if (PtrSection->PtrEntry != NULL) {
|
||||
FreePool (PtrSection->PtrEntry);
|
||||
}
|
||||
|
||||
if (PtrSection->PtrSection != NULL) {
|
||||
FreePool (PtrSection->PtrSection);
|
||||
}
|
||||
|
||||
if (PtrSection->PtrValue != NULL) {
|
||||
FreePool (PtrSection->PtrValue);
|
||||
}
|
||||
|
||||
FreePool (PtrSection);
|
||||
}
|
||||
|
||||
@ -806,6 +855,7 @@ FreeAllList (
|
||||
if (PtrComment->PtrComment != NULL) {
|
||||
FreePool (PtrComment->PtrComment);
|
||||
}
|
||||
|
||||
FreePool (PtrComment);
|
||||
}
|
||||
|
||||
@ -842,6 +892,7 @@ UpdateGetProfileString (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Section = Section->PtrNext;
|
||||
}
|
||||
|
||||
@ -924,6 +975,7 @@ PreProcessDataFile (
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
break;
|
||||
}
|
||||
|
||||
SourceLength = LineLength;
|
||||
Status = ProfileGetLine (
|
||||
(UINT8 *)Source,
|
||||
@ -934,11 +986,13 @@ PreProcessDataFile (
|
||||
if (EFI_ERROR (Status)) {
|
||||
break;
|
||||
}
|
||||
|
||||
MaxLineLength = LineLength;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CurrentPtr = (CHAR8 *)((UINTN)CurrentPtr + LineLength);
|
||||
|
||||
//
|
||||
@ -956,7 +1010,7 @@ PreProcessDataFile (
|
||||
continue;
|
||||
}
|
||||
|
||||
if (PtrLine[0] == '#' || PtrLine[0] == ';') {
|
||||
if ((PtrLine[0] == '#') || (PtrLine[0] == ';')) {
|
||||
Status = ProfileGetComments (
|
||||
(UINT8 *)PtrLine,
|
||||
LineLength,
|
||||
@ -1009,7 +1063,7 @@ OpenIniFile (
|
||||
EFI_STATUS Status;
|
||||
INI_PARSING_LIB_CONTEXT *IniContext;
|
||||
|
||||
if (DataBuffer == NULL || BufferSize == 0) {
|
||||
if ((DataBuffer == NULL) || (BufferSize == 0)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1031,6 +1085,7 @@ OpenIniFile (
|
||||
FreePool (IniContext);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DEBUG_CODE_BEGIN ();
|
||||
DumpIniSection (IniContext);
|
||||
DEBUG_CODE_END ();
|
||||
@ -1060,7 +1115,7 @@ GetStringFromDataFile(
|
||||
INI_PARSING_LIB_CONTEXT *IniContext;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (Context == NULL || SectionName == NULL || EntryName == NULL || EntryValue == NULL) {
|
||||
if ((Context == NULL) || (SectionName == NULL) || (EntryName == NULL) || (EntryValue == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -1100,7 +1155,7 @@ GetGuidFromDataFile (
|
||||
EFI_STATUS Status;
|
||||
RETURN_STATUS RStatus;
|
||||
|
||||
if (Context == NULL || SectionName == NULL || EntryName == NULL || Guid == NULL) {
|
||||
if ((Context == NULL) || (SectionName == NULL) || (EntryName == NULL) || (Guid == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -1113,11 +1168,13 @@ GetGuidFromDataFile (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
ASSERT (Value != NULL);
|
||||
RStatus = AsciiStrToGuid (Value, Guid);
|
||||
if (RETURN_ERROR (RStatus) || (Value[GUID_STRING_LENGTH] != '\0')) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1144,7 +1201,7 @@ GetDecimalUintnFromDataFile (
|
||||
CHAR8 *Value;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (Context == NULL || SectionName == NULL || EntryName == NULL || Data == NULL) {
|
||||
if ((Context == NULL) || (SectionName == NULL) || (EntryName == NULL) || (Data == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -1157,10 +1214,12 @@ GetDecimalUintnFromDataFile (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
ASSERT (Value != NULL);
|
||||
if (!IsValidDecimalString (Value, AsciiStrLen (Value))) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
*Data = AsciiStrDecimalToUintn (Value);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@ -1188,7 +1247,7 @@ GetHexUintnFromDataFile (
|
||||
CHAR8 *Value;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (Context == NULL || SectionName == NULL || EntryName == NULL || Data == NULL) {
|
||||
if ((Context == NULL) || (SectionName == NULL) || (EntryName == NULL) || (Data == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -1201,10 +1260,12 @@ GetHexUintnFromDataFile (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
ASSERT (Value != NULL);
|
||||
if (!IsValidHexString (Value, AsciiStrLen (Value))) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
*Data = AsciiStrHexToUintn (Value);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@ -1232,7 +1293,7 @@ GetHexUint64FromDataFile (
|
||||
CHAR8 *Value;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (Context == NULL || SectionName == NULL || EntryName == NULL || Data == NULL) {
|
||||
if ((Context == NULL) || (SectionName == NULL) || (EntryName == NULL) || (Data == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -1245,10 +1306,12 @@ GetHexUint64FromDataFile (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
ASSERT (Value != NULL);
|
||||
if (!IsValidHexString (Value, AsciiStrLen (Value))) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
*Data = AsciiStrHexToUint64 (Value);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -59,6 +59,7 @@ PerformFlashWriteWithProgress (
|
||||
if (FlashAddressType == FlashAddressTypeRelativeAddress) {
|
||||
FlashAddress = FlashAddress + mInternalFdAddress;
|
||||
}
|
||||
|
||||
CopyMem ((VOID *)(UINTN)(FlashAddress), Buffer, Length);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -133,6 +133,7 @@ ParseRecoveryDataFile (
|
||||
DEBUG ((DEBUG_ERROR, "[%d] Length not found\n", Index));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
(*RecoveryArray)[Index].Length = Num;
|
||||
|
||||
//
|
||||
@ -149,6 +150,7 @@ ParseRecoveryDataFile (
|
||||
DEBUG ((DEBUG_ERROR, "[%d] ImageOffset not found\n", Index));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
(*RecoveryArray)[Index].ImageOffset = Num;
|
||||
}
|
||||
|
||||
@ -159,4 +161,3 @@ ParseRecoveryDataFile (
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -213,9 +213,11 @@ IsValidCapsuleHeader (
|
||||
if (CapsuleHeader->CapsuleImageSize != CapsuleSize) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (CapsuleHeader->HeaderSize >= CapsuleHeader->CapsuleImageSize) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -276,6 +278,7 @@ ValidateFmpCapsule (
|
||||
DEBUG ((DEBUG_ERROR, "FmpCapsuleHeader->Version(0x%x) != EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER_INIT_VERSION\n", FmpCapsuleHeader->Version));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
ItemOffsetList = (UINT64 *)(FmpCapsuleHeader + 1);
|
||||
|
||||
// No overflow
|
||||
@ -285,6 +288,7 @@ ValidateFmpCapsule (
|
||||
DEBUG ((DEBUG_ERROR, "ItemNum(0x%x) too big\n", ItemNum));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
FmpCapsuleHeaderSize = sizeof (EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER) + sizeof (UINT64)*ItemNum;
|
||||
|
||||
// Check ItemOffsetList
|
||||
@ -293,10 +297,12 @@ ValidateFmpCapsule (
|
||||
DEBUG ((DEBUG_ERROR, "ItemOffsetList[%d](0x%lx) >= FmpCapsuleSize(0x%x)\n", Index, ItemOffsetList[Index], FmpCapsuleSize));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (ItemOffsetList[Index] < FmpCapsuleHeaderSize) {
|
||||
DEBUG ((DEBUG_ERROR, "ItemOffsetList[%d](0x%lx) < FmpCapsuleHeaderSize(0x%x)\n", Index, ItemOffsetList[Index], FmpCapsuleHeaderSize));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// All the address in ItemOffsetList must be stored in ascending order
|
||||
//
|
||||
@ -316,18 +322,22 @@ ValidateFmpCapsule (
|
||||
} else {
|
||||
EndOfPayload = (UINT8 *)(UINTN)ItemOffsetList[Index+1];
|
||||
}
|
||||
|
||||
FmpImageSize = (UINTN)EndOfPayload - ItemOffsetList[Index];
|
||||
|
||||
if (FmpImageSize < OFFSET_OF (EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER, UpdateHardwareInstance)) {
|
||||
DEBUG ((DEBUG_ERROR, "FmpImageSize(0x%lx) < EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER\n", FmpImageSize));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
FmpImageHeaderSize = sizeof (EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER);
|
||||
if ((ImageHeader->Version > EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION) ||
|
||||
(ImageHeader->Version < 1)) {
|
||||
(ImageHeader->Version < 1))
|
||||
{
|
||||
DEBUG ((DEBUG_ERROR, "ImageHeader->Version(0x%x) Unknown\n", ImageHeader->Version));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
///
|
||||
/// Current Init ImageHeader version is 3. UpdateHardwareInstance field was added in version 2
|
||||
/// and ImageCapsuleSupport field was added in version 3
|
||||
@ -354,6 +364,7 @@ ValidateFmpCapsule (
|
||||
DEBUG ((DEBUG_ERROR, "EndOfPayload(0x%x) mismatch, EndOfCapsule(0x%x)\n", EndOfPayload, EndOfCapsule));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@ -431,6 +442,7 @@ CreateHobForRecoveryCapsule (
|
||||
DEBUG ((DEBUG_ERROR, "CreateHobForRecoveryCapsule (Fv Signature Error)\n"));
|
||||
return EFI_VOLUME_CORRUPTED;
|
||||
}
|
||||
|
||||
//
|
||||
// If EFI_FVB2_WEAK_ALIGNMENT is set in the volume header then the first byte of the volume
|
||||
// can be aligned on any power-of-two boundary. A weakly aligned volume can not be moved from
|
||||
@ -447,6 +459,7 @@ CreateHobForRecoveryCapsule (
|
||||
if (FvAlignment < 8) {
|
||||
FvAlignment = 8;
|
||||
}
|
||||
|
||||
//
|
||||
// Allocate the aligned buffer for the FvImage.
|
||||
//
|
||||
@ -458,6 +471,7 @@ CreateHobForRecoveryCapsule (
|
||||
DEBUG ((DEBUG_ERROR, "CreateHobForRecoveryCapsule (Not enough resource to allocate 0x%lx bytes)\n", FvLength));
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
CopyMem (NewFvBuffer, FvHeader, (UINTN)FvLength);
|
||||
FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)NewFvBuffer;
|
||||
}
|
||||
@ -522,6 +536,7 @@ RecoverImage (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "ConfigHeader.NumOfRecovery - 0x%x\n", ConfigHeader.NumOfRecovery));
|
||||
DEBUG ((DEBUG_INFO, "PcdEdkiiSystemFirmwareFileGuid - %g\n", PcdGetPtr (PcdEdkiiSystemFirmwareFileGuid)));
|
||||
|
||||
@ -762,6 +777,7 @@ LoadRecoveryCapsule (
|
||||
if (EFI_ERROR (Status)) {
|
||||
break;
|
||||
}
|
||||
|
||||
NumberRecoveryCapsules = 0;
|
||||
Status = DeviceRecoveryPpi->GetNumberRecoveryCapsules (
|
||||
(EFI_PEI_SERVICES **)PeiServices,
|
||||
@ -772,6 +788,7 @@ LoadRecoveryCapsule (
|
||||
if (EFI_ERROR (Status)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (CapsuleInstance = 1; CapsuleInstance <= NumberRecoveryCapsules; CapsuleInstance++) {
|
||||
CapsuleSize = 0;
|
||||
Status = DeviceRecoveryPpi->GetRecoveryCapsuleInfo (
|
||||
@ -791,6 +808,7 @@ LoadRecoveryCapsule (
|
||||
DEBUG ((DEBUG_ERROR, "LoadRecoveryCapsule - AllocatePool fail\n"));
|
||||
continue;
|
||||
}
|
||||
|
||||
Status = DeviceRecoveryPpi->LoadRecoveryCapsule (
|
||||
(EFI_PEI_SERVICES **)PeiServices,
|
||||
DeviceRecoveryPpi,
|
||||
@ -802,6 +820,7 @@ LoadRecoveryCapsule (
|
||||
FreePages (CapsuleBuffer, EFI_SIZE_TO_PAGES (CapsuleSize));
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// good, load capsule buffer
|
||||
//
|
||||
|
@ -35,4 +35,3 @@ typedef struct {
|
||||
} RECOVERY_CONFIG_DATA;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -118,6 +118,7 @@ ParseUpdateDataFile (
|
||||
DEBUG ((DEBUG_ERROR, "[%d] FirmwareType not found\n", Index));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
(*UpdateArray)[Index].FirmwareType = (PLATFORM_FIRMWARE_TYPE)Num;
|
||||
|
||||
//
|
||||
@ -134,6 +135,7 @@ ParseUpdateDataFile (
|
||||
DEBUG ((DEBUG_ERROR, "[%d] AddressType not found\n", Index));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
(*UpdateArray)[Index].AddressType = (FLASH_ADDRESS_TYPE)Num;
|
||||
|
||||
//
|
||||
@ -150,6 +152,7 @@ ParseUpdateDataFile (
|
||||
DEBUG ((DEBUG_ERROR, "[%d] BaseAddress not found\n", Index));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
(*UpdateArray)[Index].BaseAddress = (EFI_PHYSICAL_ADDRESS)Num64;
|
||||
|
||||
//
|
||||
@ -183,6 +186,7 @@ ParseUpdateDataFile (
|
||||
DEBUG ((DEBUG_ERROR, "[%d] Length not found\n", Index));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
(*UpdateArray)[Index].Length = (UINTN)Num;
|
||||
|
||||
//
|
||||
@ -199,6 +203,7 @@ ParseUpdateDataFile (
|
||||
DEBUG ((DEBUG_ERROR, "[%d] ImageOffset not found\n", Index));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
(*UpdateArray)[Index].ImageOffset = (UINTN)Num;
|
||||
}
|
||||
|
||||
@ -209,4 +214,3 @@ ParseUpdateDataFile (
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -85,12 +85,13 @@ FmpGetImageInfo (
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
if (ImageInfo == NULL ||
|
||||
DescriptorVersion == NULL ||
|
||||
DescriptorCount == NULL ||
|
||||
DescriptorSize == NULL ||
|
||||
PackageVersion == NULL ||
|
||||
PackageVersionName == NULL) {
|
||||
if ((ImageInfo == NULL) ||
|
||||
(DescriptorVersion == NULL) ||
|
||||
(DescriptorCount == NULL) ||
|
||||
(DescriptorSize == NULL) ||
|
||||
(PackageVersion == NULL) ||
|
||||
(PackageVersionName == NULL))
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -111,12 +112,14 @@ FmpGetImageInfo (
|
||||
} else {
|
||||
ImageInfo->ImageIdName = NULL;
|
||||
}
|
||||
|
||||
ImageInfo->Version = ImageDescriptor->Version;
|
||||
if (ImageDescriptor->VersionNameStringOffset != 0) {
|
||||
ImageInfo->VersionName = (CHAR16 *)((UINTN)ImageDescriptor + ImageDescriptor->VersionNameStringOffset);
|
||||
} else {
|
||||
ImageInfo->VersionName = NULL;
|
||||
}
|
||||
|
||||
ImageInfo->Size = (UINTN)ImageDescriptor->Size;
|
||||
ImageInfo->AttributesSupported = ImageDescriptor->AttributesSupported;
|
||||
ImageInfo->AttributesSetting = ImageDescriptor->AttributesSetting;
|
||||
@ -336,5 +339,3 @@ InitializePrivateData (
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
@ -80,7 +80,6 @@ typedef struct _SYSTEM_FMP_PRIVATE_DATA SYSTEM_FMP_PRIVATE_DATA;
|
||||
SYSTEM_FMP_PRIVATE_DATA_SIGNATURE \
|
||||
)
|
||||
|
||||
|
||||
//
|
||||
// Update data
|
||||
//
|
||||
@ -124,7 +123,6 @@ typedef struct {
|
||||
// UINT8 Data[AbortReasonMaxSize + ImageSize];
|
||||
} SYSTEM_FIRMWARE_UPDATE_COMMUNICATION_SET_IMAGE;
|
||||
|
||||
|
||||
/**
|
||||
Returns information about the current firmware image(s) of the device.
|
||||
|
||||
@ -398,4 +396,3 @@ extern EFI_GUID mCurrentImageTypeId;
|
||||
extern EFI_GUID gSystemFmpProtocolGuid;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -159,14 +159,14 @@ FmpSetImage (
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS VarStatus;
|
||||
|
||||
if (Image == NULL || ImageSize == 0 || AbortReason == NULL) {
|
||||
if ((Image == NULL) || (ImageSize == 0) || (AbortReason == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
SystemFmpPrivate = SYSTEM_FMP_PRIVATE_DATA_FROM_FMP (This);
|
||||
*AbortReason = NULL;
|
||||
|
||||
if (ImageIndex == 0 || ImageIndex > SystemFmpPrivate->DescriptorCount) {
|
||||
if ((ImageIndex == 0) || (ImageIndex > SystemFmpPrivate->DescriptorCount)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
@ -81,6 +81,7 @@ PerformUpdate (
|
||||
if (Progress != NULL) {
|
||||
Progress (StartPercentage);
|
||||
}
|
||||
|
||||
Status = PerformFlashWriteWithProgress (
|
||||
ConfigData->FirmwareType,
|
||||
ConfigData->BaseAddress,
|
||||
@ -94,6 +95,7 @@ PerformUpdate (
|
||||
if (Progress != NULL) {
|
||||
Progress (EndPercentage);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
*LastAttemptStatus = LAST_ATTEMPT_STATUS_SUCCESS;
|
||||
if (ConfigData->FirmwareType == PlatformFirmwareTypeNvRam) {
|
||||
@ -102,6 +104,7 @@ PerformUpdate (
|
||||
} else {
|
||||
*LastAttemptStatus = LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -150,6 +153,7 @@ UpdateImage (
|
||||
if (Progress != NULL) {
|
||||
Progress (StartPercentage);
|
||||
}
|
||||
|
||||
Status = PerformFlashWriteWithProgress (
|
||||
PlatformFirmwareTypeNvRam,
|
||||
0,
|
||||
@ -163,12 +167,14 @@ UpdateImage (
|
||||
if (Progress != NULL) {
|
||||
Progress (EndPercentage);
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
*LastAttemptStatus = LAST_ATTEMPT_STATUS_SUCCESS;
|
||||
mNvRamUpdated = TRUE;
|
||||
} else {
|
||||
*LastAttemptStatus = LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -186,6 +192,7 @@ UpdateImage (
|
||||
*LastAttemptStatus = LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL;
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "ConfigHeader.NumOfUpdates - 0x%x\n", ConfigHeader.NumOfUpdates));
|
||||
DEBUG ((DEBUG_INFO, "PcdEdkiiSystemFirmwareFileGuid - %g\n", PcdGetPtr (PcdEdkiiSystemFirmwareFileGuid)));
|
||||
|
||||
@ -474,14 +481,14 @@ FmpSetImage (
|
||||
EFI_STATUS VarStatus;
|
||||
SYSTEM_FMP_PRIVATE_DATA *SystemFmpPrivate;
|
||||
|
||||
if (Image == NULL || ImageSize == 0 || AbortReason == NULL) {
|
||||
if ((Image == NULL) || (ImageSize == 0) || (AbortReason == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
SystemFmpPrivate = SYSTEM_FMP_PRIVATE_DATA_FROM_FMP (This);
|
||||
*AbortReason = NULL;
|
||||
|
||||
if (ImageIndex == 0 || ImageIndex > SystemFmpPrivate->DescriptorCount) {
|
||||
if ((ImageIndex == 0) || (ImageIndex > SystemFmpPrivate->DescriptorCount)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -621,6 +628,7 @@ GetFmpImageDescriptors (
|
||||
if (FmpImageInfoBuf != NULL) {
|
||||
FreePool (FmpImageInfoBuf);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -695,14 +703,17 @@ FindMatchingFmpHandles (
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (MatchFound) {
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Increment the buffer pointer ahead by the size of the descriptor
|
||||
//
|
||||
FmpImageInfoBuf = (EFI_FIRMWARE_IMAGE_DESCRIPTOR *)(((UINT8 *)FmpImageInfoBuf) + DescriptorSize);
|
||||
}
|
||||
|
||||
if (MatchFound) {
|
||||
HandleBuffer[*HandleCount] = HandleBuffer[Index];
|
||||
(*HandleCount)++;
|
||||
@ -719,6 +730,7 @@ FindMatchingFmpHandles (
|
||||
FreePool (HandleBuffer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return HandleBuffer;
|
||||
}
|
||||
|
||||
@ -760,6 +772,7 @@ UninstallMatchingSystemFmpProtocols (
|
||||
if (EFI_ERROR (Status)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "SystemFirmwareUpdateDxe: Uninstall SystemFmp produced by another capsule\n"));
|
||||
Status = gBS->UninstallProtocolInterface (
|
||||
HandleBuffer[Index],
|
||||
@ -772,6 +785,7 @@ UninstallMatchingSystemFmpProtocols (
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
if (HandleBuffer != NULL) {
|
||||
FreePool (HandleBuffer);
|
||||
}
|
||||
|
Reference in New Issue
Block a user