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