+ 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