2 Common definitions in the Platform Initialization Specification version 1.2
3 VOLUME 4 System Management Mode Core Interface version.
5 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 #include <Pi/PiMultiPhase.h>
20 #include <Protocol/SmmCpuIo2.h>
22 typedef struct _EFI_SMM_SYSTEM_TABLE2 EFI_SMM_SYSTEM_TABLE2
;
25 /// The System Management System Table (SMST) signature
27 #define SMM_SMST_SIGNATURE SIGNATURE_32 ('S', 'M', 'S', 'T')
29 /// The System Management System Table (SMST) revision is 1.2
31 #define SMM_SPECIFICATION_MAJOR_REVISION 1
32 #define SMM_SPECIFICATION_MINOR_REVISION 20
33 #define EFI_SMM_SYSTEM_TABLE2_REVISION ((SMM_SPECIFICATION_MAJOR_REVISION<<16) | (SMM_SPECIFICATION_MINOR_REVISION))
36 Adds, updates, or removes a configuration table entry from the System Management System Table.
38 The SmmInstallConfigurationTable() function is used to maintain the list
39 of configuration tables that are stored in the System Management System
40 Table. The list is stored as an array of (GUID, Pointer) pairs. The list
41 must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.
43 @param[in] SystemTable A pointer to the SMM System Table (SMST).
44 @param[in] Guid A pointer to the GUID for the entry to add, update, or remove.
45 @param[in] Table A pointer to the buffer of the table to add.
46 @param[in] TableSize The size of the table to install.
48 @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.
49 @retval EFI_INVALID_PARAMETER Guid is not valid.
50 @retval EFI_NOT_FOUND An attempt was made to delete a non-existent entry.
51 @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.
55 (EFIAPI
*EFI_SMM_INSTALL_CONFIGURATION_TABLE2
)(
56 IN CONST EFI_SMM_SYSTEM_TABLE2
*SystemTable
,
57 IN CONST EFI_GUID
*Guid
,
63 The SmmStartupThisAp() lets the caller to get one distinct application processor
64 (AP) in the enabled processor pool to execute a caller-provided code stream
65 while in SMM. It runs the given code on this processor and reports the status.
66 It must be noted that the supplied code stream will be run only on an enabled
67 processor which has also entered SMM.
69 @param[in] Procedure A pointer to the code stream to be run on the designated AP of the system.
70 @param[in] CpuNumber The zero-based index of the processor number of the AP on which the code stream is supposed to run.
71 @param[in,out] ProcArguments Allow the caller to pass a list of parameters to the code that is run by the AP.
73 @retval EFI_SUCCESS The call was successful and the return parameters are valid.
74 @retval EFI_INVALID_PARAMETER The input arguments are out of range.
75 @retval EFI_INVALID_PARAMETER The CPU requested is not available on this SMI invocation.
76 @retval EFI_INVALID_PARAMETER The CPU cannot support an additional service invocation.
80 (EFIAPI
*EFI_SMM_STARTUP_THIS_AP
)(
81 IN EFI_AP_PROCEDURE Procedure
,
83 IN OUT VOID
*ProcArguments OPTIONAL
87 Function prototype for protocol install notification.
89 @param[in] Protocol Points to the protocol's unique identifier.
90 @param[in] Interface Points to the interface instance.
91 @param[in] Handle The handle on which the interface was installed.
97 (EFIAPI
*EFI_SMM_NOTIFY_FN
)(
98 IN CONST EFI_GUID
*Protocol
,
104 Register a callback function be called when a particular protocol interface is installed.
106 The SmmRegisterProtocolNotify() function creates a registration Function that is to be
107 called whenever a protocol interface is installed for Protocol by
108 SmmInstallProtocolInterface().
110 @param[in] Protocol The unique ID of the protocol for which the event is to be registered.
111 @param[in] Function Points to the notification function.
112 @param[out] Registration A pointer to a memory location to receive the registration value.
114 @retval EFI_SUCCESS Successfully returned the registration record that has been added.
115 @retval EFI_INVALID_PARAMETER One or more of Protocol, Function and Registration is NULL.
116 @retval EFI_OUT_OF_RESOURCES Not enough memory resource to finish the request.
120 (EFIAPI
*EFI_SMM_REGISTER_PROTOCOL_NOTIFY
)(
121 IN CONST EFI_GUID
*Protocol
,
122 IN EFI_SMM_NOTIFY_FN Function
,
123 OUT VOID
**Registration
127 Manage SMI of a particular type.
129 @param[in] HandlerType Points to the handler type or NULL for root SMI handlers.
130 @param[in] Context Points to an optional context buffer.
131 @param[in,out] CommBuffer Points to the optional communication buffer.
132 @param[in,out] CommBufferSize Points to the size of the optional communication buffer.
134 @retval EFI_SUCCESS Interrupt source was processed successfully but not quiesced.
135 @retval EFI_INTERRUPT_PENDING One or more SMI sources could not be quiesced.
136 @retval EFI_WARN_INTERRUPT_SOURCE_PENDING Interrupt source was not handled or quiesced.
137 @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED Interrupt source was handled and quiesced.
141 (EFIAPI
*EFI_SMM_INTERRUPT_MANAGE
)(
142 IN CONST EFI_GUID
*HandlerType
,
143 IN CONST VOID
*Context OPTIONAL
,
144 IN OUT VOID
*CommBuffer OPTIONAL
,
145 IN OUT UINTN
*CommBufferSize OPTIONAL
149 Main entry point for an SMM handler dispatch or communicate-based callback.
151 @param[in] DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
152 @param[in] Context Points to an optional handler context which was specified when the
153 handler was registered.
154 @param[in,out] CommBuffer A pointer to a collection of data in memory that will
155 be conveyed from a non-SMM environment into an SMM environment.
156 @param[in,out] CommBufferSize The size of the CommBuffer.
158 @retval EFI_SUCCESS The interrupt was handled and quiesced. No other handlers
159 should still be called.
160 @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED The interrupt has been quiesced but other handlers should
162 @retval EFI_WARN_INTERRUPT_SOURCE_PENDING The interrupt is still pending and other handlers should still
164 @retval EFI_INTERRUPT_PENDING The interrupt could not be quiesced.
168 (EFIAPI
*EFI_SMM_HANDLER_ENTRY_POINT2
)(
169 IN EFI_HANDLE DispatchHandle
,
170 IN CONST VOID
*Context OPTIONAL
,
171 IN OUT VOID
*CommBuffer OPTIONAL
,
172 IN OUT UINTN
*CommBufferSize OPTIONAL
176 Registers a handler to execute within SMM.
178 @param[in] Handler Handler service funtion pointer.
179 @param[in] HandlerType Points to the handler type or NULL for root SMI handlers.
180 @param[out] DispatchHandle On return, contains a unique handle which can be used to later
181 unregister the handler function.
183 @retval EFI_SUCCESS SMI handler added successfully.
184 @retval EFI_INVALID_PARAMETER Handler is NULL or DispatchHandle is NULL.
188 (EFIAPI
*EFI_SMM_INTERRUPT_REGISTER
)(
189 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
,
190 IN CONST EFI_GUID
*HandlerType OPTIONAL
,
191 OUT EFI_HANDLE
*DispatchHandle
195 Unregister a handler in SMM.
197 @param[in] DispatchHandle The handle that was specified when the handler was registered.
199 @retval EFI_SUCCESS Handler function was successfully unregistered.
200 @retval EFI_INVALID_PARAMETER DispatchHandle does not refer to a valid handle.
204 (EFIAPI
*EFI_SMM_INTERRUPT_UNREGISTER
)(
205 IN EFI_HANDLE DispatchHandle
209 /// Processor information and functionality needed by SMM Foundation.
211 typedef struct _EFI_SMM_ENTRY_CONTEXT
{
212 EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp
;
214 /// A number between zero and the NumberOfCpus field. This field designates which
215 /// processor is executing the SMM Foundation.
217 UINTN CurrentlyExecutingCpu
;
219 /// The number of current operational processors in the platform. This is a 1 based
220 /// counter. This does not indicate the number of processors that entered SMM.
224 /// Points to an array, where each element describes the number of bytes in the
225 /// corresponding save state specified by CpuSaveState. There are always
226 /// NumberOfCpus entries in the array.
228 UINTN
*CpuSaveStateSize
;
230 /// Points to an array, where each element is a pointer to a CPU save state. The
231 /// corresponding element in CpuSaveStateSize specifies the number of bytes in the
232 /// save state area. There are always NumberOfCpus entries in the array.
235 } EFI_SMM_ENTRY_CONTEXT
;
238 This function is the main entry point to the SMM Foundation.
240 @param[in] SmmEntryContext Processor information and functionality needed by SMM Foundation.
244 (EFIAPI
*EFI_SMM_ENTRY_POINT
)(
245 IN CONST EFI_SMM_ENTRY_CONTEXT
*SmmEntryContext
249 /// System Management System Table (SMST)
251 /// The System Management System Table (SMST) is a table that contains a collection of common
252 /// services for managing SMRAM allocation and providing basic I/O services. These services are
253 /// intended for both preboot and runtime usage.
255 struct _EFI_SMM_SYSTEM_TABLE2
{
257 /// The table header for the SMST.
259 EFI_TABLE_HEADER Hdr
;
261 /// A pointer to a NULL-terminated Unicode string containing the vendor name.
262 /// It is permissible for this pointer to be NULL.
264 CHAR16
*SmmFirmwareVendor
;
266 /// The particular revision of the firmware.
268 UINT32 SmmFirmwareRevision
;
270 EFI_SMM_INSTALL_CONFIGURATION_TABLE2 SmmInstallConfigurationTable
;
275 EFI_SMM_CPU_IO2_PROTOCOL SmmIo
;
278 /// Runtime memory services
280 EFI_ALLOCATE_POOL SmmAllocatePool
;
281 EFI_FREE_POOL SmmFreePool
;
282 EFI_ALLOCATE_PAGES SmmAllocatePages
;
283 EFI_FREE_PAGES SmmFreePages
;
288 EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp
;
291 /// CPU information records
295 /// A number between zero and and the NumberOfCpus field. This field designates
296 /// which processor is executing the SMM infrastructure.
298 UINTN CurrentlyExecutingCpu
;
300 /// The number of current operational processors in the platform. This is a 1 based counter.
304 /// Points to an array, where each element describes the number of bytes in the
305 /// corresponding save state specified by CpuSaveState. There are always
306 /// NumberOfCpus entries in the array.
308 UINTN
*CpuSaveStateSize
;
310 /// Points to an array, where each element is a pointer to a CPU save state. The
311 /// corresponding element in CpuSaveStateSize specifies the number of bytes in the
312 /// save state area. There are always NumberOfCpus entries in the array.
317 /// Extensibility table
321 /// The number of UEFI Configuration Tables in the buffer SmmConfigurationTable.
323 UINTN NumberOfTableEntries
;
325 /// A pointer to the UEFI Configuration Tables. The number of entries in the table is
326 /// NumberOfTableEntries.
328 EFI_CONFIGURATION_TABLE
*SmmConfigurationTable
;
331 /// Protocol services
333 EFI_INSTALL_PROTOCOL_INTERFACE SmmInstallProtocolInterface
;
334 EFI_UNINSTALL_PROTOCOL_INTERFACE SmmUninstallProtocolInterface
;
335 EFI_HANDLE_PROTOCOL SmmHandleProtocol
;
336 EFI_SMM_REGISTER_PROTOCOL_NOTIFY SmmRegisterProtocolNotify
;
337 EFI_LOCATE_HANDLE SmmLocateHandle
;
338 EFI_LOCATE_PROTOCOL SmmLocateProtocol
;
341 /// SMI Management functions
343 EFI_SMM_INTERRUPT_MANAGE SmiManage
;
344 EFI_SMM_INTERRUPT_REGISTER SmiHandlerRegister
;
345 EFI_SMM_INTERRUPT_UNREGISTER SmiHandlerUnRegister
;