2 Include file for SMM Base Protocol on SMM Base2 Protocol Thunk driver.
4 Copyright (c) 2009, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef _SMM_BASE_ON_SMM_BASE2_THUNK_H_
16 #define _SMM_BASE_ON_SMM_BASE2_THUNK_H_
19 #include <FrameworkSmm.h>
20 #include <Library/DebugLib.h>
21 #include <Library/UefiBootServicesTableLib.h>
22 #include <Library/UefiDriverEntryPoint.h>
23 #include <Library/UefiLib.h>
24 #include <Guid/SmmBaseThunkCommunication.h>
25 #include <Protocol/SmmBase2.h>
26 #include <Protocol/SmmCommunication.h>
27 #include <Protocol/SmmBaseHelperReady.h>
30 Register a given driver into SMRAM. This is the equivalent of performing
31 the LoadImage/StartImage into System Management Mode.
33 @param[in] This Protocol instance pointer.
34 @param[in] FilePath Location of the image to be installed as the handler.
35 @param[in] SourceBuffer Optional source buffer in case the image file
37 @param[in] SourceSize Size of the source image file, if in memory.
38 @param[out] ImageHandle The handle that the base driver uses to decode
39 the handler. Unique among SMM handlers only,
40 not unique across DXE/EFI.
41 @param[in] LegacyIA32Binary An optional parameter specifying that the associated
42 file is a real-mode IA-32 binary.
44 @retval EFI_SUCCESS The operation was successful.
45 @retval EFI_OUT_OF_RESOURCES There were no additional SMRAM resources to load the handler
46 @retval EFI_UNSUPPORTED This platform does not support 16-bit handlers.
47 @retval EFI_UNSUPPORTED Platform is in runtime.
48 @retval EFI_INVALID_PARAMETER The handlers was not the correct image type
53 IN EFI_SMM_BASE_PROTOCOL
*This
,
54 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
55 IN VOID
*SourceBuffer
,
57 OUT EFI_HANDLE
*ImageHandle
,
58 IN BOOLEAN LegacyIA32Binary
62 Removes a handler from execution within SMRAM. This is the equivalent of performing
63 the UnloadImage in System Management Mode.
65 @param[in] This Protocol instance pointer.
66 @param[in] ImageHandle The handler to be removed.
68 @retval EFI_SUCCESS The operation was successful
69 @retval EFI_INVALID_PARAMETER The handler did not exist
70 @retval EFI_UNSUPPORTED Platform is in runtime.
75 IN EFI_SMM_BASE_PROTOCOL
*This
,
76 IN EFI_HANDLE ImageHandle
80 The SMM Inter-module Communicate Service Communicate() function
81 provides a service to send/receive messages from a registered
82 EFI service. The BASE protocol driver is responsible for doing
83 any of the copies such that the data lives in boot-service-accessible RAM.
85 @param[in] This Protocol instance pointer.
86 @param[in] ImageHandle The handle of the registered driver.
87 @param[in,out] CommunicationBuffer Pointer to the buffer to convey into SMRAM.
88 @param[in,out] BufferSize The size of the data buffer being passed in.
89 On exit, the size of data being returned.
90 Zero if the handler does not wish to reply with any data.
92 @retval EFI_SUCCESS The message was successfully posted
93 @retval EFI_INVALID_PARAMETER The buffer was NULL
98 IN EFI_SMM_BASE_PROTOCOL
*This
,
99 IN EFI_HANDLE ImageHandle
,
100 IN OUT VOID
*CommunicationBuffer
,
101 IN OUT UINTN
*BufferSize
105 Register a callback to execute within SMM.
106 This allows receipt of messages created with EFI_SMM_BASE_PROTOCOL.Communicate().
108 @param[in] This Protocol instance pointer.
109 @param[in] SmmImageHandle Handle of the callback service.
110 @param[in] CallbackAddress Address of the callback service.
111 @param[in] MakeLast If present, will stipulate that the handler is posted to
112 be executed last in the dispatch table.
113 @param[in] FloatingPointSave An optional parameter that informs the
114 EFI_SMM_ACCESS_PROTOCOL Driver core if it needs to save
115 the floating point register state. If any handler
116 require this, the state will be saved for all handlers.
118 @retval EFI_SUCCESS The operation was successful
119 @retval EFI_OUT_OF_RESOURCES Not enough space in the dispatch queue
120 @retval EFI_UNSUPPORTED Platform is in runtime.
121 @retval EFI_UNSUPPORTED The caller is not in SMM.
125 SmmBaseRegisterCallback (
126 IN EFI_SMM_BASE_PROTOCOL
*This
,
127 IN EFI_HANDLE SmmImageHandle
,
128 IN EFI_SMM_CALLBACK_ENTRY_POINT CallbackAddress
,
130 IN BOOLEAN FloatingPointSave
134 This routine tells caller if execution context is SMM or not.
136 @param[in] This Protocol instance pointer.
137 @param[out] InSmm Whether the caller is inside SMM for IA-32
138 or servicing a PMI for the Itanium processor
141 @retval EFI_SUCCESS The operation was successful
142 @retval EFI_INVALID_PARAMETER InSmm was NULL.
147 IN EFI_SMM_BASE_PROTOCOL
*This
,
152 The SmmAllocatePool() function allocates a memory region of Size bytes from memory of
153 type PoolType and returns the address of the allocated memory in the location referenced
154 by Buffer. This function allocates pages from EFI SMRAM Memory as needed to grow the
155 requested pool type. All allocations are eight-byte aligned.
157 @param[in] This Protocol instance pointer.
158 @param[in] PoolType The type of pool to allocate.
159 The only supported type is EfiRuntimeServicesData;
160 the interface will internally map this runtime request to
161 SMRAM for IA-32 and leave as this type for the Itanium
162 processor family. Other types can be ignored.
163 @param[in] Size The number of bytes to allocate from the pool.
164 @param[out] Buffer A pointer to a pointer to the allocated buffer if the call
165 succeeds; undefined otherwise.
167 @retval EFI_SUCCESS The requested number of bytes was allocated.
168 @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.
169 @retval EFI_UNSUPPORTED Platform is in runtime.
173 SmmBaseSmmAllocatePool (
174 IN EFI_SMM_BASE_PROTOCOL
*This
,
175 IN EFI_MEMORY_TYPE PoolType
,
181 The SmmFreePool() function returns the memory specified by Buffer to the system.
182 On return, the memory's type is EFI SMRAM Memory. The Buffer that is freed must
183 have been allocated by SmmAllocatePool().
185 @param[in] This Protocol instance pointer.
186 @param[in] Buffer Pointer to the buffer allocation.
188 @retval EFI_SUCCESS The memory was returned to the system.
189 @retval EFI_INVALID_PARAMETER Buffer was invalid.
190 @retval EFI_UNSUPPORTED Platform is in runtime.
195 IN EFI_SMM_BASE_PROTOCOL
*This
,
200 The GetSmstLocation() function returns the location of the System Management
201 Service Table. The use of the API is such that a driver can discover the
202 location of the SMST in its entry point and then cache it in some driver
203 global variable so that the SMST can be invoked in subsequent callbacks.
205 @param[in] This Protocol instance pointer.
206 @param[in] Smst Pointer to the SMST.
208 @retval EFI_SUCCESS The operation was successful
209 @retval EFI_INVALID_PARAMETER Smst was invalid.
210 @retval EFI_UNSUPPORTED Not in SMM.
214 SmmBaseGetSmstLocation (
215 IN EFI_SMM_BASE_PROTOCOL
*This
,
216 OUT EFI_SMM_SYSTEM_TABLE
**Smst