]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Pi/PiSmmCis.h
MdePkg/PiSmmCis.h: SMM register protocol notify function clarify
[mirror_edk2.git] / MdePkg / Include / Pi / PiSmmCis.h
... / ...
CommitLineData
1/** @file\r
2 Common definitions in the Platform Initialization Specification version 1.4\r
3 VOLUME 4 System Management Mode Core Interface version.\r
4\r
5 Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
6 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/SmmCpuIo2.h>\r
21\r
22typedef struct _EFI_SMM_SYSTEM_TABLE2 EFI_SMM_SYSTEM_TABLE2;\r
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
29/// The System Management System Table (SMST) revision is 1.4\r
30///\r
31#define SMM_SPECIFICATION_MAJOR_REVISION 1\r
32#define SMM_SPECIFICATION_MINOR_REVISION 40\r
33#define EFI_SMM_SYSTEM_TABLE2_REVISION ((SMM_SPECIFICATION_MAJOR_REVISION<<16) | (SMM_SPECIFICATION_MINOR_REVISION))\r
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
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
60 );\r
61\r
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 If Function == NULL and Registration is an existing registration, then the callback is unhooked.\r
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\r
116 that has been added or unhooked.\r
117 @retval EFI_INVALID_PARAMETER Protocol is NULL or Registration is NULL.\r
118 @retval EFI_OUT_OF_RESOURCES Not enough memory resource to finish the request.\r
119 @retval EFI_NOT_FOUND If the registration is not found when Function == NULL.\r
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
137 @retval EFI_WARN_INTERRUPT_SOURCE_PENDING Interrupt source was processed successfully but not quiesced.\r
138 @retval EFI_INTERRUPT_PENDING One or more SMI sources could not be quiesced.\r
139 @retval EFI_NOT_FOUND Interrupt source was not handled or quiesced.\r
140 @retval EFI_SUCCESS Interrupt source was handled and quiesced.\r
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
181 @param[in] Handler Handler service funtion pointer.\r
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
222 /// The number of possible processors in the platform. This is a 1 based \r
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
258struct _EFI_SMM_SYSTEM_TABLE2 {\r
259 ///\r
260 /// The table header for the SMST.\r
261 ///\r
262 EFI_TABLE_HEADER Hdr;\r
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
267 CHAR16 *SmmFirmwareVendor;\r
268 ///\r
269 /// The particular revision of the firmware.\r
270 ///\r
271 UINT32 SmmFirmwareRevision;\r
272\r
273 EFI_SMM_INSTALL_CONFIGURATION_TABLE2 SmmInstallConfigurationTable;\r
274\r
275 ///\r
276 /// I/O Service\r
277 ///\r
278 EFI_SMM_CPU_IO2_PROTOCOL SmmIo;\r
279\r
280 ///\r
281 /// Runtime memory services\r
282 ///\r
283 EFI_ALLOCATE_POOL SmmAllocatePool;\r
284 EFI_FREE_POOL SmmFreePool;\r
285 EFI_ALLOCATE_PAGES SmmAllocatePages;\r
286 EFI_FREE_PAGES SmmFreePages;\r
287\r
288 ///\r
289 /// MP service\r
290 ///\r
291 EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp;\r
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
301 UINTN CurrentlyExecutingCpu;\r
302 ///\r
303 /// The number of possible processors in the platform. This is a 1 based counter.\r
304 ///\r
305 UINTN NumberOfCpus;\r
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
311 UINTN *CpuSaveStateSize;\r
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
317 VOID **CpuSaveState;\r
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
326 UINTN NumberOfTableEntries;\r
327 ///\r
328 /// A pointer to the UEFI Configuration Tables. The number of entries in the table is \r
329 /// NumberOfTableEntries. \r
330 ///\r
331 EFI_CONFIGURATION_TABLE *SmmConfigurationTable;\r
332\r
333 ///\r
334 /// Protocol services\r
335 ///\r
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
342\r
343 ///\r
344 /// SMI Management functions\r
345 ///\r
346 EFI_SMM_INTERRUPT_MANAGE SmiManage;\r
347 EFI_SMM_INTERRUPT_REGISTER SmiHandlerRegister;\r
348 EFI_SMM_INTERRUPT_UNREGISTER SmiHandlerUnRegister;\r
349};\r
350\r
351#endif\r