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