]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | This file declares SMM Base abstraction protocol.\r | |
3 | This protocol is used to install SMM handlers for support of subsequent SMI/PMI activations. This\r | |
4 | protocol is available on both IA-32 and Itanium-based systems.\r | |
5 | \r | |
6 | The EFI_SMM_BASE_PROTOCOL is a set of services that is exported by a processor device. It is\r | |
7 | a required protocol for the platform processor. This protocol can be used in both boot services and\r | |
8 | runtime mode. However, only the following member functions need to exist during runtime:\r | |
9 | - InSmm()\r | |
10 | - Communicate()\r | |
11 | This protocol is responsible for registering the handler services. The order in which the handlers are\r | |
12 | executed is prescribed only with respect to the MakeLast flag in the RegisterCallback()\r | |
13 | service. The driver exports these registration and unregistration services in boot services mode, but\r | |
14 | the registered handlers will execute through the preboot and runtime. The only way to change the\r | |
15 | behavior of a registered driver after ExitBootServices() has been invoked is to use some\r | |
16 | private communication mechanism with the driver to order it to quiesce. This model permits typical\r | |
17 | use cases, such as invoking the handler to enter ACPI mode, where the OS loader would make this\r | |
18 | call before boot services are terminated. On the other hand, handlers for services such as chipset\r | |
19 | workarounds for the century rollover in CMOS should provide commensurate services throughout\r | |
20 | preboot and OS runtime.\r | |
21 | \r | |
22 | Copyright (c) 2007 - 2009, Intel Corporation\r | |
23 | All rights reserved. This program and the accompanying materials\r | |
24 | are licensed and made available under the terms and conditions of the BSD License\r | |
25 | which accompanies this distribution. The full text of the license may be found at\r | |
26 | http://opensource.org/licenses/bsd-license.php\r | |
27 | \r | |
28 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
29 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
30 | \r | |
31 | @par Revision Reference:\r | |
32 | This Protocol is defined in Framework of EFI SMM Core Interface Spec\r | |
33 | Version 0.9.\r | |
34 | \r | |
35 | **/\r | |
36 | \r | |
37 | #ifndef _SMM_BASE_H_\r | |
38 | #define _SMM_BASE_H_\r | |
39 | \r | |
40 | //\r | |
41 | // Share some common definitions with PI SMM\r | |
42 | //\r | |
43 | #include <Framework/SmmCis.h>\r | |
44 | #include <Protocol/SmmCommunication.h>\r | |
45 | \r | |
46 | ///\r | |
47 | /// Global ID for the EFI_SMM_BASE_PROTOCOL\r | |
48 | ///\r | |
49 | #define EFI_SMM_BASE_PROTOCOL_GUID \\r | |
50 | { \\r | |
51 | 0x1390954D, 0xda95, 0x4227, {0x93, 0x28, 0x72, 0x82, 0xc2, 0x17, 0xda, 0xa8 } \\r | |
52 | }\r | |
53 | \r | |
54 | ///\r | |
55 | /// Forward declaration for EFI_SMM_BASE_PROTOCOL\r | |
56 | ///\r | |
57 | typedef struct _EFI_SMM_BASE_PROTOCOL EFI_SMM_BASE_PROTOCOL;\r | |
58 | \r | |
59 | ///\r | |
60 | /// EFI SMM Handler return codes\r | |
61 | ///\r | |
62 | ///@{\r | |
63 | #define EFI_HANDLER_SUCCESS 0x0000\r | |
64 | #define EFI_HANDLER_CRITICAL_EXIT 0x0001\r | |
65 | #define EFI_HANDLER_SOURCE_QUIESCED 0x0002\r | |
66 | #define EFI_HANDLER_SOURCE_PENDING 0x0003\r | |
67 | ///@}\r | |
68 | \r | |
69 | /**\r | |
70 | Entry Point to Callback service\r | |
71 | \r | |
72 | @param[in] SmmImageHandle A handle allocated by the SMM infrastructure code\r | |
73 | to uniquely designate a specific DXE SMM driver.\r | |
74 | @param[in] CommunicationBuffer A pointer to a collection of data in memory\r | |
75 | that will be conveyed from a non-SMM environment into an SMM environment.\r | |
76 | The buffer must be contiguous and physically mapped, and must be a physical address.\r | |
77 | @param[in] SourceSize The size of the CommunicationBuffer.\r | |
78 | \r | |
79 | @return Status code\r | |
80 | \r | |
81 | **/\r | |
82 | typedef\r | |
83 | EFI_STATUS\r | |
84 | (EFIAPI *EFI_SMM_CALLBACK_ENTRY_POINT)(\r | |
85 | IN EFI_HANDLE SmmImageHandle,\r | |
86 | IN OUT VOID *CommunicationBuffer OPTIONAL,\r | |
87 | IN OUT UINTN *SourceSize OPTIONAL\r | |
88 | );\r | |
89 | \r | |
90 | //\r | |
91 | // SMM Base Protocol Definition\r | |
92 | //\r | |
93 | /**\r | |
94 | Register a given driver into SMRAM. This is the equivalent of performing\r | |
95 | the LoadImage/StartImage into System Management Mode.\r | |
96 | \r | |
97 | @param[in] This Protocol instance pointer.\r | |
98 | @param[in] FilePath Location of the image to be installed as the handler.\r | |
99 | @param[in] SourceBuffer Optional source buffer in case the image file\r | |
100 | is in memory.\r | |
101 | @param[in] SourceSize Size of the source image file, if in memory.\r | |
102 | @param[out] ImageHandle The handle that the base driver uses to decode \r | |
103 | the handler. Unique among SMM handlers only, \r | |
104 | not unique across DXE/EFI.\r | |
105 | @param[in] LegacyIA32Binary An optional parameter specifying that the associated \r | |
106 | file is a real-mode IA-32 binary.\r | |
107 | \r | |
108 | @retval EFI_SUCCESS The operation was successful.\r | |
109 | @retval EFI_OUT_OF_RESOURCES There were no additional SMRAM resources to load the handler\r | |
110 | @retval EFI_UNSUPPORTED This platform does not support 16-bit handlers.\r | |
111 | @retval EFI_UNSUPPORTED Platform is in runtime.\r | |
112 | @retval EFI_INVALID_PARAMETER The handlers was not the correct image type\r | |
113 | \r | |
114 | **/\r | |
115 | typedef\r | |
116 | EFI_STATUS\r | |
117 | (EFIAPI *EFI_SMM_REGISTER_HANDLER)(\r | |
118 | IN EFI_SMM_BASE_PROTOCOL *This,\r | |
119 | IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r | |
120 | IN VOID *SourceBuffer OPTIONAL,\r | |
121 | IN UINTN SourceSize,\r | |
122 | OUT EFI_HANDLE *ImageHandle,\r | |
123 | IN BOOLEAN LegacyIA32Binary OPTIONAL\r | |
124 | );\r | |
125 | \r | |
126 | /**\r | |
127 | Removes a handler from execution within SMRAM. This is the equivalent of performing\r | |
128 | the UnloadImage in System Management Mode.\r | |
129 | \r | |
130 | @param[in] This Protocol instance pointer.\r | |
131 | @param[in] ImageHandle The handler to be removed.\r | |
132 | \r | |
133 | @retval EFI_SUCCESS The operation was successful\r | |
134 | @retval EFI_INVALID_PARAMETER The handler did not exist\r | |
135 | @retval EFI_UNSUPPORTED Platform is in runtime.\r | |
136 | \r | |
137 | **/\r | |
138 | typedef\r | |
139 | EFI_STATUS\r | |
140 | (EFIAPI *EFI_SMM_UNREGISTER_HANDLER)(\r | |
141 | IN EFI_SMM_BASE_PROTOCOL *This,\r | |
142 | IN EFI_HANDLE ImageHandle\r | |
143 | );\r | |
144 | \r | |
145 | /**\r | |
146 | The SMM Inter-module Communicate Service Communicate() function\r | |
147 | provides a service to send/receive messages from a registered\r | |
148 | EFI service. The BASE protocol driver is responsible for doing\r | |
149 | any of the copies such that the data lives in boot-service-accessible RAM.\r | |
150 | \r | |
151 | @param[in] This Protocol instance pointer.\r | |
152 | @param[in] ImageHandle The handle of the registered driver.\r | |
153 | @param[in,out] CommunicationBuffer Pointer to the buffer to convey into SMRAM.\r | |
154 | @param[in,out] SourceSize The size of the data buffer being passed in.\r | |
155 | On exit, the size of data being returned.\r | |
156 | Zero if the handler does not wish to reply with any data.\r | |
157 | \r | |
158 | @retval EFI_SUCCESS The message was successfully posted\r | |
159 | @retval EFI_INVALID_PARAMETER The buffer was NULL\r | |
160 | \r | |
161 | **/\r | |
162 | typedef\r | |
163 | EFI_STATUS\r | |
164 | (EFIAPI *EFI_SMM_COMMUNICATE)(\r | |
165 | IN EFI_SMM_BASE_PROTOCOL *This,\r | |
166 | IN EFI_HANDLE ImageHandle,\r | |
167 | IN OUT VOID *CommunicationBuffer,\r | |
168 | IN OUT UINTN *SourceSize\r | |
169 | );\r | |
170 | \r | |
171 | /**\r | |
172 | Register a callback to execute within SMM.\r | |
173 | This allows receipt of messages created with EFI_SMM_BASE_PROTOCOL.Communicate().\r | |
174 | \r | |
175 | @param[in] This Protocol instance pointer.\r | |
176 | @param[in] SmmImageHandle Handle of the callback service.\r | |
177 | @param[in] CallbackAddress Address of the callback service.\r | |
178 | @param[in] MakeLast If present, will stipulate that the handler is posted to \r | |
179 | be executed last in the dispatch table.\r | |
180 | @param[in] FloatingPointSave An optional parameter that informs the\r | |
181 | EFI_SMM_ACCESS_PROTOCOL Driver core if it needs to save\r | |
182 | the floating point register state. If any handler\r | |
183 | require this, the state will be saved for all handlers.\r | |
184 | \r | |
185 | @retval EFI_SUCCESS The operation was successful\r | |
186 | @retval EFI_OUT_OF_RESOURCES Not enough space in the dispatch queue\r | |
187 | @retval EFI_UNSUPPORTED Platform is in runtime.\r | |
188 | @retval EFI_UNSUPPORTED The caller is not in SMM.\r | |
189 | \r | |
190 | **/\r | |
191 | typedef\r | |
192 | EFI_STATUS\r | |
193 | (EFIAPI *EFI_SMM_CALLBACK_SERVICE)(\r | |
194 | IN EFI_SMM_BASE_PROTOCOL *This,\r | |
195 | IN EFI_HANDLE SmmImageHandle,\r | |
196 | IN EFI_SMM_CALLBACK_ENTRY_POINT CallbackAddress,\r | |
197 | IN BOOLEAN MakeLast OPTIONAL,\r | |
198 | IN BOOLEAN FloatingPointSave OPTIONAL\r | |
199 | );\r | |
200 | \r | |
201 | /**\r | |
202 | The SmmAllocatePool() function allocates a memory region of Size bytes from memory of\r | |
203 | type PoolType and returns the address of the allocated memory in the location referenced\r | |
204 | by Buffer. This function allocates pages from EFI SMRAM Memory as needed to grow the\r | |
205 | requested pool type. All allocations are eight-byte aligned.\r | |
206 | \r | |
207 | @param[in] This Protocol instance pointer.\r | |
208 | @param[in] PoolType The type of pool to allocate.\r | |
209 | The only supported type is EfiRuntimeServicesData;\r | |
210 | the interface will internally map this runtime request to \r | |
211 | SMRAM for IA-32 and leave as this type for the Itanium \r | |
212 | processor family. Other types can be ignored.\r | |
213 | @param[in] Size The number of bytes to allocate from the pool.\r | |
214 | @param[out] Buffer A pointer to a pointer to the allocated buffer if the call\r | |
215 | succeeds; undefined otherwise.\r | |
216 | \r | |
217 | @retval EFI_SUCCESS The requested number of bytes was allocated.\r | |
218 | @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.\r | |
219 | @retval EFI_UNSUPPORTED Platform is in runtime.\r | |
220 | \r | |
221 | **/\r | |
222 | typedef\r | |
223 | EFI_STATUS\r | |
224 | (EFIAPI *EFI_SMM_ALLOCATE_POOL)(\r | |
225 | IN EFI_SMM_BASE_PROTOCOL *This,\r | |
226 | IN EFI_MEMORY_TYPE PoolType,\r | |
227 | IN UINTN Size,\r | |
228 | OUT VOID **Buffer\r | |
229 | );\r | |
230 | \r | |
231 | /**\r | |
232 | The SmmFreePool() function returns the memory specified by Buffer to the system.\r | |
233 | On return, the memory's type is EFI SMRAM Memory. The Buffer that is freed must\r | |
234 | have been allocated by SmmAllocatePool().\r | |
235 | \r | |
236 | @param[in] This Protocol instance pointer.\r | |
237 | @param[in] Buffer Pointer to the buffer allocation.\r | |
238 | \r | |
239 | @retval EFI_SUCCESS The memory was returned to the system.\r | |
240 | @retval EFI_INVALID_PARAMETER Buffer was invalid.\r | |
241 | @retval EFI_UNSUPPORTED Platform is in runtime.\r | |
242 | \r | |
243 | **/\r | |
244 | typedef\r | |
245 | EFI_STATUS\r | |
246 | (EFIAPI *EFI_SMM_FREE_POOL)(\r | |
247 | IN EFI_SMM_BASE_PROTOCOL *This,\r | |
248 | IN VOID *Buffer\r | |
249 | );\r | |
250 | \r | |
251 | /**\r | |
252 | This routine tells caller if execution context is SMM or not.\r | |
253 | \r | |
254 | @param[in] This Protocol instance pointer.\r | |
255 | @param[out] InSmm Whether the caller is inside SMM for IA-32\r | |
256 | or servicing a PMI for the Itanium processor\r | |
257 | family.\r | |
258 | \r | |
259 | @retval EFI_SUCCESS The operation was successful\r | |
260 | @retval EFI_INVALID_PARAMETER InSmm was NULL.\r | |
261 | \r | |
262 | **/\r | |
263 | typedef\r | |
264 | EFI_STATUS\r | |
265 | (EFIAPI *EFI_SMM_INSIDE_OUT)(\r | |
266 | IN EFI_SMM_BASE_PROTOCOL *This,\r | |
267 | OUT BOOLEAN *InSmm\r | |
268 | );\r | |
269 | \r | |
270 | /**\r | |
271 | The GetSmstLocation() function returns the location of the System Management\r | |
272 | Service Table. The use of the API is such that a driver can discover the\r | |
273 | location of the SMST in its entry point and then cache it in some driver\r | |
274 | global variable so that the SMST can be invoked in subsequent callbacks.\r | |
275 | \r | |
276 | @param[in] This Protocol instance pointer.\r | |
277 | @param[in] Smst Pointer to the SMST.\r | |
278 | \r | |
279 | @retval EFI_SUCCESS The operation was successful\r | |
280 | @retval EFI_INVALID_PARAMETER Smst was invalid.\r | |
281 | @retval EFI_UNSUPPORTED Not in SMM.\r | |
282 | \r | |
283 | **/\r | |
284 | typedef\r | |
285 | EFI_STATUS\r | |
286 | (EFIAPI *EFI_SMM_GET_SMST_LOCATION)(\r | |
287 | IN EFI_SMM_BASE_PROTOCOL *This,\r | |
288 | IN OUT EFI_SMM_SYSTEM_TABLE **Smst\r | |
289 | );\r | |
290 | \r | |
291 | ///\r | |
292 | /// This protocol is used to install SMM handlers for support of subsequent SMI/PMI\r | |
293 | /// activations. This protocol is available on both IA-32 and Itanium-based systems.\r | |
294 | ///\r | |
295 | struct _EFI_SMM_BASE_PROTOCOL {\r | |
296 | EFI_SMM_REGISTER_HANDLER Register;\r | |
297 | EFI_SMM_UNREGISTER_HANDLER UnRegister;\r | |
298 | EFI_SMM_COMMUNICATE Communicate;\r | |
299 | EFI_SMM_CALLBACK_SERVICE RegisterCallback;\r | |
300 | EFI_SMM_INSIDE_OUT InSmm;\r | |
301 | EFI_SMM_ALLOCATE_POOL SmmAllocatePool;\r | |
302 | EFI_SMM_FREE_POOL SmmFreePool;\r | |
303 | EFI_SMM_GET_SMST_LOCATION GetSmstLocation;\r | |
304 | };\r | |
305 | \r | |
306 | extern EFI_GUID gEfiSmmBaseProtocolGuid;\r | |
307 | \r | |
308 | #endif\r |