-/** @file\r
+/** @file\r
Produces a Firmware Management Protocol that supports updates to a firmware\r
image stored in a firmware device with platform and firmware device specific\r
information provided through PCDs and libraries.\r
\r
EFI_EVENT mFmpDeviceLockEvent;\r
//\r
-// Indicates if an attempt has been made to lock a \r
+// Indicates if an attempt has been made to lock a\r
// FLASH storage device by calling FmpDeviceLock().\r
// A FLASH storage device may not support being locked,\r
// so this variable is set to TRUE even if FmpDeviceLock()\r
This function allows a copy of the current firmware image to be created and saved.\r
The saved copy could later been used, for example, in firmware image recovery or rollback.\r
\r
- @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.\r
- @param[in] ImageIndex A unique number identifying the firmware image(s) within the device.\r
+ @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.\r
+ @param[in] ImageIndex A unique number identifying the firmware image(s) within the device.\r
The number is between 1 and DescriptorCount.\r
- @param[out] Image Points to the buffer where the current image is copied to.\r
- @param[out] ImageSize On entry, points to the size of the buffer pointed to by Image, in bytes.\r
+ @param[in, out] Image Points to the buffer where the current image is copied to.\r
+ @param[in, out] ImageSize On entry, points to the size of the buffer pointed to by Image, in bytes.\r
On return, points to the length of the image, in bytes.\r
\r
@retval EFI_SUCCESS The device was successfully updated with the new image.\r
goto cleanup;\r
}\r
\r
- if ((ImageSize == NULL)) {\r
+ if (ImageSize == NULL) {\r
DEBUG ((DEBUG_ERROR, "FmpDxe: GetImage() - ImageSize Pointer Parameter is NULL.\n"));\r
Status = EFI_INVALID_PARAMETER;\r
goto cleanup;\r
IN UINT8 ImageIndex,\r
IN CONST VOID *Image,\r
IN UINTN ImageSize,\r
- OUT UINT32 *ImageUpdateable\r
+ OUT UINT32 *ImageUpdatable\r
)\r
{\r
EFI_STATUS Status;\r
PopulateDescriptor();\r
}\r
\r
- if (ImageUpdateable == NULL) {\r
- DEBUG ((DEBUG_ERROR, "FmpDxe: CheckImage() - ImageUpdateable Pointer Parameter is NULL.\n"));\r
+ if (ImageUpdatable == NULL) {\r
+ DEBUG ((DEBUG_ERROR, "FmpDxe: CheckImage() - ImageUpdatable Pointer Parameter is NULL.\n"));\r
Status = EFI_INVALID_PARAMETER;\r
goto cleanup;\r
}\r
//\r
//Set to valid and then if any tests fail it will update this flag.\r
//\r
- *ImageUpdateable = IMAGE_UPDATABLE_VALID;\r
+ *ImageUpdatable = IMAGE_UPDATABLE_VALID;\r
\r
if (Image == NULL) {\r
DEBUG ((DEBUG_ERROR, "FmpDxe: CheckImage() - Image Pointer Parameter is NULL.\n"));\r
//\r
// not sure if this is needed\r
//\r
- *ImageUpdateable = IMAGE_UPDATABLE_INVALID;\r
+ *ImageUpdatable = IMAGE_UPDATABLE_INVALID;\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
//\r
if (ImageIndex != 1) {\r
DEBUG ((DEBUG_ERROR, "FmpDxe: CheckImage() - Image Index Invalid.\n"));\r
- *ImageUpdateable = IMAGE_UPDATABLE_INVALID_TYPE;\r
+ *ImageUpdatable = IMAGE_UPDATABLE_INVALID_TYPE;\r
Status = EFI_SUCCESS;\r
goto cleanup;\r
}\r
Status = GetFmpPayloadHeaderVersion (FmpPayloadHeader, FmpPayloadSize, &Version);\r
if (EFI_ERROR (Status)) {\r
DEBUG ((DEBUG_ERROR, "FmpDxe: CheckTheImage() - GetFmpPayloadHeaderVersion failed %r.\n", Status));\r
- *ImageUpdateable = IMAGE_UPDATABLE_INVALID;\r
+ *ImageUpdatable = IMAGE_UPDATABLE_INVALID;\r
Status = EFI_SUCCESS;\r
goto cleanup;\r
}\r
"FmpDxe: CheckTheImage() - Version Lower than lowest supported version. 0x%08X < 0x%08X\n",\r
Version, mDesc.LowestSupportedImageVersion)\r
);\r
- *ImageUpdateable = IMAGE_UPDATABLE_INVALID_OLD;\r
+ *ImageUpdatable = IMAGE_UPDATABLE_INVALID_OLD;\r
Status = EFI_SUCCESS;\r
goto cleanup;\r
}\r
Status = GetFmpPayloadHeaderSize (FmpPayloadHeader, FmpPayloadSize, &FmpHeaderSize);\r
if (EFI_ERROR (Status)) {\r
DEBUG ((DEBUG_ERROR, "FmpDxe: CheckTheImage() - GetFmpPayloadHeaderSize failed %r.\n", Status));\r
- *ImageUpdateable = IMAGE_UPDATABLE_INVALID;\r
+ *ImageUpdatable = IMAGE_UPDATABLE_INVALID;\r
Status = EFI_SUCCESS;\r
goto cleanup;\r
}\r
//\r
// FmpDeviceLib CheckImage function to do any specific checks\r
//\r
- Status = FmpDeviceCheckImage ((((UINT8 *)Image) + AllHeaderSize), RawSize, ImageUpdateable);\r
+ Status = FmpDeviceCheckImage ((((UINT8 *)Image) + AllHeaderSize), RawSize, ImageUpdatable);\r
if (EFI_ERROR (Status)) {\r
DEBUG ((DEBUG_ERROR, "FmpDxe: CheckTheImage() - FmpDeviceLib CheckImage failed. Status = %r\n", Status));\r
}\r
UINT32 AllHeaderSize;\r
UINT32 IncommingFwVersion;\r
UINT32 LastAttemptStatus;\r
- EFI_STATUS GetAttributesStatus;\r
- UINT64 AttributesSupported;\r
- UINT64 AttributesSetting;\r
+ UINT32 Version;\r
+ UINT32 LowestSupportedVersion;\r
\r
Status = EFI_SUCCESS;\r
Updateable = 0;\r
// Update the version stored in variable\r
//\r
if (!mRuntimeVersionSupported) {\r
- UINT32 Version = DEFAULT_VERSION;\r
+ Version = DEFAULT_VERSION;\r
GetFmpPayloadHeaderVersion (FmpHeader, FmpPayloadSize, &Version);\r
SetVersionInVariable (Version);\r
}\r
// Update lowest supported variable\r
//\r
{\r
- UINT32 Version = DEFAULT_LOWESTSUPPORTEDVERSION;\r
- GetFmpPayloadHeaderLowestSupportedVersion (FmpHeader, FmpPayloadSize, &Version);\r
- SetLowestSupportedVersionInVariable (Version);\r
+ LowestSupportedVersion = DEFAULT_LOWESTSUPPORTEDVERSION;\r
+ GetFmpPayloadHeaderLowestSupportedVersion (FmpHeader, FmpPayloadSize, &LowestSupportedVersion);\r
+ SetLowestSupportedVersionInVariable (LowestSupportedVersion);\r
}\r
\r
LastAttemptStatus = LAST_ATTEMPT_STATUS_SUCCESS;\r
\r
- //\r
- // Set flag so the descriptor is repopulated\r
- // This is only applied to devices that do not require reset\r
- //\r
- GetAttributesStatus = FmpDeviceGetAttributes (&AttributesSupported, &AttributesSetting);\r
- if (!EFI_ERROR (GetAttributesStatus)) {\r
- if (((AttributesSupported & IMAGE_ATTRIBUTE_RESET_REQUIRED) == 0) ||\r
- ((AttributesSetting & IMAGE_ATTRIBUTE_RESET_REQUIRED) == 0)) {\r
- mDescriptorPopulated = FALSE;\r
- }\r
- }\r
-\r
cleanup:\r
mProgressFunc = NULL;\r
mProgressSupported = FALSE;\r
Progress (100);\r
}\r
\r
+ //\r
+ // Need repopulate after SetImage is called to\r
+ // update LastAttemptVersion and LastAttemptStatus.\r
+ //\r
+ mDescriptorPopulated = FALSE;\r
+\r
return Status;\r
}\r
\r