1 /** @file
2   SMM Core SMM Services Table Library.
3 
4   Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
5   This program and the accompanying materials
6   are licensed and made available under the terms and conditions of the BSD License
7   which accompanies this distribution.  The full text of the license may be found at
8   http://opensource.org/licenses/bsd-license.php
9 
10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #include <PiSmm.h>
16 #include <Library/SmmServicesTableLib.h>
17 #include <Library/DebugLib.h>
18 
19 EFI_SMM_SYSTEM_TABLE2         *gSmst = NULL;
20 extern EFI_SMM_SYSTEM_TABLE2  gSmmCoreSmst;
21 
22 /**
23   The constructor function caches the pointer of SMM Services Table.
24 
25   @param  ImageHandle   The firmware allocated handle for the EFI image.
26   @param  SystemTable   A pointer to the EFI System Table.
27 
28   @retval EFI_SUCCESS   The constructor always returns EFI_SUCCESS.
29 
30 **/
31 EFI_STATUS
32 EFIAPI
SmmCoreSmmServicesTableLibConstructor(IN EFI_HANDLE ImageHandle,IN EFI_SYSTEM_TABLE * SystemTable)33 SmmCoreSmmServicesTableLibConstructor (
34   IN EFI_HANDLE        ImageHandle,
35   IN EFI_SYSTEM_TABLE  *SystemTable
36   )
37 {
38   gSmst = &gSmmCoreSmst;
39   return EFI_SUCCESS;
40 }
41 
42 /**
43   This function allows the caller to determine if the driver is executing in
44   System Management Mode(SMM).
45 
46   This function returns TRUE if the driver is executing in SMM and FALSE if the
47   driver is not executing in SMM.
48 
49   @retval  TRUE  The driver is executing in System Management Mode (SMM).
50   @retval  FALSE The driver is not executing in System Management Mode (SMM).
51 
52 **/
53 BOOLEAN
54 EFIAPI
InSmm(VOID)55 InSmm (
56   VOID
57   )
58 {
59   return TRUE;
60 }
61