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