]>
Commit | Line | Data |
---|---|---|
79964ac8 | 1 | /** @file\r |
2 | This file declares SMM Base abstraction protocol.\r | |
8411f1c0 | 3 | This protocol is used to install SMM handlers for support of subsequent SMI/PMI activations. This\r |
3471dae2 | 4 | protocol is available on both IA-32 and Itanium based systems.\r |
8411f1c0 | 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 into 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 | |
79964ac8 | 22 | Copyright (c) 2007, 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 | |
79964ac8 | 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 | |
b80fbe85 | 40 | #include <FrameworkSmm.h>\r |
41 | \r | |
79964ac8 | 42 | #define EFI_SMM_BASE_PROTOCOL_GUID \\r |
43 | { \\r | |
44 | 0x1390954D, 0xda95, 0x4227, {0x93, 0x28, 0x72, 0x82, 0xc2, 0x17, 0xda, 0xa8 } \\r | |
45 | }\r | |
46 | \r | |
47 | typedef struct _EFI_SMM_BASE_PROTOCOL EFI_SMM_BASE_PROTOCOL;\r | |
48 | \r | |
49 | //\r | |
50 | // SMM Handler Definition\r | |
51 | //\r | |
52 | #define EFI_HANDLER_SUCCESS 0x0000\r | |
53 | #define EFI_HANDLER_CRITICAL_EXIT 0x0001\r | |
54 | #define EFI_HANDLER_SOURCE_QUIESCED 0x0002\r | |
55 | #define EFI_HANDLER_SOURCE_PENDING 0x0003\r | |
56 | \r | |
57 | /**\r | |
58 | Entry Point to Callback service\r | |
59 | \r | |
60 | @param SmmImageHandle A handle allocated by the SMM infrastructure code\r | |
61 | to uniquely designate a specific DXE SMM driver.\r | |
62 | @param CommunicationBuffer A pointer to a collection of data in memory\r | |
63 | that will be conveyed from a non-SMM environment into an SMM environment.\r | |
64 | The buffer must be contiguous, physically mapped, and be a physical address.\r | |
65 | @param SourceSize The size of the CommunicationBuffer.\r | |
66 | \r | |
67 | @return Status code\r | |
68 | \r | |
69 | **/\r | |
70 | typedef\r | |
71 | EFI_STATUS\r | |
69686d56 | 72 | (EFIAPI *EFI_SMM_CALLBACK_ENTRY_POINT)(\r |
79964ac8 | 73 | IN EFI_HANDLE SmmImageHandle,\r |
74 | IN OUT VOID *CommunicationBuffer OPTIONAL,\r | |
75 | IN OUT UINTN *SourceSize OPTIONAL\r | |
76 | );\r | |
77 | \r | |
78 | //\r | |
79 | // SMM Base Protocol Definition\r | |
80 | //\r | |
81 | /**\r | |
82 | Register a given driver into SMRAM.This is the equivalent of performing\r | |
83 | the LoadImage/StartImage into System Management Mode.\r | |
84 | \r | |
85 | @param This Protocol instance pointer.\r | |
86 | @param FilePath Location of the image to be installed as the handler.\r | |
87 | @param SourceBuffer Optional source buffer in case of the image file\r | |
88 | being in memory.\r | |
89 | @param SourceSize Size of the source image file, if in memory.\r | |
90 | @param ImageHandle Pointer to the handle that reflects the driver\r | |
91 | loaded into SMM.\r | |
92 | @param LegacyIA32Binary The binary image to load is legacy 16 bit code.\r | |
93 | \r | |
94 | @retval EFI_SUCCESS The operation was successful.\r | |
95 | @retval EFI_OUT_OF_RESOURCES There were no additional SMRAM resources to load the handler\r | |
96 | @retval EFI_UNSUPPORTED This platform does not support 16-bit handlers.\r | |
97 | @retval EFI_UNSUPPORTED In runtime.\r | |
98 | @retval EFI_INVALID_PARAMETER The handlers was not the correct image type\r | |
99 | \r | |
100 | **/\r | |
101 | typedef\r | |
102 | EFI_STATUS\r | |
69686d56 | 103 | (EFIAPI *EFI_SMM_REGISTER_HANDLER)(\r |
79964ac8 | 104 | IN EFI_SMM_BASE_PROTOCOL *This,\r |
105 | IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r | |
106 | IN VOID *SourceBuffer OPTIONAL,\r | |
107 | IN UINTN SourceSize,\r | |
108 | OUT EFI_HANDLE *ImageHandle,\r | |
109 | IN BOOLEAN LegacyIA32Binary OPTIONAL\r | |
ed66e1bc | 110 | );\r |
79964ac8 | 111 | \r |
112 | /**\r | |
113 | Remove a given driver SMRAM. This is the equivalent of performing\r | |
114 | the UnloadImage System Management Mode.\r | |
115 | \r | |
116 | @param This Protocol instance pointer.\r | |
117 | @param ImageHandle Pointer to the handle that reflects the driver\r | |
118 | loaded into SMM.\r | |
119 | \r | |
120 | @retval EFI_SUCCESS The operation was successful\r | |
121 | @retval EFI_INVALID_PARAMETER The handler did not exist\r | |
122 | @retval EFI_UNSUPPORTED In runtime.\r | |
123 | \r | |
124 | **/\r | |
125 | typedef\r | |
126 | EFI_STATUS\r | |
69686d56 | 127 | (EFIAPI *EFI_SMM_UNREGISTER_HANDLER)(\r |
79964ac8 | 128 | IN EFI_SMM_BASE_PROTOCOL *This,\r |
129 | IN EFI_HANDLE ImageHandle\r | |
ed66e1bc | 130 | );\r |
79964ac8 | 131 | \r |
132 | /**\r | |
133 | The SMM Inter-module Communicate Service Communicate() function\r | |
134 | provides a services to send/received messages from a registered\r | |
135 | EFI service. The BASE protocol driver is responsible for doing\r | |
136 | any of the copies such that the data lives in boot-service accessible RAM.\r | |
137 | \r | |
138 | @param This Protocol instance pointer.\r | |
139 | @param ImageHandle Pointer to the handle that reflects the driver\r | |
140 | loaded into SMM.\r | |
141 | @param CommunicationBuffer Pointer to the buffer to convey into SMRAM.\r | |
142 | @param SourceSize Size of the contents of buffer..\r | |
143 | \r | |
144 | @retval EFI_SUCCESS The message was successfully posted\r | |
145 | @retval EFI_INVALID_PARAMETER The buffer was NULL\r | |
146 | \r | |
147 | **/\r | |
148 | typedef\r | |
149 | EFI_STATUS\r | |
69686d56 | 150 | (EFIAPI *EFI_SMM_COMMUNICATE)(\r |
79964ac8 | 151 | IN EFI_SMM_BASE_PROTOCOL *This,\r |
152 | IN EFI_HANDLE ImageHandle,\r | |
153 | IN OUT VOID *CommunicationBuffer,\r | |
154 | IN OUT UINTN *SourceSize\r | |
ed66e1bc | 155 | );\r |
79964ac8 | 156 | \r |
157 | /**\r | |
158 | Register a callback to execute within SMM.\r | |
159 | This allows receipt of messages created with the Boot Service COMMUNICATE.\r | |
160 | \r | |
161 | @param This Protocol instance pointer.\r | |
162 | @param CallbackAddress Address of the callback service\r | |
163 | @param MakeFirst If present, will stipulate that the handler is posted\r | |
164 | to be the first module executed in the dispatch table.\r | |
165 | @param MakeLast If present, will stipulate that the handler is posted\r | |
166 | to be last executed in the dispatch table.\r | |
167 | @param FloatingPointSave This is an optional parameter which informs the\r | |
168 | EFI_SMM_ACCESS_PROTOCOL Driver core if it needs to save\r | |
169 | the floating point register state. If any of the handlers\r | |
170 | require this, then the state will be saved for all of the handlers.\r | |
171 | \r | |
172 | @retval EFI_SUCCESS The operation was successful\r | |
173 | @retval EFI_OUT_OF_RESOURCES Not enough space in the dispatch queue\r | |
174 | @retval EFI_UNSUPPORTED In runtime.\r | |
175 | @retval EFI_UNSUPPORTED Not in SMM.\r | |
176 | \r | |
177 | **/\r | |
178 | typedef\r | |
179 | EFI_STATUS\r | |
69686d56 | 180 | (EFIAPI *EFI_SMM_CALLBACK_SERVICE)(\r |
79964ac8 | 181 | IN EFI_SMM_BASE_PROTOCOL *This,\r |
182 | IN EFI_HANDLE SmmImageHandle,\r | |
183 | IN EFI_SMM_CALLBACK_ENTRY_POINT CallbackAddress,\r | |
184 | IN BOOLEAN MakeLast OPTIONAL,\r | |
185 | IN BOOLEAN FloatingPointSave OPTIONAL\r | |
ed66e1bc | 186 | );\r |
79964ac8 | 187 | \r |
188 | /**\r | |
189 | The SmmAllocatePool() function allocates a memory region of Size bytes from memory of\r | |
190 | type PoolType and returns the address of the allocated memory in the location referenced\r | |
191 | by Buffer. This function allocates pages from EFI SMRAM Memory as needed to grow the\r | |
192 | requested pool type. All allocations are eight-byte aligned.\r | |
193 | \r | |
194 | @param This Protocol instance pointer.\r | |
195 | @param PoolType The type of pool to allocate.\r | |
196 | The only supported type is EfiRuntimeServicesData;\r | |
197 | the interface will internally map this runtime request to SMRAM.\r | |
198 | @param Size The number of bytes to allocate from the pool.\r | |
199 | @param Buffer A pointer to a pointer to the allocated buffer if the call\r | |
200 | succeeds; undefined otherwise.\r | |
201 | \r | |
202 | @retval EFI_SUCCESS The requested number of bytes was allocated.\r | |
203 | @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.\r | |
204 | @retval EFI_INVALID_PARAMETER PoolType was invalid.\r | |
205 | @retval EFI_UNSUPPORTED In runtime.\r | |
206 | \r | |
207 | **/\r | |
208 | typedef\r | |
209 | EFI_STATUS\r | |
69686d56 | 210 | (EFIAPI *EFI_SMM_ALLOCATE_POOL)(\r |
79964ac8 | 211 | IN EFI_SMM_BASE_PROTOCOL *This,\r |
212 | IN EFI_MEMORY_TYPE PoolType,\r | |
213 | IN UINTN Size,\r | |
214 | OUT VOID **Buffer\r | |
ed66e1bc | 215 | );\r |
79964ac8 | 216 | \r |
217 | /**\r | |
218 | The SmmFreePool() function returns the memory specified by Buffer to the system.\r | |
219 | On return, the memory's type is EFI SMRAM Memory. The Buffer that is freed must\r | |
220 | have been allocated by SmmAllocatePool().\r | |
221 | \r | |
222 | @param This Protocol instance pointer.\r | |
223 | @param Buffer Pointer to the buffer allocation.\r | |
224 | \r | |
225 | @retval EFI_SUCCESS The memory was returned to the system.\r | |
226 | @retval EFI_INVALID_PARAMETER Buffer was invalid.\r | |
227 | @retval EFI_UNSUPPORTED In runtime.\r | |
228 | \r | |
229 | **/\r | |
230 | typedef\r | |
231 | EFI_STATUS\r | |
69686d56 | 232 | (EFIAPI *EFI_SMM_FREE_POOL)(\r |
79964ac8 | 233 | IN EFI_SMM_BASE_PROTOCOL *This,\r |
234 | IN VOID *Buffer\r | |
ed66e1bc | 235 | );\r |
79964ac8 | 236 | \r |
237 | /**\r | |
238 | This routine tells caller if execution context is SMM or not.\r | |
239 | \r | |
240 | @param This Protocol instance pointer.\r | |
241 | @param InSmm Whether the caller is inside SMM for IA-32 or servicing a PMI for the Itanium processor family.\r | |
242 | \r | |
243 | @retval EFI_SUCCESS The operation was successful\r | |
244 | \r | |
245 | **/\r | |
246 | typedef\r | |
247 | EFI_STATUS\r | |
69686d56 | 248 | (EFIAPI *EFI_SMM_INSIDE_OUT)(\r |
79964ac8 | 249 | IN EFI_SMM_BASE_PROTOCOL *This,\r |
250 | OUT BOOLEAN *InSmm\r | |
ed66e1bc | 251 | );\r |
79964ac8 | 252 | \r |
253 | /**\r | |
254 | The GetSmstLocation() function returns the locatin of the System Management\r | |
255 | Service Table. The use of the API is such that a driver can discover the\r | |
256 | location of the SMST in its entry point and then cache it in some driver\r | |
257 | global variable so that the SMST can be invoked in subsequent callbacks.\r | |
258 | \r | |
259 | @param This Protocol instance pointer.\r | |
260 | @param Smst Pointer to the SMST.\r | |
261 | \r | |
262 | @retval EFI_SUCCESS The operation was successful\r | |
263 | @retval EFI_INVALID_PARAMETER Smst was invalid.\r | |
264 | @retval EFI_UNSUPPORTED Not in SMM.\r | |
265 | \r | |
266 | **/\r | |
267 | typedef\r | |
268 | EFI_STATUS\r | |
69686d56 | 269 | (EFIAPI *EFI_SMM_GET_SMST_LOCATION)(\r |
79964ac8 | 270 | IN EFI_SMM_BASE_PROTOCOL *This,\r |
271 | IN OUT EFI_SMM_SYSTEM_TABLE **Smst\r | |
ed66e1bc | 272 | );\r |
79964ac8 | 273 | \r |
274 | /**\r | |
275 | @par Protocol Description:\r | |
276 | This protocol is used to install SMM handlers for support of subsequent SMI/PMI\r | |
277 | activations. This protocol is available on both IA-32 and Itanium-based systems.\r | |
278 | \r | |
279 | @param Register\r | |
280 | Registers a handler to run in System Management RAM (SMRAM).\r | |
281 | \r | |
282 | @param UnRegister\r | |
283 | Removes a handler from execution in SMRAM.\r | |
284 | \r | |
285 | @param Communicate\r | |
286 | Sends/receives a message for a registered handler.\r | |
287 | \r | |
288 | @param RegisterCallback\r | |
289 | Registers a callback from the constructor.\r | |
290 | \r | |
291 | @param InSmm\r | |
292 | Detects whether the caller is inside or outside of SMM. SName\r | |
293 | \r | |
294 | @param SmmAllocatePool\r | |
295 | Allocates SMRAM.\r | |
296 | \r | |
297 | @param SmmFreePool\r | |
298 | Deallocates SMRAM.\r | |
299 | \r | |
300 | @param GetSmstLocation\r | |
301 | Retrieves the location of the System Management System Table (SMST).\r | |
302 | \r | |
303 | **/\r | |
304 | struct _EFI_SMM_BASE_PROTOCOL {\r | |
305 | EFI_SMM_REGISTER_HANDLER Register;\r | |
306 | EFI_SMM_UNREGISTER_HANDLER UnRegister;\r | |
307 | EFI_SMM_COMMUNICATE Communicate;\r | |
308 | EFI_SMM_CALLBACK_SERVICE RegisterCallback;\r | |
309 | EFI_SMM_INSIDE_OUT InSmm;\r | |
310 | EFI_SMM_ALLOCATE_POOL SmmAllocatePool;\r | |
311 | EFI_SMM_FREE_POOL SmmFreePool;\r | |
312 | EFI_SMM_GET_SMST_LOCATION GetSmstLocation;\r | |
313 | };\r | |
314 | \r | |
315 | extern EFI_GUID gEfiSmmBaseProtocolGuid;\r | |
316 | \r | |
317 | #endif\r |