]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/SmmServicesTableLib/SmmServicesTableLib.c
MdePkg/Library/BaseLib: Enable VS2017/ARM64 builds
[mirror_edk2.git] / MdePkg / Library / SmmServicesTableLib / SmmServicesTableLib.c
index 1efa79ce70990d2dda69412789d36184b2bb6902..81e5ce8e3f4ecb8cab5ed957c0769c72ce79f514 100644 (file)
@@ -1,11 +1,11 @@
 /** @file\r
   SMM Services Table Library.\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation<BR>\r
-  All rights reserved. This program and the accompanying materials\r
+  Copyright (c) 2009 - 2015, 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
-  http://opensource.org/licenses/bsd-license.php\r
+  http://opensource.org/licenses/bsd-license.php.\r
 \r
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
@@ -18,7 +18,6 @@
 #include <Library/DebugLib.h>\r
 \r
 EFI_SMM_SYSTEM_TABLE2   *gSmst             = NULL;\r
-EFI_SMM_BASE2_PROTOCOL  *mInternalSmmBase2 = NULL;\r
 \r
 /**\r
   The constructor function caches the pointer of SMM Services Table.\r
@@ -36,8 +35,10 @@ SmmServicesTableLibConstructor (
   IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 {\r
-  EFI_STATUS  Status;\r
+  EFI_STATUS              Status;\r
+  EFI_SMM_BASE2_PROTOCOL  *InternalSmmBase2;\r
 \r
+  InternalSmmBase2 = NULL;\r
   //\r
   // Retrieve SMM Base2 Protocol,  Do not use gBS from UefiBootServicesTableLib on purpose\r
   // to prevent inclusion of gBS, gST, and gImageHandle from SMM Drivers unless the \r
@@ -46,25 +47,15 @@ SmmServicesTableLibConstructor (
   Status = SystemTable->BootServices->LocateProtocol (\r
                                         &gEfiSmmBase2ProtocolGuid,\r
                                         NULL,\r
-                                        (VOID **)&mInternalSmmBase2\r
+                                        (VOID **)&InternalSmmBase2\r
                                         );\r
   ASSERT_EFI_ERROR (Status);\r
-  ASSERT (mInternalSmmBase2 != NULL);\r
-\r
-  //\r
-  // Check to see if we are already in SMM\r
-  //\r
-  if (!InSmm ()) {\r
-    //\r
-    // We are not in SMM, so SMST is not needed\r
-    //\r
-    return EFI_SUCCESS;\r
-  }\r
+  ASSERT (InternalSmmBase2 != NULL);\r
 \r
   //\r
   // We are in SMM, retrieve the pointer to SMM System Table\r
   //\r
-  mInternalSmmBase2->GetSmstLocation (mInternalSmmBase2, &gSmst);\r
+  InternalSmmBase2->GetSmstLocation (InternalSmmBase2, &gSmst);\r
   ASSERT (gSmst != NULL);\r
 \r
   return EFI_SUCCESS;\r
@@ -87,11 +78,8 @@ InSmm (
   VOID\r
   )\r
 {\r
-  BOOLEAN  InSmm;\r
-\r
   //\r
-  // Check to see if we are already in SMM\r
+  // We are already in SMM\r
   //\r
-  mInternalSmmBase2->InSmm (mInternalSmmBase2, &InSmm);\r
-  return InSmm;\r
+  return TRUE;\r
 }\r