2 Common definitions in the Platform Initialization Specification version 1.5
3 VOLUME 4 Management Mode Core Interface version.
5 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
13 #include <Pi/PiMultiPhase.h>
14 #include <Protocol/MmCpuIo.h>
16 typedef struct _EFI_MM_SYSTEM_TABLE EFI_MM_SYSTEM_TABLE
;
19 /// The Management Mode System Table (MMST) signature
21 #define MM_MMST_SIGNATURE SIGNATURE_32 ('S', 'M', 'S', 'T')
23 /// The Management Mode System Table (MMST) revision is 1.6
25 #define MM_SPECIFICATION_MAJOR_REVISION 1
26 #define MM_SPECIFICATION_MINOR_REVISION 60
27 #define EFI_MM_SYSTEM_TABLE_REVISION ((MM_SPECIFICATION_MAJOR_REVISION<<16) | (MM_SPECIFICATION_MINOR_REVISION))
30 Adds, updates, or removes a configuration table entry from the Management Mode System Table.
32 The MmInstallConfigurationTable() function is used to maintain the list
33 of configuration tables that are stored in the Management Mode System
34 Table. The list is stored as an array of (GUID, Pointer) pairs. The list
35 must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.
37 @param[in] SystemTable A pointer to the MM System Table (MMST).
38 @param[in] Guid A pointer to the GUID for the entry to add, update, or remove.
39 @param[in] Table A pointer to the buffer of the table to add.
40 @param[in] TableSize The size of the table to install.
42 @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.
43 @retval EFI_INVALID_PARAMETER Guid is not valid.
44 @retval EFI_NOT_FOUND An attempt was made to delete a non-existent entry.
45 @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.
49 (EFIAPI
*EFI_MM_INSTALL_CONFIGURATION_TABLE
)(
50 IN CONST EFI_MM_SYSTEM_TABLE
*SystemTable
,
51 IN CONST EFI_GUID
*Guid
,
57 This service lets the caller to get one distinct application processor (AP) to execute
58 a caller-provided code stream while in MM.
60 @param[in] Procedure A pointer to the code stream to be run on the designated
62 @param[in] CpuNumber The zero-based index of the processor number of the AP
63 on which the code stream is supposed to run.
64 @param[in,out] ProcArguments Allows the caller to pass a list of parameters to the code
65 that is run by the AP.
67 @retval EFI_SUCCESS The call was successful and the return parameters are valid.
68 @retval EFI_INVALID_PARAMETER The input arguments are out of range.
69 @retval EFI_INVALID_PARAMETER The CPU requested is not available on this SMI invocation.
70 @retval EFI_INVALID_PARAMETER The CPU cannot support an additional service invocation.
74 (EFIAPI
*EFI_MM_STARTUP_THIS_AP
)(
75 IN EFI_AP_PROCEDURE Procedure
,
77 IN OUT VOID
*ProcArguments OPTIONAL
81 Function prototype for protocol install notification.
83 @param[in] Protocol Points to the protocol's unique identifier.
84 @param[in] Interface Points to the interface instance.
85 @param[in] Handle The handle on which the interface was installed.
91 (EFIAPI
*EFI_MM_NOTIFY_FN
)(
92 IN CONST EFI_GUID
*Protocol
,
98 Register a callback function be called when a particular protocol interface is installed.
100 The MmRegisterProtocolNotify() function creates a registration Function that is to be
101 called whenever a protocol interface is installed for Protocol by
102 MmInstallProtocolInterface().
103 If Function == NULL and Registration is an existing registration, then the callback is unhooked.
105 @param[in] Protocol The unique ID of the protocol for which the event is to be registered.
106 @param[in] Function Points to the notification function.
107 @param[out] Registration A pointer to a memory location to receive the registration value.
109 @retval EFI_SUCCESS Successfully returned the registration record
110 that has been added or unhooked.
111 @retval EFI_INVALID_PARAMETER Protocol is NULL or Registration is NULL.
112 @retval EFI_OUT_OF_RESOURCES Not enough memory resource to finish the request.
113 @retval EFI_NOT_FOUND If the registration is not found when Function == NULL.
117 (EFIAPI
*EFI_MM_REGISTER_PROTOCOL_NOTIFY
)(
118 IN CONST EFI_GUID
*Protocol
,
119 IN EFI_MM_NOTIFY_FN Function
,
120 OUT VOID
**Registration
124 Manage MMI of a particular type.
126 @param[in] HandlerType Points to the handler type or NULL for root MMI handlers.
127 @param[in] Context Points to an optional context buffer.
128 @param[in,out] CommBuffer Points to the optional communication buffer.
129 @param[in,out] CommBufferSize Points to the size of the optional communication buffer.
131 @retval EFI_WARN_INTERRUPT_SOURCE_PENDING Interrupt source was processed successfully but not quiesced.
132 @retval EFI_INTERRUPT_PENDING One or more SMI sources could not be quiesced.
133 @retval EFI_NOT_FOUND Interrupt source was not handled or quiesced.
134 @retval EFI_SUCCESS Interrupt source was handled and quiesced.
138 (EFIAPI
*EFI_MM_INTERRUPT_MANAGE
)(
139 IN CONST EFI_GUID
*HandlerType
,
140 IN CONST VOID
*Context OPTIONAL
,
141 IN OUT VOID
*CommBuffer OPTIONAL
,
142 IN OUT UINTN
*CommBufferSize OPTIONAL
146 Main entry point for an MM handler dispatch or communicate-based callback.
148 @param[in] DispatchHandle The unique handle assigned to this handler by MmiHandlerRegister().
149 @param[in] Context Points to an optional handler context which was specified when the
150 handler was registered.
151 @param[in,out] CommBuffer A pointer to a collection of data in memory that will
152 be conveyed from a non-MM environment into an MM environment.
153 @param[in,out] CommBufferSize The size of the CommBuffer.
155 @retval EFI_SUCCESS The interrupt was handled and quiesced. No other handlers
156 should still be called.
157 @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED The interrupt has been quiesced but other handlers should
159 @retval EFI_WARN_INTERRUPT_SOURCE_PENDING The interrupt is still pending and other handlers should still
161 @retval EFI_INTERRUPT_PENDING The interrupt could not be quiesced.
165 (EFIAPI
*EFI_MM_HANDLER_ENTRY_POINT
)(
166 IN EFI_HANDLE DispatchHandle
,
167 IN CONST VOID
*Context OPTIONAL
,
168 IN OUT VOID
*CommBuffer OPTIONAL
,
169 IN OUT UINTN
*CommBufferSize OPTIONAL
173 Registers a handler to execute within MM.
175 @param[in] Handler Handler service function pointer.
176 @param[in] HandlerType Points to the handler type or NULL for root MMI handlers.
177 @param[out] DispatchHandle On return, contains a unique handle which can be used to later
178 unregister the handler function.
180 @retval EFI_SUCCESS MMI handler added successfully.
181 @retval EFI_INVALID_PARAMETER Handler is NULL or DispatchHandle is NULL.
185 (EFIAPI
*EFI_MM_INTERRUPT_REGISTER
)(
186 IN EFI_MM_HANDLER_ENTRY_POINT Handler
,
187 IN CONST EFI_GUID
*HandlerType OPTIONAL
,
188 OUT EFI_HANDLE
*DispatchHandle
192 Unregister a handler in MM.
194 @param[in] DispatchHandle The handle that was specified when the handler was registered.
196 @retval EFI_SUCCESS Handler function was successfully unregistered.
197 @retval EFI_INVALID_PARAMETER DispatchHandle does not refer to a valid handle.
201 (EFIAPI
*EFI_MM_INTERRUPT_UNREGISTER
)(
202 IN EFI_HANDLE DispatchHandle
206 /// Processor information and functionality needed by MM Foundation.
208 typedef struct _EFI_MM_ENTRY_CONTEXT
{
209 EFI_MM_STARTUP_THIS_AP MmStartupThisAp
;
211 /// A number between zero and the NumberOfCpus field. This field designates which
212 /// processor is executing the MM Foundation.
214 UINTN CurrentlyExecutingCpu
;
216 /// The number of possible processors in the platform. This is a 1 based
217 /// counter. This does not indicate the number of processors that entered MM.
221 /// Points to an array, where each element describes the number of bytes in the
222 /// corresponding save state specified by CpuSaveState. There are always
223 /// NumberOfCpus entries in the array.
225 UINTN
*CpuSaveStateSize
;
227 /// Points to an array, where each element is a pointer to a CPU save state. The
228 /// corresponding element in CpuSaveStateSize specifies the number of bytes in the
229 /// save state area. There are always NumberOfCpus entries in the array.
232 } EFI_MM_ENTRY_CONTEXT
;
235 This function is the main entry point to the MM Foundation.
237 @param[in] MmEntryContext Processor information and functionality needed by MM Foundation.
241 (EFIAPI
*EFI_MM_ENTRY_POINT
)(
242 IN CONST EFI_MM_ENTRY_CONTEXT
*MmEntryContext
246 /// Management Mode System Table (MMST)
248 /// The Management Mode System Table (MMST) is a table that contains a collection of common
249 /// services for managing MMRAM allocation and providing basic I/O services. These services are
250 /// intended for both preboot and runtime usage.
252 struct _EFI_MM_SYSTEM_TABLE
{
254 /// The table header for the SMST.
256 EFI_TABLE_HEADER Hdr
;
258 /// A pointer to a NULL-terminated Unicode string containing the vendor name.
259 /// It is permissible for this pointer to be NULL.
261 CHAR16
*MmFirmwareVendor
;
263 /// The particular revision of the firmware.
265 UINT32 MmFirmwareRevision
;
267 EFI_MM_INSTALL_CONFIGURATION_TABLE MmInstallConfigurationTable
;
272 EFI_MM_CPU_IO_PROTOCOL MmIo
;
275 /// Runtime memory services
277 EFI_ALLOCATE_POOL MmAllocatePool
;
278 EFI_FREE_POOL MmFreePool
;
279 EFI_ALLOCATE_PAGES MmAllocatePages
;
280 EFI_FREE_PAGES MmFreePages
;
285 EFI_MM_STARTUP_THIS_AP MmStartupThisAp
;
288 /// CPU information records
292 /// A number between zero and and the NumberOfCpus field. This field designates
293 /// which processor is executing the MM infrastructure.
295 UINTN CurrentlyExecutingCpu
;
297 /// The number of possible processors in the platform. This is a 1 based counter.
301 /// Points to an array, where each element describes the number of bytes in the
302 /// corresponding save state specified by CpuSaveState. There are always
303 /// NumberOfCpus entries in the array.
305 UINTN
*CpuSaveStateSize
;
307 /// Points to an array, where each element is a pointer to a CPU save state. The
308 /// corresponding element in CpuSaveStateSize specifies the number of bytes in the
309 /// save state area. There are always NumberOfCpus entries in the array.
314 /// Extensibility table
318 /// The number of UEFI Configuration Tables in the buffer MmConfigurationTable.
320 UINTN NumberOfTableEntries
;
322 /// A pointer to the UEFI Configuration Tables. The number of entries in the table is
323 /// NumberOfTableEntries.
325 EFI_CONFIGURATION_TABLE
*MmConfigurationTable
;
328 /// Protocol services
330 EFI_INSTALL_PROTOCOL_INTERFACE MmInstallProtocolInterface
;
331 EFI_UNINSTALL_PROTOCOL_INTERFACE MmUninstallProtocolInterface
;
332 EFI_HANDLE_PROTOCOL MmHandleProtocol
;
333 EFI_MM_REGISTER_PROTOCOL_NOTIFY MmRegisterProtocolNotify
;
334 EFI_LOCATE_HANDLE MmLocateHandle
;
335 EFI_LOCATE_PROTOCOL MmLocateProtocol
;
338 /// MMI Management functions
340 EFI_MM_INTERRUPT_MANAGE MmiManage
;
341 EFI_MM_INTERRUPT_REGISTER MmiHandlerRegister
;
342 EFI_MM_INTERRUPT_UNREGISTER MmiHandlerUnRegister
;