1 /** @file
2   Include file for SMM Access2 Protocol on SMM Access Protocol Thunk driver.
3 
4   Copyright (c) 2009 - 2010, 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 #ifndef  _SMM_ACCESS2_ON_SMM_ACCESS_THUNK_H_
16 #define  _SMM_ACCESS2_ON_SMM_ACCESS_THUNK_H_
17 
18 #include <PiDxe.h>
19 #include <FrameworkSmm.h>
20 #include <Library/DebugLib.h>
21 #include <Library/UefiBootServicesTableLib.h>
22 #include <Library/UefiDriverEntryPoint.h>
23 #include <Protocol/SmmAccess2.h>
24 #include <Protocol/SmmAccess.h>
25 
26 /**
27   Opens the SMRAM area to be accessible by a boot-service driver.
28 
29   This function "opens" SMRAM so that it is visible while not inside of SMM. The function should
30   return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM. The function
31   should return EFI_DEVICE_ERROR if the SMRAM configuration is locked.
32 
33   @param[in] This           The EFI_SMM_ACCESS2_PROTOCOL instance.
34 
35   @retval EFI_SUCCESS       The operation was successful.
36   @retval EFI_UNSUPPORTED   The system does not support opening and closing of SMRAM.
37   @retval EFI_DEVICE_ERROR  SMRAM cannot be opened, perhaps because it is locked.
38 **/
39 EFI_STATUS
40 EFIAPI
41 SmmAccess2Open (
42   IN EFI_SMM_ACCESS2_PROTOCOL  *This
43   );
44 
45 /**
46   Inhibits access to the SMRAM.
47 
48   This function "closes" SMRAM so that it is not visible while outside of SMM. The function should
49   return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM.
50 
51   @param[in] This           The EFI_SMM_ACCESS2_PROTOCOL instance.
52 
53   @retval EFI_SUCCESS       The operation was successful.
54   @retval EFI_UNSUPPORTED   The system does not support opening and closing of SMRAM.
55   @retval EFI_DEVICE_ERROR  SMRAM cannot be closed.
56 **/
57 EFI_STATUS
58 EFIAPI
59 SmmAccess2Close (
60   IN EFI_SMM_ACCESS2_PROTOCOL  *This
61   );
62 
63 /**
64   Inhibits access to the SMRAM.
65 
66   This function prohibits access to the SMRAM region.  This function is usually implemented such
67   that it is a write-once operation.
68 
69   @param[in] This          The EFI_SMM_ACCESS2_PROTOCOL instance.
70 
71   @retval EFI_SUCCESS      The device was successfully locked.
72   @retval EFI_UNSUPPORTED  The system does not support locking of SMRAM.
73 **/
74 EFI_STATUS
75 EFIAPI
76 SmmAccess2Lock (
77   IN EFI_SMM_ACCESS2_PROTOCOL  *This
78   );
79 
80 /**
81   Queries the memory controller for the possible regions that will support SMRAM.
82 
83   @param[in]     This           The EFI_SMM_ACCESS2_PROTOCOL instance.
84   @param[in, out] SmramMapSize   A pointer to the size, in bytes, of the SmramMemoryMap buffer.
85   @param[in, out] SmramMap       A pointer to the buffer in which firmware places the current memory map.
86 
87   @retval EFI_SUCCESS           The chipset supported the given resource.
88   @retval EFI_BUFFER_TOO_SMALL  The SmramMap parameter was too small.  The current buffer size
89                                 needed to hold the memory map is returned in SmramMapSize.
90 **/
91 EFI_STATUS
92 EFIAPI
93 SmmAccess2GetCapabilities (
94   IN CONST EFI_SMM_ACCESS2_PROTOCOL  *This,
95   IN OUT UINTN                       *SmramMapSize,
96   IN OUT EFI_SMRAM_DESCRIPTOR        *SmramMap
97   );
98 
99 #endif
100