/** @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
- 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
-\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
+ Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
#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
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
- // SMM driver explicity declares that dependency. \r
+ // to prevent inclusion of gBS, gST, and gImageHandle from SMM Drivers unless the\r
+ // SMM driver explicity declares that dependency.\r
//\r
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
}\r
\r
/**\r
- This function allows the caller to determine if the driver is executing in \r
+ This function allows the caller to determine if the driver is executing in\r
System Management Mode(SMM).\r
\r
- This function returns TRUE if the driver is executing in SMM and FALSE if the \r
+ This function returns TRUE if the driver is executing in SMM and FALSE if the\r
driver is not executing in SMM.\r
\r
@retval TRUE The driver is executing in System Management Mode (SMM).\r
- @retval FALSE The driver is not executing in System Management Mode (SMM). \r
+ @retval FALSE The driver is not executing in System Management Mode (SMM).\r
\r
**/\r
BOOLEAN\r
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