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