X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=FmpDevicePkg%2FFmpDxe%2FFmpDxe.c;h=fb02e34f708f68092bdc13feab4fe2793081ef1d;hp=eb452737543ec1585f985b976700e72e3cd41f87;hb=0760f5fe96509ed8510cfe2ecab9305859e6f368;hpb=5fc5867e11097f8acca16fe6011a06a897fd1a0d diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.c b/FmpDevicePkg/FmpDxe/FmpDxe.c index eb45273754..fb02e34f70 100644 --- a/FmpDevicePkg/FmpDxe/FmpDxe.c +++ b/FmpDevicePkg/FmpDxe/FmpDxe.c @@ -89,6 +89,13 @@ UINT64 mImageId = 0x1; CHAR16 *mVersionName = NULL; EFI_EVENT mFmpDeviceLockEvent; +// +// Indicates if an attempt has been made to lock a +// FLASH storage device by calling FmpDeviceLock(). +// A FLASH storage device may not support being locked, +// so this variable is set to TRUE even if FmpDeviceLock() +// returns an error. +// BOOLEAN mFmpDeviceLocked = FALSE; /** @@ -497,6 +504,15 @@ GetTheImage ( Status = EFI_SUCCESS; + // + // Check to make sure index is 1 (only 1 image for this device) + // + if (ImageIndex != 1) { + DEBUG ((DEBUG_ERROR, "FmpDxe: GetImage() - Image Index Invalid.\n")); + Status = EFI_INVALID_PARAMETER; + goto cleanup; + } + if ((ImageSize == NULL)) { DEBUG ((DEBUG_ERROR, "FmpDxe: GetImage() - ImageSize Pointer Parameter is NULL.\n")); Status = EFI_INVALID_PARAMETER; @@ -523,16 +539,6 @@ GetTheImage ( goto cleanup; } - // - // Check to make sure index is 1 (only 1 image for this device) - // - if (ImageIndex != 1) { - DEBUG ((DEBUG_ERROR, "FmpDxe: GetImage() - Image Index Invalid.\n")); - Status = EFI_INVALID_PARAMETER; - goto cleanup; - } - - Status = FmpDeviceGetImage (Image, ImageSize); cleanup: @@ -899,6 +905,9 @@ SetTheImage ( UINT32 AllHeaderSize; UINT32 IncommingFwVersion; UINT32 LastAttemptStatus; + EFI_STATUS GetAttributesStatus; + UINT64 AttributesSupported; + UINT64 AttributesSetting; Status = EFI_SUCCESS; Updateable = 0; @@ -1111,10 +1120,14 @@ SetTheImage ( // // Set flag so the descriptor is repopulated - // This only applied to devices that do not require system reboot + // This is only applied to devices that do not require reset // - if (!PcdGetBool (PcdFmpDeviceSystemResetRequired)) { - mDescriptorPopulated = FALSE; + GetAttributesStatus = FmpDeviceGetAttributes (&AttributesSupported, &AttributesSetting); + if (!EFI_ERROR (GetAttributesStatus)) { + if (((AttributesSupported & IMAGE_ATTRIBUTE_RESET_REQUIRED) == 0) || + ((AttributesSetting & IMAGE_ATTRIBUTE_RESET_REQUIRED) == 0)) { + mDescriptorPopulated = FALSE; + } } cleanup: