]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Pi/PiSmmCis.h
MdePkg: Fix some typing errors in the header files
[mirror_edk2.git] / MdePkg / Include / Pi / PiSmmCis.h
CommitLineData
04c5d169 1/** @file\r
65352665 2 Common definitions in the Platform Initialization Specification version 1.4a\r
04c5d169 3 VOLUME 4 System Management Mode Core Interface version.\r
4\r
65352665 5 Copyright (c) 2009 - 2016, 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 22typedef 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
693bebd9 29/// The System Management System Table (SMST) revision is 1.4\r
04c5d169 30///\r
53e6937c 31#define SMM_SPECIFICATION_MAJOR_REVISION 1\r
693bebd9 32#define SMM_SPECIFICATION_MINOR_REVISION 40\r
53e6937c 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
53typedef\r
54EFI_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
65352665
JF
63 This service lets the caller to get one distinct application processor (AP) to execute\r
64 a caller-provided code stream while in SMM.\r
04c5d169 65\r
65352665
JF
66 @param[in] Procedure A pointer to the code stream to be run on the designated\r
67 AP of the system.\r
68 @param[in] CpuNumber The zero-based index of the processor number of the AP\r
69 on which the code stream is supposed to run.\r
70 @param[in,out] ProcArguments Allows the caller to pass a list of parameters to the code\r
71 that is run by the AP.\r
04c5d169 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
78typedef\r
79EFI_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
95typedef\r
96EFI_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
cf1d7393
JF
115 @retval EFI_SUCCESS Successfully returned the registration record\r
116 that has been added or unhooked.\r
117 @retval EFI_INVALID_PARAMETER Protocol is NULL or Registration is NULL.\r
04c5d169 118 @retval EFI_OUT_OF_RESOURCES Not enough memory resource to finish the request.\r
50903aa5 119 @retval EFI_NOT_FOUND If the registration is not found when Function == NULL.\r
04c5d169 120**/\r
121typedef\r
122EFI_STATUS\r
123(EFIAPI *EFI_SMM_REGISTER_PROTOCOL_NOTIFY)(\r
124 IN CONST EFI_GUID *Protocol,\r
125 IN EFI_SMM_NOTIFY_FN Function,\r
126 OUT VOID **Registration\r
127 );\r
128\r
129/**\r
130 Manage SMI of a particular type.\r
131\r
132 @param[in] HandlerType Points to the handler type or NULL for root SMI handlers.\r
133 @param[in] Context Points to an optional context buffer.\r
134 @param[in,out] CommBuffer Points to the optional communication buffer.\r
135 @param[in,out] CommBufferSize Points to the size of the optional communication buffer.\r
136\r
d5b339a9 137 @retval EFI_WARN_INTERRUPT_SOURCE_PENDING Interrupt source was processed successfully but not quiesced.\r
04c5d169 138 @retval EFI_INTERRUPT_PENDING One or more SMI sources could not be quiesced.\r
d5b339a9 139 @retval EFI_NOT_FOUND Interrupt source was not handled or quiesced.\r
140 @retval EFI_SUCCESS Interrupt source was handled and quiesced.\r
04c5d169 141**/\r
142typedef\r
143EFI_STATUS\r
144(EFIAPI *EFI_SMM_INTERRUPT_MANAGE)(\r
145 IN CONST EFI_GUID *HandlerType,\r
146 IN CONST VOID *Context OPTIONAL,\r
147 IN OUT VOID *CommBuffer OPTIONAL,\r
148 IN OUT UINTN *CommBufferSize OPTIONAL\r
149 );\r
150\r
151/**\r
152 Main entry point for an SMM handler dispatch or communicate-based callback.\r
153\r
154 @param[in] DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().\r
155 @param[in] Context Points to an optional handler context which was specified when the\r
156 handler was registered.\r
157 @param[in,out] CommBuffer A pointer to a collection of data in memory that will\r
158 be conveyed from a non-SMM environment into an SMM environment.\r
159 @param[in,out] CommBufferSize The size of the CommBuffer.\r
160\r
161 @retval EFI_SUCCESS The interrupt was handled and quiesced. No other handlers \r
162 should still be called.\r
163 @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED The interrupt has been quiesced but other handlers should \r
164 still be called.\r
165 @retval EFI_WARN_INTERRUPT_SOURCE_PENDING The interrupt is still pending and other handlers should still \r
166 be called.\r
167 @retval EFI_INTERRUPT_PENDING The interrupt could not be quiesced.\r
168**/\r
169typedef\r
170EFI_STATUS\r
171(EFIAPI *EFI_SMM_HANDLER_ENTRY_POINT2)(\r
172 IN EFI_HANDLE DispatchHandle,\r
173 IN CONST VOID *Context OPTIONAL,\r
174 IN OUT VOID *CommBuffer OPTIONAL,\r
175 IN OUT UINTN *CommBufferSize OPTIONAL\r
176 );\r
177\r
178/**\r
179 Registers a handler to execute within SMM.\r
180\r
00b7cc0f 181 @param[in] Handler Handler service function pointer.\r
04c5d169 182 @param[in] HandlerType Points to the handler type or NULL for root SMI handlers.\r
183 @param[out] DispatchHandle On return, contains a unique handle which can be used to later\r
184 unregister the handler function.\r
185\r
186 @retval EFI_SUCCESS SMI handler added successfully.\r
187 @retval EFI_INVALID_PARAMETER Handler is NULL or DispatchHandle is NULL.\r
188**/\r
189typedef\r
190EFI_STATUS\r
191(EFIAPI *EFI_SMM_INTERRUPT_REGISTER)(\r
192 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,\r
193 IN CONST EFI_GUID *HandlerType OPTIONAL,\r
194 OUT EFI_HANDLE *DispatchHandle\r
195 );\r
196\r
197/**\r
198 Unregister a handler in SMM.\r
199\r
200 @param[in] DispatchHandle The handle that was specified when the handler was registered.\r
201\r
202 @retval EFI_SUCCESS Handler function was successfully unregistered.\r
203 @retval EFI_INVALID_PARAMETER DispatchHandle does not refer to a valid handle.\r
204**/\r
205typedef\r
206EFI_STATUS\r
207(EFIAPI *EFI_SMM_INTERRUPT_UNREGISTER)(\r
208 IN EFI_HANDLE DispatchHandle\r
209 );\r
210\r
211///\r
212/// Processor information and functionality needed by SMM Foundation.\r
213///\r
214typedef struct _EFI_SMM_ENTRY_CONTEXT {\r
215 EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp;\r
216 ///\r
217 /// A number between zero and the NumberOfCpus field. This field designates which \r
218 /// processor is executing the SMM Foundation.\r
219 ///\r
220 UINTN CurrentlyExecutingCpu;\r
221 ///\r
09c990ae 222 /// The number of possible processors in the platform. This is a 1 based \r
04c5d169 223 /// counter. This does not indicate the number of processors that entered SMM.\r
224 ///\r
225 UINTN NumberOfCpus;\r
226 ///\r
227 /// Points to an array, where each element describes the number of bytes in the \r
228 /// corresponding save state specified by CpuSaveState. There are always \r
229 /// NumberOfCpus entries in the array. \r
230 ///\r
231 UINTN *CpuSaveStateSize;\r
232 ///\r
233 /// Points to an array, where each element is a pointer to a CPU save state. The \r
234 /// corresponding element in CpuSaveStateSize specifies the number of bytes in the \r
235 /// save state area. There are always NumberOfCpus entries in the array.\r
236 ///\r
237 VOID **CpuSaveState;\r
238} EFI_SMM_ENTRY_CONTEXT;\r
239\r
240/**\r
241 This function is the main entry point to the SMM Foundation.\r
242\r
243 @param[in] SmmEntryContext Processor information and functionality needed by SMM Foundation.\r
244**/\r
245typedef\r
246VOID\r
247(EFIAPI *EFI_SMM_ENTRY_POINT)(\r
248 IN CONST EFI_SMM_ENTRY_CONTEXT *SmmEntryContext\r
249 );\r
250\r
251///\r
252/// System Management System Table (SMST)\r
253///\r
254/// The System Management System Table (SMST) is a table that contains a collection of common \r
255/// services for managing SMRAM allocation and providing basic I/O services. These services are \r
256/// intended for both preboot and runtime usage.\r
257///\r
a2bb197e 258struct _EFI_SMM_SYSTEM_TABLE2 {\r
04c5d169 259 ///\r
260 /// The table header for the SMST.\r
261 ///\r
a2bb197e 262 EFI_TABLE_HEADER Hdr;\r
04c5d169 263 ///\r
264 /// A pointer to a NULL-terminated Unicode string containing the vendor name.\r
265 /// It is permissible for this pointer to be NULL.\r
266 ///\r
a2bb197e 267 CHAR16 *SmmFirmwareVendor;\r
04c5d169 268 ///\r
269 /// The particular revision of the firmware.\r
270 ///\r
a2bb197e 271 UINT32 SmmFirmwareRevision;\r
04c5d169 272\r
a2bb197e 273 EFI_SMM_INSTALL_CONFIGURATION_TABLE2 SmmInstallConfigurationTable;\r
04c5d169 274\r
275 ///\r
276 /// I/O Service\r
277 ///\r
8fc71dec 278 EFI_SMM_CPU_IO2_PROTOCOL SmmIo;\r
04c5d169 279\r
280 ///\r
281 /// Runtime memory services\r
282 ///\r
a2bb197e 283 EFI_ALLOCATE_POOL SmmAllocatePool;\r
284 EFI_FREE_POOL SmmFreePool;\r
285 EFI_ALLOCATE_PAGES SmmAllocatePages;\r
286 EFI_FREE_PAGES SmmFreePages;\r
04c5d169 287\r
288 ///\r
289 /// MP service\r
290 ///\r
a2bb197e 291 EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp;\r
04c5d169 292\r
293 ///\r
294 /// CPU information records\r
295 ///\r
296\r
297 ///\r
298 /// A number between zero and and the NumberOfCpus field. This field designates \r
299 /// which processor is executing the SMM infrastructure.\r
300 ///\r
a2bb197e 301 UINTN CurrentlyExecutingCpu;\r
04c5d169 302 ///\r
09c990ae 303 /// The number of possible processors in the platform. This is a 1 based counter.\r
04c5d169 304 ///\r
a2bb197e 305 UINTN NumberOfCpus;\r
04c5d169 306 ///\r
307 /// Points to an array, where each element describes the number of bytes in the \r
308 /// corresponding save state specified by CpuSaveState. There are always \r
309 /// NumberOfCpus entries in the array. \r
310 ///\r
a2bb197e 311 UINTN *CpuSaveStateSize;\r
04c5d169 312 ///\r
313 /// Points to an array, where each element is a pointer to a CPU save state. The \r
314 /// corresponding element in CpuSaveStateSize specifies the number of bytes in the \r
315 /// save state area. There are always NumberOfCpus entries in the array.\r
316 ///\r
a2bb197e 317 VOID **CpuSaveState;\r
04c5d169 318\r
319 ///\r
320 /// Extensibility table\r
321 ///\r
322\r
323 ///\r
324 /// The number of UEFI Configuration Tables in the buffer SmmConfigurationTable.\r
325 ///\r
a2bb197e 326 UINTN NumberOfTableEntries;\r
04c5d169 327 ///\r
328 /// A pointer to the UEFI Configuration Tables. The number of entries in the table is \r
329 /// NumberOfTableEntries. \r
330 ///\r
a2bb197e 331 EFI_CONFIGURATION_TABLE *SmmConfigurationTable;\r
04c5d169 332\r
333 ///\r
334 /// Protocol services\r
335 ///\r
a2bb197e 336 EFI_INSTALL_PROTOCOL_INTERFACE SmmInstallProtocolInterface;\r
337 EFI_UNINSTALL_PROTOCOL_INTERFACE SmmUninstallProtocolInterface;\r
338 EFI_HANDLE_PROTOCOL SmmHandleProtocol;\r
339 EFI_SMM_REGISTER_PROTOCOL_NOTIFY SmmRegisterProtocolNotify;\r
340 EFI_LOCATE_HANDLE SmmLocateHandle;\r
341 EFI_LOCATE_PROTOCOL SmmLocateProtocol;\r
04c5d169 342\r
343 ///\r
344 /// SMI Management functions\r
345 ///\r
a2bb197e 346 EFI_SMM_INTERRUPT_MANAGE SmiManage;\r
347 EFI_SMM_INTERRUPT_REGISTER SmiHandlerRegister;\r
348 EFI_SMM_INTERRUPT_UNREGISTER SmiHandlerUnRegister;\r
04c5d169 349};\r
350\r
351#endif\r