2 This file declares SMM Base abstraction protocol.
3 This is the base level of compatiblity for SMM drivers.
5 Copyright (c) 2007, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 Module Name: SmmBase.h
16 @par Revision Reference:
17 This Protocol is defined in Framework of EFI SMM Core Interface Spec
25 #include <FrameworkSmm.h>
27 #define EFI_SMM_BASE_PROTOCOL_GUID \
29 0x1390954D, 0xda95, 0x4227, {0x93, 0x28, 0x72, 0x82, 0xc2, 0x17, 0xda, 0xa8 } \
32 typedef struct _EFI_SMM_BASE_PROTOCOL EFI_SMM_BASE_PROTOCOL
;
35 // SMM Handler Definition
37 #define EFI_HANDLER_SUCCESS 0x0000
38 #define EFI_HANDLER_CRITICAL_EXIT 0x0001
39 #define EFI_HANDLER_SOURCE_QUIESCED 0x0002
40 #define EFI_HANDLER_SOURCE_PENDING 0x0003
43 Entry Point to Callback service
45 @param SmmImageHandle A handle allocated by the SMM infrastructure code
46 to uniquely designate a specific DXE SMM driver.
47 @param CommunicationBuffer A pointer to a collection of data in memory
48 that will be conveyed from a non-SMM environment into an SMM environment.
49 The buffer must be contiguous, physically mapped, and be a physical address.
50 @param SourceSize The size of the CommunicationBuffer.
57 (EFIAPI
*EFI_SMM_CALLBACK_ENTRY_POINT
) (
58 IN EFI_HANDLE SmmImageHandle
,
59 IN OUT VOID
*CommunicationBuffer OPTIONAL
,
60 IN OUT UINTN
*SourceSize OPTIONAL
64 // SMM Base Protocol Definition
67 Register a given driver into SMRAM.This is the equivalent of performing
68 the LoadImage/StartImage into System Management Mode.
70 @param This Protocol instance pointer.
71 @param FilePath Location of the image to be installed as the handler.
72 @param SourceBuffer Optional source buffer in case of the image file
74 @param SourceSize Size of the source image file, if in memory.
75 @param ImageHandle Pointer to the handle that reflects the driver
77 @param LegacyIA32Binary The binary image to load is legacy 16 bit code.
79 @retval EFI_SUCCESS The operation was successful.
80 @retval EFI_OUT_OF_RESOURCES There were no additional SMRAM resources to load the handler
81 @retval EFI_UNSUPPORTED This platform does not support 16-bit handlers.
82 @retval EFI_UNSUPPORTED In runtime.
83 @retval EFI_INVALID_PARAMETER The handlers was not the correct image type
88 (EFIAPI
*EFI_SMM_REGISTER_HANDLER
) (
89 IN EFI_SMM_BASE_PROTOCOL
*This
,
90 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
91 IN VOID
*SourceBuffer OPTIONAL
,
93 OUT EFI_HANDLE
*ImageHandle
,
94 IN BOOLEAN LegacyIA32Binary OPTIONAL
99 Remove a given driver SMRAM. This is the equivalent of performing
100 the UnloadImage System Management Mode.
102 @param This Protocol instance pointer.
103 @param ImageHandle Pointer to the handle that reflects the driver
106 @retval EFI_SUCCESS The operation was successful
107 @retval EFI_INVALID_PARAMETER The handler did not exist
108 @retval EFI_UNSUPPORTED In runtime.
113 (EFIAPI
*EFI_SMM_UNREGISTER_HANDLER
) (
114 IN EFI_SMM_BASE_PROTOCOL
*This
,
115 IN EFI_HANDLE ImageHandle
120 The SMM Inter-module Communicate Service Communicate() function
121 provides a services to send/received messages from a registered
122 EFI service. The BASE protocol driver is responsible for doing
123 any of the copies such that the data lives in boot-service accessible RAM.
125 @param This Protocol instance pointer.
126 @param ImageHandle Pointer to the handle that reflects the driver
128 @param CommunicationBuffer Pointer to the buffer to convey into SMRAM.
129 @param SourceSize Size of the contents of buffer..
131 @retval EFI_SUCCESS The message was successfully posted
132 @retval EFI_INVALID_PARAMETER The buffer was NULL
137 (EFIAPI
*EFI_SMM_COMMUNICATE
) (
138 IN EFI_SMM_BASE_PROTOCOL
*This
,
139 IN EFI_HANDLE ImageHandle
,
140 IN OUT VOID
*CommunicationBuffer
,
141 IN OUT UINTN
*SourceSize
146 Register a callback to execute within SMM.
147 This allows receipt of messages created with the Boot Service COMMUNICATE.
149 @param This Protocol instance pointer.
150 @param CallbackAddress Address of the callback service
151 @param MakeFirst If present, will stipulate that the handler is posted
152 to be the first module executed in the dispatch table.
153 @param MakeLast If present, will stipulate that the handler is posted
154 to be last executed in the dispatch table.
155 @param FloatingPointSave This is an optional parameter which informs the
156 EFI_SMM_ACCESS_PROTOCOL Driver core if it needs to save
157 the floating point register state. If any of the handlers
158 require this, then the state will be saved for all of the handlers.
160 @retval EFI_SUCCESS The operation was successful
161 @retval EFI_OUT_OF_RESOURCES Not enough space in the dispatch queue
162 @retval EFI_UNSUPPORTED In runtime.
163 @retval EFI_UNSUPPORTED Not in SMM.
168 (EFIAPI
*EFI_SMM_CALLBACK_SERVICE
) (
169 IN EFI_SMM_BASE_PROTOCOL
*This
,
170 IN EFI_HANDLE SmmImageHandle
,
171 IN EFI_SMM_CALLBACK_ENTRY_POINT CallbackAddress
,
172 IN BOOLEAN MakeLast OPTIONAL
,
173 IN BOOLEAN FloatingPointSave OPTIONAL
178 The SmmAllocatePool() function allocates a memory region of Size bytes from memory of
179 type PoolType and returns the address of the allocated memory in the location referenced
180 by Buffer. This function allocates pages from EFI SMRAM Memory as needed to grow the
181 requested pool type. All allocations are eight-byte aligned.
183 @param This Protocol instance pointer.
184 @param PoolType The type of pool to allocate.
185 The only supported type is EfiRuntimeServicesData;
186 the interface will internally map this runtime request to SMRAM.
187 @param Size The number of bytes to allocate from the pool.
188 @param Buffer A pointer to a pointer to the allocated buffer if the call
189 succeeds; undefined otherwise.
191 @retval EFI_SUCCESS The requested number of bytes was allocated.
192 @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.
193 @retval EFI_INVALID_PARAMETER PoolType was invalid.
194 @retval EFI_UNSUPPORTED In runtime.
199 (EFIAPI
*EFI_SMM_ALLOCATE_POOL
) (
200 IN EFI_SMM_BASE_PROTOCOL
*This
,
201 IN EFI_MEMORY_TYPE PoolType
,
208 The SmmFreePool() function returns the memory specified by Buffer to the system.
209 On return, the memory's type is EFI SMRAM Memory. The Buffer that is freed must
210 have been allocated by SmmAllocatePool().
212 @param This Protocol instance pointer.
213 @param Buffer Pointer to the buffer allocation.
215 @retval EFI_SUCCESS The memory was returned to the system.
216 @retval EFI_INVALID_PARAMETER Buffer was invalid.
217 @retval EFI_UNSUPPORTED In runtime.
222 (EFIAPI
*EFI_SMM_FREE_POOL
) (
223 IN EFI_SMM_BASE_PROTOCOL
*This
,
229 This routine tells caller if execution context is SMM or not.
231 @param This Protocol instance pointer.
232 @param InSmm Whether the caller is inside SMM for IA-32 or servicing a PMI for the Itanium processor family.
234 @retval EFI_SUCCESS The operation was successful
239 (EFIAPI
*EFI_SMM_INSIDE_OUT
) (
240 IN EFI_SMM_BASE_PROTOCOL
*This
,
246 The GetSmstLocation() function returns the locatin of the System Management
247 Service Table. The use of the API is such that a driver can discover the
248 location of the SMST in its entry point and then cache it in some driver
249 global variable so that the SMST can be invoked in subsequent callbacks.
251 @param This Protocol instance pointer.
252 @param Smst Pointer to the SMST.
254 @retval EFI_SUCCESS The operation was successful
255 @retval EFI_INVALID_PARAMETER Smst was invalid.
256 @retval EFI_UNSUPPORTED Not in SMM.
261 (EFIAPI
*EFI_SMM_GET_SMST_LOCATION
) (
262 IN EFI_SMM_BASE_PROTOCOL
*This
,
263 IN OUT EFI_SMM_SYSTEM_TABLE
**Smst
268 @par Protocol Description:
269 This protocol is used to install SMM handlers for support of subsequent SMI/PMI
270 activations. This protocol is available on both IA-32 and Itanium-based systems.
273 Registers a handler to run in System Management RAM (SMRAM).
276 Removes a handler from execution in SMRAM.
279 Sends/receives a message for a registered handler.
281 @param RegisterCallback
282 Registers a callback from the constructor.
285 Detects whether the caller is inside or outside of SMM. SName
287 @param SmmAllocatePool
293 @param GetSmstLocation
294 Retrieves the location of the System Management System Table (SMST).
297 struct _EFI_SMM_BASE_PROTOCOL
{
298 EFI_SMM_REGISTER_HANDLER Register
;
299 EFI_SMM_UNREGISTER_HANDLER UnRegister
;
300 EFI_SMM_COMMUNICATE Communicate
;
301 EFI_SMM_CALLBACK_SERVICE RegisterCallback
;
302 EFI_SMM_INSIDE_OUT InSmm
;
303 EFI_SMM_ALLOCATE_POOL SmmAllocatePool
;
304 EFI_SMM_FREE_POOL SmmFreePool
;
305 EFI_SMM_GET_SMST_LOCATION GetSmstLocation
;
308 extern EFI_GUID gEfiSmmBaseProtocolGuid
;