231247c0df0e4cdbc41a5aaafd9b4efd5e6a91fc
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / SmmAccess.h
1 /** @file
2 This file declares SMM SMRAM Access abstraction protocol which is used to control
3 the visibility of the SMRAM on the platform. The expectation is
4 that the north bridge or memory controller would publish this protocol.
5 For example, the Memory Controller Hub (MCH) has the hardware provision for this
6 type of control. Because of the protected, distinguished class of memory for IA-32
7 systems, the expectation is that this protocol would be supported only on IA-32 systems.
8
9 Copyright (c) 2007, Intel Corporation
10 All rights reserved. This program and the accompanying materials
11 are licensed and made available under the terms and conditions of the BSD License
12 which accompanies this distribution. The full text of the license may be found at
13 http://opensource.org/licenses/bsd-license.php
14
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17
18 @par Revision Reference:
19 This Protocol is defined in Framework of EFI SMM Core Interface Spec
20 Version 0.9.
21 **/
22
23 #ifndef _SMM_ACCESS_H_
24 #define _SMM_ACCESS_H_
25
26 #include <PiDxe.h>
27 #include <Guid/SmramMemoryReserve.h>
28
29 typedef struct _EFI_SMM_ACCESS_PROTOCOL EFI_SMM_ACCESS_PROTOCOL;
30
31 #define EFI_SMM_ACCESS_PROTOCOL_GUID \
32 { \
33 0x3792095a, 0xe309, 0x4c1e, {0xaa, 0x01, 0x85, 0xf5, 0x65, 0x5a, 0x17, 0xf1 } \
34 }
35
36 //
37 // SMM Access specification constant and types
38 //
39 // *******************************************************
40 // EFI_SMRAM_STATE
41 // *******************************************************
42 //
43 #define EFI_SMRAM_OPEN 0x00000001
44 #define EFI_SMRAM_CLOSED 0x00000002
45 #define EFI_SMRAM_LOCKED 0x00000004
46 #define EFI_CACHEABLE 0x00000008
47 #define EFI_ALLOCATED 0x00000010
48
49 //
50 // SMM Access specification Member Function
51 //
52 /**
53 Opens the SMRAM area to be accessible by a boot-service driver.
54
55 @param This The EFI_SMM_ACCESS_PROTOCOL instance.
56 @param DescriptorIndex Indicates that the driver wishes to open
57 the memory tagged by this index.
58
59 @retval EFI_SUCCESS The operation was successful.
60 @retval EFI_INVALID_PARAMETER The given DescriptorIndex is not supported.
61 @retval EFI_NOT_STARTED The SMM base service has not been initialized.
62
63 **/
64 typedef
65 EFI_STATUS
66 (EFIAPI *EFI_SMM_OPEN) (
67 IN EFI_SMM_ACCESS_PROTOCOL *This,
68 UINTN DescriptorIndex
69 );
70
71 /**
72 Inhibits access to the SMRAM.
73
74 @param This The EFI_SMM_ACCESS_PROTOCOL instance.
75 @param DescriptorIndex Indicates that the driver wishes to open
76 the memory tagged by this index.
77
78 @retval EFI_SUCCESS The operation was successful.
79 @retval EFI_DEVICE_ERROR The given DescriptorIndex is not open.
80 @retval EFI_INVALID_PARAMETER The given DescriptorIndex is not supported.
81 @retval EFI_NOT_STARTED The SMM base service has not been initialized.
82
83 **/
84 typedef
85 EFI_STATUS
86 (EFIAPI *EFI_SMM_CLOSE) (
87 IN EFI_SMM_ACCESS_PROTOCOL *This,
88 UINTN DescriptorIndex
89 );
90
91 /**
92 Inhibits access to the SMRAM.
93 @param This The EFI_SMM_ACCESS_PROTOCOL instance.
94 @param DescriptorIndex Indicates that the driver wishes to open
95 the memory tagged by this index.
96
97 @retval EFI_SUCCESS The operation was successful.
98 @retval EFI_DEVICE_ERROR The given DescriptorIndex is not open.
99 @retval EFI_INVALID_PARAMETER The given DescriptorIndex is not supported.
100 @retval EFI_NOT_STARTED The SMM base service has not been initialized.
101
102 **/
103 typedef
104 EFI_STATUS
105 (EFIAPI *EFI_SMM_LOCK) (
106 IN EFI_SMM_ACCESS_PROTOCOL *This,
107 UINTN DescriptorIndex
108 );
109
110 /**
111 Queries the memory controller for the possible regions that will support SMRAM.
112
113 @param This The EFI_SMM_ACCESS_PROTOCOL instance.
114 @param SmramMapSize A pointer to the size, in bytes, of the SmramMemoryMap buffer.
115 @param SmramMap A pointer to the buffer in which firmware places the current memory map.
116
117 @retval EFI_SUCCESS The chipset supported the given resource.
118 @retval EFI_BUFFER_TOO_SMALL The SmramMap parameter was too small.
119
120 **/
121 typedef
122 EFI_STATUS
123 (EFIAPI *EFI_SMM_CAPABILITIES) (
124 IN EFI_SMM_ACCESS_PROTOCOL *This,
125 IN OUT UINTN *SmramMapSize,
126 IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap
127 );
128
129 /**
130 @par Protocol Description:
131 This protocol is used to control the visibility of the SMRAM on the platform.
132
133 @param Open
134 Opens the SMRAM.
135
136 @param Close
137 Closes the SMRAM.
138
139 @param Lock
140 Locks the SMRAM.
141
142 @param GetCapabilities
143 Gets information on possible SMRAM regions.
144
145 @param LockState
146 Indicates the current state of the SMRAM. Set to TRUE if any region is locked.
147
148 @param OpenState
149 Indicates the current state of the SMRAM. Set to TRUE if any region is open.
150
151 **/
152 struct _EFI_SMM_ACCESS_PROTOCOL {
153 EFI_SMM_OPEN Open;
154 EFI_SMM_CLOSE Close;
155 EFI_SMM_LOCK Lock;
156 EFI_SMM_CAPABILITIES GetCapabilities;
157 BOOLEAN LockState;
158 BOOLEAN OpenState;
159 };
160
161 extern EFI_GUID gEfiSmmAccessProtocolGuid;
162
163 #endif