04c5d169 |
1 | /** @file\r |
2 | Common definitions in the Platform Initialization Specification version 1.2\r |
3 | VOLUME 4 System Management Mode Core Interface version.\r |
4 | \r |
8fc71dec |
5 | Copyright (c) 2009 - 2010, Intel Corporation\r |
04c5d169 |
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 | **/\r |
15 | \r |
16 | #ifndef _PI_SMMCIS_H_\r |
17 | #define _PI_SMMCIS_H_\r |
18 | \r |
19 | #include <Pi/PiMultiPhase.h>\r |
8fc71dec |
20 | #include <Protocol/SmmCpuIo2.h>\r |
04c5d169 |
21 | \r |
a2bb197e |
22 | ///\r |
23 | /// Note:\r |
24 | /// To avoid name conflict between PI and Framework SMM spec, the following names defined\r |
25 | /// in PI 1.2 SMM spec are renamed. These renamings are not yet in a public PI spec and errta.\r |
26 | ///\r |
27 | /// EFI_SMM_SYSTEM_TABLE -> EFI_SMM_SYSTEM_TABLE2\r |
28 | /// EFI_SMM_SYSTEM_TABLE_REVISION -> EFI_SMM_SYSTEM_TABLE2_REVISION\r |
29 | /// EFI_SMM_INSTALL_CONFIGURATION_TABLE -> EFI_SMM_INSTALL_CONFIGURATION_TABLE2\r |
30 | ///\r |
31 | \r |
32 | typedef struct _EFI_SMM_SYSTEM_TABLE2 EFI_SMM_SYSTEM_TABLE2;\r |
04c5d169 |
33 | \r |
34 | ///\r |
35 | /// The System Management System Table (SMST) signature\r |
36 | ///\r |
37 | #define SMM_SMST_SIGNATURE SIGNATURE_32 ('S', 'M', 'S', 'T')\r |
38 | ///\r |
39 | /// The System Management System Table (SMST) revision is 1.0\r |
40 | ///\r |
a2bb197e |
41 | #define EFI_SMM_SYSTEM_TABLE2_REVISION ((1 << 16) | (0x00))\r |
04c5d169 |
42 | \r |
43 | /**\r |
44 | Adds, updates, or removes a configuration table entry from the System Management System Table.\r |
45 | \r |
46 | The SmmInstallConfigurationTable() function is used to maintain the list\r |
47 | of configuration tables that are stored in the System Management System\r |
48 | Table. The list is stored as an array of (GUID, Pointer) pairs. The list\r |
49 | must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.\r |
50 | \r |
51 | @param[in] SystemTable A pointer to the SMM System Table (SMST).\r |
52 | @param[in] Guid A pointer to the GUID for the entry to add, update, or remove.\r |
53 | @param[in] Table A pointer to the buffer of the table to add.\r |
54 | @param[in] TableSize The size of the table to install.\r |
55 | \r |
56 | @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.\r |
57 | @retval EFI_INVALID_PARAMETER Guid is not valid.\r |
58 | @retval EFI_NOT_FOUND An attempt was made to delete a non-existent entry.\r |
59 | @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.\r |
60 | **/\r |
61 | typedef\r |
62 | EFI_STATUS\r |
a2bb197e |
63 | (EFIAPI *EFI_SMM_INSTALL_CONFIGURATION_TABLE2)(\r |
64 | IN CONST EFI_SMM_SYSTEM_TABLE2 *SystemTable,\r |
65 | IN CONST EFI_GUID *Guid,\r |
66 | IN VOID *Table,\r |
67 | IN UINTN TableSize\r |
04c5d169 |
68 | );\r |
69 | \r |
04c5d169 |
70 | /**\r |
71 | The SmmStartupThisAp() lets the caller to get one distinct application processor\r |
72 | (AP) in the enabled processor pool to execute a caller-provided code stream\r |
73 | while in SMM. It runs the given code on this processor and reports the status.\r |
74 | It must be noted that the supplied code stream will be run only on an enabled \r |
75 | processor which has also entered SMM. \r |
76 | \r |
77 | @param[in] Procedure A pointer to the code stream to be run on the designated AP of the system.\r |
78 | @param[in] CpuNumber The zero-based index of the processor number of the AP on which the code stream is supposed to run.\r |
79 | @param[in,out] ProcArguments Allow the caller to pass a list of parameters to the code that is run by the AP.\r |
80 | \r |
81 | @retval EFI_SUCCESS The call was successful and the return parameters are valid.\r |
82 | @retval EFI_INVALID_PARAMETER The input arguments are out of range.\r |
83 | @retval EFI_INVALID_PARAMETER The CPU requested is not available on this SMI invocation.\r |
84 | @retval EFI_INVALID_PARAMETER The CPU cannot support an additional service invocation.\r |
85 | **/\r |
86 | typedef\r |
87 | EFI_STATUS\r |
88 | (EFIAPI *EFI_SMM_STARTUP_THIS_AP)(\r |
89 | IN EFI_AP_PROCEDURE Procedure,\r |
90 | IN UINTN CpuNumber,\r |
91 | IN OUT VOID *ProcArguments OPTIONAL\r |
92 | );\r |
93 | \r |
94 | /**\r |
95 | Function prototype for protocol install notification.\r |
96 | \r |
97 | @param[in] Protocol Points to the protocol's unique identifier.\r |
98 | @param[in] Interface Points to the interface instance.\r |
99 | @param[in] Handle The handle on which the interface was installed.\r |
100 | \r |
101 | @return Status Code\r |
102 | **/\r |
103 | typedef\r |
104 | EFI_STATUS\r |
105 | (EFIAPI *EFI_SMM_NOTIFY_FN)(\r |
106 | IN CONST EFI_GUID *Protocol,\r |
107 | IN VOID *Interface,\r |
108 | IN EFI_HANDLE Handle\r |
109 | );\r |
110 | \r |
111 | /**\r |
112 | Register a callback function be called when a particular protocol interface is installed.\r |
113 | \r |
114 | The SmmRegisterProtocolNotify() function creates a registration Function that is to be \r |
115 | called whenever a protocol interface is installed for Protocol by \r |
116 | SmmInstallProtocolInterface().\r |
117 | \r |
118 | @param[in] Protocol The unique ID of the protocol for which the event is to be registered.\r |
119 | @param[in] Function Points to the notification function.\r |
120 | @param[out] Registration A pointer to a memory location to receive the registration value.\r |
121 | \r |
122 | @retval EFI_SUCCESS Successfully returned the registration record that has been added.\r |
123 | @retval EFI_INVALID_PARAMETER One or more of Protocol, Function and Registration is NULL.\r |
124 | @retval EFI_OUT_OF_RESOURCES Not enough memory resource to finish the request.\r |
125 | **/\r |
126 | typedef\r |
127 | EFI_STATUS\r |
128 | (EFIAPI *EFI_SMM_REGISTER_PROTOCOL_NOTIFY)(\r |
129 | IN CONST EFI_GUID *Protocol,\r |
130 | IN EFI_SMM_NOTIFY_FN Function,\r |
131 | OUT VOID **Registration\r |
132 | );\r |
133 | \r |
134 | /**\r |
135 | Manage SMI of a particular type.\r |
136 | \r |
137 | @param[in] HandlerType Points to the handler type or NULL for root SMI handlers.\r |
138 | @param[in] Context Points to an optional context buffer.\r |
139 | @param[in,out] CommBuffer Points to the optional communication buffer.\r |
140 | @param[in,out] CommBufferSize Points to the size of the optional communication buffer.\r |
141 | \r |
142 | @retval EFI_SUCCESS Interrupt source was processed successfully but not quiesced.\r |
143 | @retval EFI_INTERRUPT_PENDING One or more SMI sources could not be quiesced.\r |
144 | @retval EFI_WARN_INTERRUPT_SOURCE_PENDING Interrupt source was not handled or quiesced.\r |
145 | @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED Interrupt source was handled and quiesced.\r |
146 | **/\r |
147 | typedef\r |
148 | EFI_STATUS\r |
149 | (EFIAPI *EFI_SMM_INTERRUPT_MANAGE)(\r |
150 | IN CONST EFI_GUID *HandlerType,\r |
151 | IN CONST VOID *Context OPTIONAL,\r |
152 | IN OUT VOID *CommBuffer OPTIONAL,\r |
153 | IN OUT UINTN *CommBufferSize OPTIONAL\r |
154 | );\r |
155 | \r |
156 | /**\r |
157 | Main entry point for an SMM handler dispatch or communicate-based callback.\r |
158 | \r |
159 | @param[in] DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().\r |
160 | @param[in] Context Points to an optional handler context which was specified when the\r |
161 | handler was registered.\r |
162 | @param[in,out] CommBuffer A pointer to a collection of data in memory that will\r |
163 | be conveyed from a non-SMM environment into an SMM environment.\r |
164 | @param[in,out] CommBufferSize The size of the CommBuffer.\r |
165 | \r |
166 | @retval EFI_SUCCESS The interrupt was handled and quiesced. No other handlers \r |
167 | should still be called.\r |
168 | @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED The interrupt has been quiesced but other handlers should \r |
169 | still be called.\r |
170 | @retval EFI_WARN_INTERRUPT_SOURCE_PENDING The interrupt is still pending and other handlers should still \r |
171 | be called.\r |
172 | @retval EFI_INTERRUPT_PENDING The interrupt could not be quiesced.\r |
173 | **/\r |
174 | typedef\r |
175 | EFI_STATUS\r |
176 | (EFIAPI *EFI_SMM_HANDLER_ENTRY_POINT2)(\r |
177 | IN EFI_HANDLE DispatchHandle,\r |
178 | IN CONST VOID *Context OPTIONAL,\r |
179 | IN OUT VOID *CommBuffer OPTIONAL,\r |
180 | IN OUT UINTN *CommBufferSize OPTIONAL\r |
181 | );\r |
182 | \r |
183 | /**\r |
184 | Registers a handler to execute within SMM.\r |
185 | \r |
186 | @param[in] Handler Handler service funtion pointer.\r |
187 | @param[in] HandlerType Points to the handler type or NULL for root SMI handlers.\r |
188 | @param[out] DispatchHandle On return, contains a unique handle which can be used to later\r |
189 | unregister the handler function.\r |
190 | \r |
191 | @retval EFI_SUCCESS SMI handler added successfully.\r |
192 | @retval EFI_INVALID_PARAMETER Handler is NULL or DispatchHandle is NULL.\r |
193 | **/\r |
194 | typedef\r |
195 | EFI_STATUS\r |
196 | (EFIAPI *EFI_SMM_INTERRUPT_REGISTER)(\r |
197 | IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,\r |
198 | IN CONST EFI_GUID *HandlerType OPTIONAL,\r |
199 | OUT EFI_HANDLE *DispatchHandle\r |
200 | );\r |
201 | \r |
202 | /**\r |
203 | Unregister a handler in SMM.\r |
204 | \r |
205 | @param[in] DispatchHandle The handle that was specified when the handler was registered.\r |
206 | \r |
207 | @retval EFI_SUCCESS Handler function was successfully unregistered.\r |
208 | @retval EFI_INVALID_PARAMETER DispatchHandle does not refer to a valid handle.\r |
209 | **/\r |
210 | typedef\r |
211 | EFI_STATUS\r |
212 | (EFIAPI *EFI_SMM_INTERRUPT_UNREGISTER)(\r |
213 | IN EFI_HANDLE DispatchHandle\r |
214 | );\r |
215 | \r |
216 | ///\r |
217 | /// Processor information and functionality needed by SMM Foundation.\r |
218 | ///\r |
219 | typedef struct _EFI_SMM_ENTRY_CONTEXT {\r |
220 | EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp;\r |
221 | ///\r |
222 | /// A number between zero and the NumberOfCpus field. This field designates which \r |
223 | /// processor is executing the SMM Foundation.\r |
224 | ///\r |
225 | UINTN CurrentlyExecutingCpu;\r |
226 | ///\r |
227 | /// The number of current operational processors in the platform. This is a 1 based \r |
228 | /// counter. This does not indicate the number of processors that entered SMM.\r |
229 | ///\r |
230 | UINTN NumberOfCpus;\r |
231 | ///\r |
232 | /// Points to an array, where each element describes the number of bytes in the \r |
233 | /// corresponding save state specified by CpuSaveState. There are always \r |
234 | /// NumberOfCpus entries in the array. \r |
235 | ///\r |
236 | UINTN *CpuSaveStateSize;\r |
237 | ///\r |
238 | /// Points to an array, where each element is a pointer to a CPU save state. The \r |
239 | /// corresponding element in CpuSaveStateSize specifies the number of bytes in the \r |
240 | /// save state area. There are always NumberOfCpus entries in the array.\r |
241 | ///\r |
242 | VOID **CpuSaveState;\r |
243 | } EFI_SMM_ENTRY_CONTEXT;\r |
244 | \r |
245 | /**\r |
246 | This function is the main entry point to the SMM Foundation.\r |
247 | \r |
248 | @param[in] SmmEntryContext Processor information and functionality needed by SMM Foundation.\r |
249 | **/\r |
250 | typedef\r |
251 | VOID\r |
252 | (EFIAPI *EFI_SMM_ENTRY_POINT)(\r |
253 | IN CONST EFI_SMM_ENTRY_CONTEXT *SmmEntryContext\r |
254 | );\r |
255 | \r |
256 | ///\r |
257 | /// System Management System Table (SMST)\r |
258 | ///\r |
259 | /// The System Management System Table (SMST) is a table that contains a collection of common \r |
260 | /// services for managing SMRAM allocation and providing basic I/O services. These services are \r |
261 | /// intended for both preboot and runtime usage.\r |
262 | ///\r |
a2bb197e |
263 | struct _EFI_SMM_SYSTEM_TABLE2 {\r |
04c5d169 |
264 | ///\r |
265 | /// The table header for the SMST.\r |
266 | ///\r |
a2bb197e |
267 | EFI_TABLE_HEADER Hdr;\r |
04c5d169 |
268 | ///\r |
269 | /// A pointer to a NULL-terminated Unicode string containing the vendor name.\r |
270 | /// It is permissible for this pointer to be NULL.\r |
271 | ///\r |
a2bb197e |
272 | CHAR16 *SmmFirmwareVendor;\r |
04c5d169 |
273 | ///\r |
274 | /// The particular revision of the firmware.\r |
275 | ///\r |
a2bb197e |
276 | UINT32 SmmFirmwareRevision;\r |
04c5d169 |
277 | \r |
a2bb197e |
278 | EFI_SMM_INSTALL_CONFIGURATION_TABLE2 SmmInstallConfigurationTable;\r |
04c5d169 |
279 | \r |
280 | ///\r |
281 | /// I/O Service\r |
282 | ///\r |
8fc71dec |
283 | EFI_SMM_CPU_IO2_PROTOCOL SmmIo;\r |
04c5d169 |
284 | \r |
285 | ///\r |
286 | /// Runtime memory services\r |
287 | ///\r |
a2bb197e |
288 | EFI_ALLOCATE_POOL SmmAllocatePool;\r |
289 | EFI_FREE_POOL SmmFreePool;\r |
290 | EFI_ALLOCATE_PAGES SmmAllocatePages;\r |
291 | EFI_FREE_PAGES SmmFreePages;\r |
04c5d169 |
292 | \r |
293 | ///\r |
294 | /// MP service\r |
295 | ///\r |
a2bb197e |
296 | EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp;\r |
04c5d169 |
297 | \r |
298 | ///\r |
299 | /// CPU information records\r |
300 | ///\r |
301 | \r |
302 | ///\r |
303 | /// A number between zero and and the NumberOfCpus field. This field designates \r |
304 | /// which processor is executing the SMM infrastructure.\r |
305 | ///\r |
a2bb197e |
306 | UINTN CurrentlyExecutingCpu;\r |
04c5d169 |
307 | ///\r |
308 | /// The number of current operational processors in the platform. This is a 1 based counter.\r |
309 | ///\r |
a2bb197e |
310 | UINTN NumberOfCpus;\r |
04c5d169 |
311 | ///\r |
312 | /// Points to an array, where each element describes the number of bytes in the \r |
313 | /// corresponding save state specified by CpuSaveState. There are always \r |
314 | /// NumberOfCpus entries in the array. \r |
315 | ///\r |
a2bb197e |
316 | UINTN *CpuSaveStateSize;\r |
04c5d169 |
317 | ///\r |
318 | /// Points to an array, where each element is a pointer to a CPU save state. The \r |
319 | /// corresponding element in CpuSaveStateSize specifies the number of bytes in the \r |
320 | /// save state area. There are always NumberOfCpus entries in the array.\r |
321 | ///\r |
a2bb197e |
322 | VOID **CpuSaveState;\r |
04c5d169 |
323 | \r |
324 | ///\r |
325 | /// Extensibility table\r |
326 | ///\r |
327 | \r |
328 | ///\r |
329 | /// The number of UEFI Configuration Tables in the buffer SmmConfigurationTable.\r |
330 | ///\r |
a2bb197e |
331 | UINTN NumberOfTableEntries;\r |
04c5d169 |
332 | ///\r |
333 | /// A pointer to the UEFI Configuration Tables. The number of entries in the table is \r |
334 | /// NumberOfTableEntries. \r |
335 | ///\r |
a2bb197e |
336 | EFI_CONFIGURATION_TABLE *SmmConfigurationTable;\r |
04c5d169 |
337 | \r |
338 | ///\r |
339 | /// Protocol services\r |
340 | ///\r |
a2bb197e |
341 | EFI_INSTALL_PROTOCOL_INTERFACE SmmInstallProtocolInterface;\r |
342 | EFI_UNINSTALL_PROTOCOL_INTERFACE SmmUninstallProtocolInterface;\r |
343 | EFI_HANDLE_PROTOCOL SmmHandleProtocol;\r |
344 | EFI_SMM_REGISTER_PROTOCOL_NOTIFY SmmRegisterProtocolNotify;\r |
345 | EFI_LOCATE_HANDLE SmmLocateHandle;\r |
346 | EFI_LOCATE_PROTOCOL SmmLocateProtocol;\r |
04c5d169 |
347 | \r |
348 | ///\r |
349 | /// SMI Management functions\r |
350 | ///\r |
a2bb197e |
351 | EFI_SMM_INTERRUPT_MANAGE SmiManage;\r |
352 | EFI_SMM_INTERRUPT_REGISTER SmiHandlerRegister;\r |
353 | EFI_SMM_INTERRUPT_UNREGISTER SmiHandlerUnRegister;\r |
04c5d169 |
354 | };\r |
355 | \r |
356 | #endif\r |