]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Variable/RuntimeDxe/TcgMorLockSmm.c
MdeModulePkg Variable: type case VolatileBase to UINTN directly
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / RuntimeDxe / TcgMorLockSmm.c
index 93a300a84677618c9bee06c381e6274db37c2802..009d96c3a65e6cb2b91d0e18e30b8c70470cbbfd 100644 (file)
@@ -4,7 +4,7 @@
   This module initilizes MemoryOverwriteRequestControlLock variable.\r
   This module adds Variable Hook and check MemoryOverwriteRequestControlLock.\r
 \r
-Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -21,7 +21,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/DebugLib.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
 #include "Variable.h"\r
 \r
 typedef struct {\r
@@ -116,7 +115,7 @@ IsMorLockVariable (
   @retval  EFI_DEVICE_ERROR       The variable could not be saved due to a hardware failure.\r
   @retval  EFI_WRITE_PROTECTED    The variable in question is read-only.\r
   @retval  EFI_WRITE_PROTECTED    The variable in question cannot be deleted.\r
-  @retval  EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS\r
+  @retval  EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS\r
                                   set but the AuthInfo does NOT pass the validation check carried\r
                                   out by the firmware.\r
   @retval  EFI_NOT_FOUND          The variable trying to be updated or deleted was not found.\r
@@ -419,8 +418,6 @@ MorLockInitAtEndOfDxe (
 {\r
   UINTN      MorSize;\r
   EFI_STATUS MorStatus;\r
-  EFI_STATUS TcgStatus;\r
-  VOID       *TcgInterface;\r
 \r
   if (!mMorLockInitializationRequired) {\r
     //\r
@@ -458,20 +455,7 @@ MorLockInitAtEndOfDxe (
     // can be deduced from the absence of the TCG / TCG2 protocols, as edk2's\r
     // MOR implementation depends on (one of) those protocols.\r
     //\r
-    TcgStatus = gBS->LocateProtocol (\r
-                       &gEfiTcgProtocolGuid,\r
-                       NULL,                 // Registration\r
-                       &TcgInterface\r
-                       );\r
-    if (EFI_ERROR (TcgStatus)) {\r
-      TcgStatus = gBS->LocateProtocol (\r
-                         &gEfiTcg2ProtocolGuid,\r
-                         NULL,                  // Registration\r
-                         &TcgInterface\r
-                         );\r
-    }\r
-\r
-    if (!EFI_ERROR (TcgStatus)) {\r
+    if (VariableHaveTcgProtocols ()) {\r
       //\r
       // The MOR variable originates from the platform firmware; set the MOR\r
       // Control Lock variable to report the locking capability to the OS.\r