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