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
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
\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
EFI_STATUS Status;\r
\r
if (!mFmpDeviceLocked) {\r
- if (IsLockFmpDeviceAtLockEventGuidRequired ()) {\r
- //\r
- // Lock all UEFI Variables used by this module.\r
- //\r
- Status = LockAllFmpVariables ();\r
- if (EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_ERROR, "FmpDxe: Failed to lock variables. Status = %r.\n"));\r
+ //\r
+ // Lock the firmware device\r
+ //\r
+ Status = FmpDeviceLock();\r
+ if (EFI_ERROR (Status)) {\r
+ if (Status != EFI_UNSUPPORTED) {\r
+ DEBUG ((DEBUG_ERROR, "FmpDxe: FmpDeviceLock() returned error. Status = %r\n", Status));\r
} else {\r
- DEBUG ((DEBUG_INFO, "FmpDxe: All variables locked\n"));\r
+ DEBUG ((DEBUG_WARN, "FmpDxe: FmpDeviceLock() returned error. Status = %r\n", Status));\r
}\r
-\r
- //\r
- // Lock the firmware device\r
- //\r
- Status = FmpDeviceLock();\r
- if (EFI_ERROR (Status)) {\r
- if (Status != EFI_UNSUPPORTED) {\r
- DEBUG ((DEBUG_ERROR, "FmpDxe: FmpDeviceLock() returned error. Status = %r\n", Status));\r
- } else {\r
- DEBUG ((DEBUG_WARN, "FmpDxe: FmpDeviceLock() returned error. Status = %r\n", Status));\r
- }\r
- }\r
- mFmpDeviceLocked = TRUE;\r
- } else {\r
- DEBUG ((DEBUG_VERBOSE, "FmpDxe: Not calling FmpDeviceLock() because mfg mode\n"));\r
}\r
+ mFmpDeviceLocked = TRUE;\r
}\r
}\r
\r
//\r
DetectTestKey ();\r
\r
+ if (IsLockFmpDeviceAtLockEventGuidRequired ()) {\r
+ //\r
+ // Lock all UEFI Variables used by this module.\r
+ //\r
+ Status = LockAllFmpVariables ();\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG ((DEBUG_ERROR, "FmpDxe: Failed to lock variables. Status = %r.\n", Status));\r
+ } else {\r
+ DEBUG ((DEBUG_INFO, "FmpDxe: All variables locked\n"));\r
+ }\r
+\r
+ //\r
+ // Register notify function to lock the FMP device.\r
+ // The lock event GUID is retrieved from PcdFmpDeviceLockEventGuid.\r
+ // If PcdFmpDeviceLockEventGuid is not the size of an EFI_GUID, then\r
+ // gEfiEndOfDxeEventGroupGuid is used.\r
+ //\r
+ LockGuid = &gEfiEndOfDxeEventGroupGuid;\r
+ if (PcdGetSize (PcdFmpDeviceLockEventGuid) == sizeof (EFI_GUID)) {\r
+ LockGuid = (EFI_GUID *)PcdGetPtr (PcdFmpDeviceLockEventGuid);\r
+ }\r
+ DEBUG ((DEBUG_INFO, "FmpDxe: Lock GUID: %g\n", LockGuid));\r
+\r
+ Status = gBS->CreateEventEx (\r
+ EVT_NOTIFY_SIGNAL,\r
+ TPL_CALLBACK,\r
+ FmpDxeLockEventNotify,\r
+ NULL,\r
+ LockGuid,\r
+ &mFmpDeviceLockEvent\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG ((DEBUG_ERROR, "FmpDxe: Failed to register notification. Status = %r\n", Status));\r
+ }\r
+ ASSERT_EFI_ERROR (Status);\r
+ } else {\r
+ DEBUG ((DEBUG_VERBOSE, "FmpDxe: Not registering notification to call FmpDeviceLock() because mfg mode\n"));\r
+ }\r
+\r
//\r
// Register with library the install function so if the library uses\r
// UEFI driver model/driver binding protocol it can install FMP on its device handle\r
));\r
}\r
\r
- //\r
- // Register notify function to lock the FMP device.\r
- // The lock event GUID is retrieved from PcdFmpDeviceLockEventGuid.\r
- // If PcdFmpDeviceLockEventGuid is not the size of an EFI_GUID, then\r
- // gEfiEndOfDxeEventGroupGuid is used.\r
- //\r
- LockGuid = &gEfiEndOfDxeEventGroupGuid;\r
- if (PcdGetSize (PcdFmpDeviceLockEventGuid) == sizeof (EFI_GUID)) {\r
- LockGuid = (EFI_GUID *)PcdGetPtr (PcdFmpDeviceLockEventGuid);\r
- }\r
- DEBUG ((DEBUG_INFO, "FmpDxe: Lock GUID: %g\n", LockGuid));\r
-\r
- Status = gBS->CreateEventEx (\r
- EVT_NOTIFY_SIGNAL,\r
- TPL_CALLBACK,\r
- FmpDxeLockEventNotify,\r
- NULL,\r
- LockGuid,\r
- &mFmpDeviceLockEvent\r
- );\r
- if (EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_ERROR, "FmpDxe: Failed to register for ready to boot. Status = %r\n", Status));\r
- }\r
- ASSERT_EFI_ERROR (Status);\r
-\r
return Status;\r
}\r