2 This file declares SMM Base abstraction protocol.
3 This protocol is used to install SMM handlers for support of subsequent SMI/PMI activations. This
4 protocol is available on both IA-32 and Itanium based systems.
6 The EFI_SMM_BASE_PROTOCOL is a set of services that is exported by a processor device. It is
7 a required protocol for the platform processor. This protocol can be used in both boot services and
8 runtime mode. However, only the following member functions need to exist into runtime:
11 This protocol is responsible for registering the handler services. The order in which the handlers are
12 executed is prescribed only with respect to the MakeLast flag in the RegisterCallback()
13 service. The driver exports these registration and unregistration services in boot services mode, but
14 the registered handlers will execute through the preboot and runtime. The only way to change the
15 behavior of a registered driver after ExitBootServices() has been invoked is to use some
16 private communication mechanism with the driver to order it to quiesce. This model permits typical
17 use cases, such as invoking the handler to enter ACPI mode, where the OS loader would make this
18 call before boot services are terminated. On the other hand, handlers for services such as chipset
19 workarounds for the century rollover in CMOS should provide commensurate services throughout
20 preboot and OS runtime.
22 @par Revision Reference:
23 This Protocol is defined in Framework of EFI SMM Core Interface Spec
26 Copyright (c) 2007 - 2009, Intel Corporation
27 All rights reserved. This program and the accompanying materials
28 are licensed and made available under the terms and conditions of the BSD License
29 which accompanies this distribution. The full text of the license may be found at
30 http://opensource.org/licenses/bsd-license.php
32 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
33 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
40 #define EFI_SMM_BASE_PROTOCOL_GUID \
42 0x1390954D, 0xda95, 0x4227, {0x93, 0x28, 0x72, 0x82, 0xc2, 0x17, 0xda, 0xa8 } \
45 typedef struct _EFI_SMM_BASE_PROTOCOL EFI_SMM_BASE_PROTOCOL
;
48 // SMM Handler Definition
50 #define EFI_HANDLER_SUCCESS 0x0000
51 #define EFI_HANDLER_CRITICAL_EXIT 0x0001
52 #define EFI_HANDLER_SOURCE_QUIESCED 0x0002
53 #define EFI_HANDLER_SOURCE_PENDING 0x0003
56 Entry Point to Callback service
58 @param[in] SmmImageHandle A handle allocated by the SMM infrastructure code
59 to uniquely designate a specific DXE SMM driver.
60 @param[in] CommunicationBuffer A pointer to a collection of data in memory
61 that will be conveyed from a non-SMM environment into an SMM environment.
62 The buffer must be contiguous, physically mapped, and be a physical address.
63 @param[in] SourceSize The size of the CommunicationBuffer.
70 (EFIAPI
*EFI_SMM_CALLBACK_ENTRY_POINT
)(
71 IN EFI_HANDLE SmmImageHandle
,
72 IN OUT VOID
*CommunicationBuffer OPTIONAL
,
73 IN OUT UINTN
*SourceSize OPTIONAL
77 // SMM Base Protocol Definition
80 Register a given driver into SMRAM.This is the equivalent of performing
81 the LoadImage/StartImage into System Management Mode.
83 @param[in] This Protocol instance pointer.
84 @param[in] FilePath Location of the image to be installed as the handler.
85 @param[in] SourceBuffer Optional source buffer in case of the image file
87 @param[in] SourceSize Size of the source image file, if in memory.
88 @param[out] ImageHandle The handle that the base driver uses to decode
89 the handler. Unique among SMM handlers only,
90 not unique across DXE/EFI.
91 @param[in] LegacyIA32Binary An optional parameter that details that the associated
92 file is a real-mode IA-32 binary.
94 @retval EFI_SUCCESS The operation was successful.
95 @retval EFI_OUT_OF_RESOURCES There were no additional SMRAM resources to load the handler
96 @retval EFI_UNSUPPORTED This platform does not support 16-bit handlers.
97 @retval EFI_UNSUPPORTED In runtime.
98 @retval EFI_INVALID_PARAMETER The handlers was not the correct image type
103 (EFIAPI
*EFI_SMM_REGISTER_HANDLER
)(
104 IN EFI_SMM_BASE_PROTOCOL
*This
,
105 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
106 IN VOID
*SourceBuffer OPTIONAL
,
108 OUT EFI_HANDLE
*ImageHandle
,
109 IN BOOLEAN LegacyIA32Binary OPTIONAL
113 Removes a handler from execution within SMRAM. This is the equivalent of performing
114 the UnloadImage in System Management Mode.
116 @param[in] This Protocol instance pointer.
117 @param[in] ImageHandle The handler to be removed.
119 @retval EFI_SUCCESS The operation was successful
120 @retval EFI_INVALID_PARAMETER The handler did not exist
121 @retval EFI_UNSUPPORTED In runtime.
126 (EFIAPI
*EFI_SMM_UNREGISTER_HANDLER
)(
127 IN EFI_SMM_BASE_PROTOCOL
*This
,
128 IN EFI_HANDLE ImageHandle
132 The SMM Inter-module Communicate Service Communicate() function
133 provides a services to send/received messages from a registered
134 EFI service. The BASE protocol driver is responsible for doing
135 any of the copies such that the data lives in boot-service-accessible RAM.
137 @param[in] This Protocol instance pointer.
138 @param[in] ImageHandle The handle of the registered driver.
139 @param[in,out] CommunicationBuffer Pointer to the buffer to convey into SMRAM.
140 @param[in,out] SourceSize The size of the data buffer being passed in.
141 On exit, the size of data being returned.
142 Zero if the handler does not wish to reply with any data.
144 @retval EFI_SUCCESS The message was successfully posted
145 @retval EFI_INVALID_PARAMETER The buffer was NULL
150 (EFIAPI
*EFI_SMM_COMMUNICATE
)(
151 IN EFI_SMM_BASE_PROTOCOL
*This
,
152 IN EFI_HANDLE ImageHandle
,
153 IN OUT VOID
*CommunicationBuffer
,
154 IN OUT UINTN
*SourceSize
158 Register a callback to execute within SMM.
159 This allows receipt of messages created with EFI_SMM_BASE_PROTOCOL.Communicate().
161 @param[in] This Protocol instance pointer.
162 @param[in] SmmImageHandle Handle of the callback service.
163 @param[in] CallbackAddress Address of the callback service.
164 @param[in] MakeLast If present, will stipulate that the handler is posted to
165 be executed last in the dispatch table.
166 @param[in] FloatingPointSave This is an optional parameter which informs the
167 EFI_SMM_ACCESS_PROTOCOL Driver core if it needs to save
168 the floating point register state. If any of the handlers
169 require this, then the state will be saved for all of the handlers.
171 @retval EFI_SUCCESS The operation was successful
172 @retval EFI_OUT_OF_RESOURCES Not enough space in the dispatch queue
173 @retval EFI_UNSUPPORTED In runtime.
174 @retval EFI_UNSUPPORTED The caller is not in SMM.
179 (EFIAPI
*EFI_SMM_CALLBACK_SERVICE
)(
180 IN EFI_SMM_BASE_PROTOCOL
*This
,
181 IN EFI_HANDLE SmmImageHandle
,
182 IN EFI_SMM_CALLBACK_ENTRY_POINT CallbackAddress
,
183 IN BOOLEAN MakeLast OPTIONAL
,
184 IN BOOLEAN FloatingPointSave OPTIONAL
188 The SmmAllocatePool() function allocates a memory region of Size bytes from memory of
189 type PoolType and returns the address of the allocated memory in the location referenced
190 by Buffer. This function allocates pages from EFI SMRAM Memory as needed to grow the
191 requested pool type. All allocations are eight-byte aligned.
193 @param[in] This Protocol instance pointer.
194 @param[in] PoolType The type of pool to allocate.
195 The only supported type is EfiRuntimeServicesData;
196 the interface will internally map this runtime request to
197 SMRAM for IA-32 and leave as this type for the Itanium
198 processor family. Other types can be ignored.
199 @param[in] Size The number of bytes to allocate from the pool.
200 @param[out] Buffer A pointer to a pointer to the allocated buffer if the call
201 succeeds; undefined otherwise.
203 @retval EFI_SUCCESS The requested number of bytes was allocated.
204 @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.
205 @retval EFI_UNSUPPORTED In runtime.
210 (EFIAPI
*EFI_SMM_ALLOCATE_POOL
)(
211 IN EFI_SMM_BASE_PROTOCOL
*This
,
212 IN EFI_MEMORY_TYPE PoolType
,
218 The SmmFreePool() function returns the memory specified by Buffer to the system.
219 On return, the memory's type is EFI SMRAM Memory. The Buffer that is freed must
220 have been allocated by SmmAllocatePool().
222 @param[in] This Protocol instance pointer.
223 @param[in] Buffer Pointer to the buffer allocation.
225 @retval EFI_SUCCESS The memory was returned to the system.
226 @retval EFI_INVALID_PARAMETER Buffer was invalid.
227 @retval EFI_UNSUPPORTED In runtime.
232 (EFIAPI
*EFI_SMM_FREE_POOL
)(
233 IN EFI_SMM_BASE_PROTOCOL
*This
,
238 This routine tells caller if execution context is SMM or not.
240 @param[in] This Protocol instance pointer.
241 @param[out] InSmm Whether the caller is inside SMM for IA-32
242 or servicing a PMI for the Itanium processor
245 @retval EFI_SUCCESS The operation was successful
246 @retval EFI_INVALID_PARAMETER InSmm was NULL.
251 (EFIAPI
*EFI_SMM_INSIDE_OUT
)(
252 IN EFI_SMM_BASE_PROTOCOL
*This
,
257 The GetSmstLocation() function returns the locatin of the System Management
258 Service Table. The use of the API is such that a driver can discover the
259 location of the SMST in its entry point and then cache it in some driver
260 global variable so that the SMST can be invoked in subsequent callbacks.
262 @param[in] This Protocol instance pointer.
263 @param[in] Smst Pointer to the SMST.
265 @retval EFI_SUCCESS The operation was successful
266 @retval EFI_INVALID_PARAMETER Smst was invalid.
267 @retval EFI_UNSUPPORTED Not in SMM.
272 (EFIAPI
*EFI_SMM_GET_SMST_LOCATION
)(
273 IN EFI_SMM_BASE_PROTOCOL
*This
,
274 IN OUT EFI_SMM_SYSTEM_TABLE
**Smst
278 /// This protocol is used to install SMM handlers for support of subsequent SMI/PMI
279 /// activations. This protocol is available on both IA-32 and Itanium-based systems.
281 struct _EFI_SMM_BASE_PROTOCOL
{
282 EFI_SMM_REGISTER_HANDLER Register
;
283 EFI_SMM_UNREGISTER_HANDLER UnRegister
;
284 EFI_SMM_COMMUNICATE Communicate
;
285 EFI_SMM_CALLBACK_SERVICE RegisterCallback
;
286 EFI_SMM_INSIDE_OUT InSmm
;
287 EFI_SMM_ALLOCATE_POOL SmmAllocatePool
;
288 EFI_SMM_FREE_POOL SmmFreePool
;
289 EFI_SMM_GET_SMST_LOCATION GetSmstLocation
;
292 extern EFI_GUID gEfiSmmBaseProtocolGuid
;