]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Variable/RuntimeDxe/VariableDxe.c
MdeModulePkg Variable: Align TPL level for (Smm)EndOfDxe callback
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / RuntimeDxe / VariableDxe.c
index dfed03133efec40a41f4a9f96a5c63b09b29ca82..6b04f4f7b39451cbaff368919f8a0c27b1d0f911 100644 (file)
@@ -3,7 +3,7 @@
   and volatile storage space and install variable architecture protocol.\r
 \r
 Copyright (C) 2013, Red Hat, Inc.\r
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
@@ -31,6 +31,17 @@ EDKII_VAR_CHECK_PROTOCOL            mVarCheck                  = { VarCheckRegis
                                                                     VarCheckVariablePropertySet,\r
                                                                     VarCheckVariablePropertyGet };\r
 \r
+/**\r
+  Some Secure Boot Policy Variable may update following other variable changes(SecureBoot follows PK change, etc).\r
+  Record their initial State when variable write service is ready.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+RecordSecureBootPolicyVarData(\r
+  VOID\r
+  );\r
+\r
 /**\r
   Return TRUE if ExitBootServices () has been called.\r
 \r
@@ -117,7 +128,7 @@ ReleaseLockOnlyAtBootTime (
 }\r
 \r
 /**\r
-  Retrive the Fault Tolerent Write protocol interface.\r
+  Retrieve the Fault Tolerent Write protocol interface.\r
 \r
   @param[out] FtwProtocol       The interface of Ftw protocol\r
 \r
@@ -145,7 +156,7 @@ GetFtwProtocol (
 }\r
 \r
 /**\r
-  Retrive the FVB protocol interface by HANDLE.\r
+  Retrieve the FVB protocol interface by HANDLE.\r
 \r
   @param[in]  FvBlockHandle     The handle of FVB protocol that provides services for\r
                                 reading, writing, and erasing the target block.\r
@@ -280,6 +291,7 @@ OnReadyToBoot (
   )\r
 {\r
   if (!mEndOfDxe) {\r
+    MorLockInitAtEndOfDxe ();\r
     //\r
     // Set the End Of DXE bit in case the EFI_END_OF_DXE_EVENT_GROUP_GUID event is not signaled.\r
     //\r
@@ -319,6 +331,7 @@ OnEndOfDxe (
   )\r
 {\r
   DEBUG ((EFI_D_INFO, "[Variable]END_OF_DXE is signaled\n"));\r
+  MorLockInitAtEndOfDxe ();\r
   mEndOfDxe = TRUE;\r
   mVarCheckAddressPointer = VarCheckLibInitializeAtEndOfDxe (&mVarCheckAddressPointerCount);\r
   //\r
@@ -414,6 +427,12 @@ FtwNotificationEvent (
     DEBUG ((DEBUG_ERROR, "Variable write service initialization failed. Status = %r\n", Status));\r
   }\r
 \r
+  //\r
+  // Some Secure Boot Policy Var (SecureBoot, etc) updates following other\r
+  // Secure Boot Policy Variable change. Record their initial value.\r
+  //\r
+  RecordSecureBootPolicyVarData();\r
+\r
   //\r
   // Install the Variable Write Architectural protocol.\r
   //\r
@@ -528,7 +547,7 @@ VariableServiceInitialize (
   //\r
   Status = gBS->CreateEventEx (\r
                   EVT_NOTIFY_SIGNAL,\r
-                  TPL_NOTIFY,\r
+                  TPL_CALLBACK,\r
                   OnEndOfDxe,\r
                   NULL,\r
                   &gEfiEndOfDxeEventGroupGuid,\r