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