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
- }\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
+ DEBUG ((DEBUG_WARN, "FmpDxe: FmpDeviceLock() returned error. Status = %r\n", Status));\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