]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Pi/PiMmCis.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Pi / PiMmCis.h
CommitLineData
07c6a47e
ED
1/** @file\r
2 Common definitions in the Platform Initialization Specification version 1.5\r
3 VOLUME 4 Management Mode Core Interface version.\r
4\r
5 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
9344f092 6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
07c6a47e
ED
7\r
8**/\r
9\r
10#ifndef _PI_MMCIS_H_\r
11#define _PI_MMCIS_H_\r
12\r
12cfc900 13#include <Pi/PiMultiPhase.h>\r
07c6a47e
ED
14#include <Protocol/MmCpuIo.h>\r
15\r
16typedef struct _EFI_MM_SYSTEM_TABLE EFI_MM_SYSTEM_TABLE;\r
17\r
18///\r
19/// The Management Mode System Table (MMST) signature\r
20///\r
21#define MM_MMST_SIGNATURE SIGNATURE_32 ('S', 'M', 'S', 'T')\r
22///\r
23/// The Management Mode System Table (MMST) revision is 1.6\r
24///\r
25#define MM_SPECIFICATION_MAJOR_REVISION 1\r
26#define MM_SPECIFICATION_MINOR_REVISION 60\r
27#define EFI_MM_SYSTEM_TABLE_REVISION ((MM_SPECIFICATION_MAJOR_REVISION<<16) | (MM_SPECIFICATION_MINOR_REVISION))\r
28\r
29/**\r
30 Adds, updates, or removes a configuration table entry from the Management Mode System Table.\r
31\r
32 The MmInstallConfigurationTable() function is used to maintain the list\r
33 of configuration tables that are stored in the Management Mode System\r
34 Table. The list is stored as an array of (GUID, Pointer) pairs. The list\r
35 must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.\r
36\r
37 @param[in] SystemTable A pointer to the MM System Table (MMST).\r
38 @param[in] Guid A pointer to the GUID for the entry to add, update, or remove.\r
39 @param[in] Table A pointer to the buffer of the table to add.\r
40 @param[in] TableSize The size of the table to install.\r
41\r
42 @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.\r
43 @retval EFI_INVALID_PARAMETER Guid is not valid.\r
44 @retval EFI_NOT_FOUND An attempt was made to delete a non-existent entry.\r
45 @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.\r
46**/\r
47typedef\r
48EFI_STATUS\r
49(EFIAPI *EFI_MM_INSTALL_CONFIGURATION_TABLE)(\r
50 IN CONST EFI_MM_SYSTEM_TABLE *SystemTable,\r
51 IN CONST EFI_GUID *Guid,\r
52 IN VOID *Table,\r
53 IN UINTN TableSize\r
54 );\r
55\r
56/**\r
57 This service lets the caller to get one distinct application processor (AP) to execute\r
58 a caller-provided code stream while in MM.\r
59\r
60 @param[in] Procedure A pointer to the code stream to be run on the designated\r
61 AP of the system.\r
62 @param[in] CpuNumber The zero-based index of the processor number of the AP\r
63 on which the code stream is supposed to run.\r
64 @param[in,out] ProcArguments Allows the caller to pass a list of parameters to the code\r
65 that is run by the AP.\r
66\r
67 @retval EFI_SUCCESS The call was successful and the return parameters are valid.\r
68 @retval EFI_INVALID_PARAMETER The input arguments are out of range.\r
69 @retval EFI_INVALID_PARAMETER The CPU requested is not available on this SMI invocation.\r
70 @retval EFI_INVALID_PARAMETER The CPU cannot support an additional service invocation.\r
71**/\r
72typedef\r
73EFI_STATUS\r
74(EFIAPI *EFI_MM_STARTUP_THIS_AP)(\r
75 IN EFI_AP_PROCEDURE Procedure,\r
76 IN UINTN CpuNumber,\r
77 IN OUT VOID *ProcArguments OPTIONAL\r
78 );\r
79\r
80/**\r
81 Function prototype for protocol install notification.\r
82\r
83 @param[in] Protocol Points to the protocol's unique identifier.\r
84 @param[in] Interface Points to the interface instance.\r
85 @param[in] Handle The handle on which the interface was installed.\r
86\r
87 @return Status Code\r
88**/\r
89typedef\r
90EFI_STATUS\r
91(EFIAPI *EFI_MM_NOTIFY_FN)(\r
92 IN CONST EFI_GUID *Protocol,\r
93 IN VOID *Interface,\r
94 IN EFI_HANDLE Handle\r
95 );\r
96\r
97/**\r
98 Register a callback function be called when a particular protocol interface is installed.\r
99\r
100 The MmRegisterProtocolNotify() function creates a registration Function that is to be\r
101 called whenever a protocol interface is installed for Protocol by\r
102 MmInstallProtocolInterface().\r
103 If Function == NULL and Registration is an existing registration, then the callback is unhooked.\r
104\r
105 @param[in] Protocol The unique ID of the protocol for which the event is to be registered.\r
106 @param[in] Function Points to the notification function.\r
107 @param[out] Registration A pointer to a memory location to receive the registration value.\r
108\r
109 @retval EFI_SUCCESS Successfully returned the registration record\r
110 that has been added or unhooked.\r
111 @retval EFI_INVALID_PARAMETER Protocol is NULL or Registration is NULL.\r
112 @retval EFI_OUT_OF_RESOURCES Not enough memory resource to finish the request.\r
113 @retval EFI_NOT_FOUND If the registration is not found when Function == NULL.\r
114**/\r
115typedef\r
116EFI_STATUS\r
117(EFIAPI *EFI_MM_REGISTER_PROTOCOL_NOTIFY)(\r
118 IN CONST EFI_GUID *Protocol,\r
119 IN EFI_MM_NOTIFY_FN Function,\r
120 OUT VOID **Registration\r
121 );\r
122\r
123/**\r
124 Manage MMI of a particular type.\r
125\r
126 @param[in] HandlerType Points to the handler type or NULL for root MMI handlers.\r
127 @param[in] Context Points to an optional context buffer.\r
128 @param[in,out] CommBuffer Points to the optional communication buffer.\r
129 @param[in,out] CommBufferSize Points to the size of the optional communication buffer.\r
130\r
131 @retval EFI_WARN_INTERRUPT_SOURCE_PENDING Interrupt source was processed successfully but not quiesced.\r
132 @retval EFI_INTERRUPT_PENDING One or more SMI sources could not be quiesced.\r
133 @retval EFI_NOT_FOUND Interrupt source was not handled or quiesced.\r
134 @retval EFI_SUCCESS Interrupt source was handled and quiesced.\r
135**/\r
136typedef\r
137EFI_STATUS\r
138(EFIAPI *EFI_MM_INTERRUPT_MANAGE)(\r
139 IN CONST EFI_GUID *HandlerType,\r
140 IN CONST VOID *Context OPTIONAL,\r
141 IN OUT VOID *CommBuffer OPTIONAL,\r
142 IN OUT UINTN *CommBufferSize OPTIONAL\r
143 );\r
144\r
145/**\r
146 Main entry point for an MM handler dispatch or communicate-based callback.\r
147\r
148 @param[in] DispatchHandle The unique handle assigned to this handler by MmiHandlerRegister().\r
149 @param[in] Context Points to an optional handler context which was specified when the\r
150 handler was registered.\r
151 @param[in,out] CommBuffer A pointer to a collection of data in memory that will\r
152 be conveyed from a non-MM environment into an MM environment.\r
153 @param[in,out] CommBufferSize The size of the CommBuffer.\r
154\r
155 @retval EFI_SUCCESS The interrupt was handled and quiesced. No other handlers\r
156 should still be called.\r
157 @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED The interrupt has been quiesced but other handlers should\r
158 still be called.\r
159 @retval EFI_WARN_INTERRUPT_SOURCE_PENDING The interrupt is still pending and other handlers should still\r
160 be called.\r
161 @retval EFI_INTERRUPT_PENDING The interrupt could not be quiesced.\r
162**/\r
163typedef\r
164EFI_STATUS\r
165(EFIAPI *EFI_MM_HANDLER_ENTRY_POINT)(\r
166 IN EFI_HANDLE DispatchHandle,\r
167 IN CONST VOID *Context OPTIONAL,\r
168 IN OUT VOID *CommBuffer OPTIONAL,\r
169 IN OUT UINTN *CommBufferSize OPTIONAL\r
170 );\r
171\r
172/**\r
173 Registers a handler to execute within MM.\r
174\r
175 @param[in] Handler Handler service function pointer.\r
176 @param[in] HandlerType Points to the handler type or NULL for root MMI handlers.\r
177 @param[out] DispatchHandle On return, contains a unique handle which can be used to later\r
178 unregister the handler function.\r
179\r
180 @retval EFI_SUCCESS MMI handler added successfully.\r
181 @retval EFI_INVALID_PARAMETER Handler is NULL or DispatchHandle is NULL.\r
182**/\r
183typedef\r
184EFI_STATUS\r
185(EFIAPI *EFI_MM_INTERRUPT_REGISTER)(\r
186 IN EFI_MM_HANDLER_ENTRY_POINT Handler,\r
187 IN CONST EFI_GUID *HandlerType OPTIONAL,\r
188 OUT EFI_HANDLE *DispatchHandle\r
189 );\r
190\r
191/**\r
192 Unregister a handler in MM.\r
193\r
194 @param[in] DispatchHandle The handle that was specified when the handler was registered.\r
195\r
196 @retval EFI_SUCCESS Handler function was successfully unregistered.\r
197 @retval EFI_INVALID_PARAMETER DispatchHandle does not refer to a valid handle.\r
198**/\r
199typedef\r
200EFI_STATUS\r
201(EFIAPI *EFI_MM_INTERRUPT_UNREGISTER)(\r
202 IN EFI_HANDLE DispatchHandle\r
203 );\r
204\r
205///\r
206/// Processor information and functionality needed by MM Foundation.\r
207///\r
208typedef struct _EFI_MM_ENTRY_CONTEXT {\r
209 EFI_MM_STARTUP_THIS_AP MmStartupThisAp;\r
210 ///\r
211 /// A number between zero and the NumberOfCpus field. This field designates which\r
212 /// processor is executing the MM Foundation.\r
213 ///\r
214 UINTN CurrentlyExecutingCpu;\r
215 ///\r
216 /// The number of possible processors in the platform. This is a 1 based\r
217 /// counter. This does not indicate the number of processors that entered MM.\r
218 ///\r
219 UINTN NumberOfCpus;\r
220 ///\r
221 /// Points to an array, where each element describes the number of bytes in the\r
222 /// corresponding save state specified by CpuSaveState. There are always\r
223 /// NumberOfCpus entries in the array.\r
224 ///\r
225 UINTN *CpuSaveStateSize;\r
226 ///\r
227 /// Points to an array, where each element is a pointer to a CPU save state. The\r
228 /// corresponding element in CpuSaveStateSize specifies the number of bytes in the\r
229 /// save state area. There are always NumberOfCpus entries in the array.\r
230 ///\r
231 VOID **CpuSaveState;\r
232} EFI_MM_ENTRY_CONTEXT;\r
233\r
234/**\r
235 This function is the main entry point to the MM Foundation.\r
236\r
237 @param[in] MmEntryContext Processor information and functionality needed by MM Foundation.\r
238**/\r
239typedef\r
240VOID\r
241(EFIAPI *EFI_MM_ENTRY_POINT)(\r
242 IN CONST EFI_MM_ENTRY_CONTEXT *MmEntryContext\r
243 );\r
244\r
245///\r
246/// Management Mode System Table (MMST)\r
247///\r
248/// The Management Mode System Table (MMST) is a table that contains a collection of common\r
249/// services for managing MMRAM allocation and providing basic I/O services. These services are\r
250/// intended for both preboot and runtime usage.\r
251///\r
252struct _EFI_MM_SYSTEM_TABLE {\r
253 ///\r
254 /// The table header for the SMST.\r
255 ///\r
256 EFI_TABLE_HEADER Hdr;\r
257 ///\r
258 /// A pointer to a NULL-terminated Unicode string containing the vendor name.\r
259 /// It is permissible for this pointer to be NULL.\r
260 ///\r
261 CHAR16 *MmFirmwareVendor;\r
262 ///\r
263 /// The particular revision of the firmware.\r
264 ///\r
265 UINT32 MmFirmwareRevision;\r
266\r
267 EFI_MM_INSTALL_CONFIGURATION_TABLE MmInstallConfigurationTable;\r
268\r
269 ///\r
270 /// I/O Service\r
271 ///\r
272 EFI_MM_CPU_IO_PROTOCOL MmIo;\r
273\r
274 ///\r
275 /// Runtime memory services\r
276 ///\r
277 EFI_ALLOCATE_POOL MmAllocatePool;\r
278 EFI_FREE_POOL MmFreePool;\r
279 EFI_ALLOCATE_PAGES MmAllocatePages;\r
280 EFI_FREE_PAGES MmFreePages;\r
281\r
282 ///\r
283 /// MP service\r
284 ///\r
285 EFI_MM_STARTUP_THIS_AP MmStartupThisAp;\r
286\r
287 ///\r
288 /// CPU information records\r
289 ///\r
290\r
291 ///\r
292 /// A number between zero and and the NumberOfCpus field. This field designates\r
293 /// which processor is executing the MM infrastructure.\r
294 ///\r
295 UINTN CurrentlyExecutingCpu;\r
296 ///\r
297 /// The number of possible processors in the platform. This is a 1 based counter.\r
298 ///\r
299 UINTN NumberOfCpus;\r
300 ///\r
301 /// Points to an array, where each element describes the number of bytes in the\r
302 /// corresponding save state specified by CpuSaveState. There are always\r
303 /// NumberOfCpus entries in the array.\r
304 ///\r
305 UINTN *CpuSaveStateSize;\r
306 ///\r
307 /// Points to an array, where each element is a pointer to a CPU save state. The\r
308 /// corresponding element in CpuSaveStateSize specifies the number of bytes in the\r
309 /// save state area. There are always NumberOfCpus entries in the array.\r
310 ///\r
311 VOID **CpuSaveState;\r
312\r
313 ///\r
314 /// Extensibility table\r
315 ///\r
316\r
317 ///\r
318 /// The number of UEFI Configuration Tables in the buffer MmConfigurationTable.\r
319 ///\r
320 UINTN NumberOfTableEntries;\r
321 ///\r
322 /// A pointer to the UEFI Configuration Tables. The number of entries in the table is\r
323 /// NumberOfTableEntries.\r
324 ///\r
325 EFI_CONFIGURATION_TABLE *MmConfigurationTable;\r
326\r
327 ///\r
328 /// Protocol services\r
329 ///\r
330 EFI_INSTALL_PROTOCOL_INTERFACE MmInstallProtocolInterface;\r
331 EFI_UNINSTALL_PROTOCOL_INTERFACE MmUninstallProtocolInterface;\r
332 EFI_HANDLE_PROTOCOL MmHandleProtocol;\r
333 EFI_MM_REGISTER_PROTOCOL_NOTIFY MmRegisterProtocolNotify;\r
334 EFI_LOCATE_HANDLE MmLocateHandle;\r
335 EFI_LOCATE_PROTOCOL MmLocateProtocol;\r
336\r
337 ///\r
338 /// MMI Management functions\r
339 ///\r
340 EFI_MM_INTERRUPT_MANAGE MmiManage;\r
341 EFI_MM_INTERRUPT_REGISTER MmiHandlerRegister;\r
342 EFI_MM_INTERRUPT_UNREGISTER MmiHandlerUnRegister;\r
343};\r
344\r
345#endif\r