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