2 Common definitions in the Platform Initialization Specification version 1.2
3 VOLUME 4 System Management Mode Core Interface version.
5 Copyright (c) 2009 - 2010, Intel Corporation
6 All rights reserved. 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>
24 /// To avoid name conflict between PI and Framework SMM spec, the following names defined
25 /// in PI 1.2 SMM spec are renamed. These renamings are not yet in a public PI spec and errta.
27 /// EFI_SMM_SYSTEM_TABLE -> EFI_SMM_SYSTEM_TABLE2
28 /// EFI_SMM_SYSTEM_TABLE_REVISION -> EFI_SMM_SYSTEM_TABLE2_REVISION
29 /// EFI_SMM_INSTALL_CONFIGURATION_TABLE -> EFI_SMM_INSTALL_CONFIGURATION_TABLE2
32 typedef struct _EFI_SMM_SYSTEM_TABLE2 EFI_SMM_SYSTEM_TABLE2
;
35 /// The System Management System Table (SMST) signature
37 #define SMM_SMST_SIGNATURE SIGNATURE_32 ('S', 'M', 'S', 'T')
39 /// The System Management System Table (SMST) revision is 1.0
41 #define EFI_SMM_SYSTEM_TABLE2_REVISION ((1 << 16) | (0x00))
44 Adds, updates, or removes a configuration table entry from the System Management System Table.
46 The SmmInstallConfigurationTable() function is used to maintain the list
47 of configuration tables that are stored in the System Management System
48 Table. The list is stored as an array of (GUID, Pointer) pairs. The list
49 must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.
51 @param[in] SystemTable A pointer to the SMM System Table (SMST).
52 @param[in] Guid A pointer to the GUID for the entry to add, update, or remove.
53 @param[in] Table A pointer to the buffer of the table to add.
54 @param[in] TableSize The size of the table to install.
56 @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.
57 @retval EFI_INVALID_PARAMETER Guid is not valid.
58 @retval EFI_NOT_FOUND An attempt was made to delete a non-existent entry.
59 @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.
63 (EFIAPI
*EFI_SMM_INSTALL_CONFIGURATION_TABLE2
)(
64 IN CONST EFI_SMM_SYSTEM_TABLE2
*SystemTable
,
65 IN CONST EFI_GUID
*Guid
,
71 The SmmStartupThisAp() lets the caller to get one distinct application processor
72 (AP) in the enabled processor pool to execute a caller-provided code stream
73 while in SMM. It runs the given code on this processor and reports the status.
74 It must be noted that the supplied code stream will be run only on an enabled
75 processor which has also entered SMM.
77 @param[in] Procedure A pointer to the code stream to be run on the designated AP of the system.
78 @param[in] CpuNumber The zero-based index of the processor number of the AP on which the code stream is supposed to run.
79 @param[in,out] ProcArguments Allow the caller to pass a list of parameters to the code that is run by the AP.
81 @retval EFI_SUCCESS The call was successful and the return parameters are valid.
82 @retval EFI_INVALID_PARAMETER The input arguments are out of range.
83 @retval EFI_INVALID_PARAMETER The CPU requested is not available on this SMI invocation.
84 @retval EFI_INVALID_PARAMETER The CPU cannot support an additional service invocation.
88 (EFIAPI
*EFI_SMM_STARTUP_THIS_AP
)(
89 IN EFI_AP_PROCEDURE Procedure
,
91 IN OUT VOID
*ProcArguments OPTIONAL
95 Function prototype for protocol install notification.
97 @param[in] Protocol Points to the protocol's unique identifier.
98 @param[in] Interface Points to the interface instance.
99 @param[in] Handle The handle on which the interface was installed.
105 (EFIAPI
*EFI_SMM_NOTIFY_FN
)(
106 IN CONST EFI_GUID
*Protocol
,
112 Register a callback function be called when a particular protocol interface is installed.
114 The SmmRegisterProtocolNotify() function creates a registration Function that is to be
115 called whenever a protocol interface is installed for Protocol by
116 SmmInstallProtocolInterface().
118 @param[in] Protocol The unique ID of the protocol for which the event is to be registered.
119 @param[in] Function Points to the notification function.
120 @param[out] Registration A pointer to a memory location to receive the registration value.
122 @retval EFI_SUCCESS Successfully returned the registration record that has been added.
123 @retval EFI_INVALID_PARAMETER One or more of Protocol, Function and Registration is NULL.
124 @retval EFI_OUT_OF_RESOURCES Not enough memory resource to finish the request.
128 (EFIAPI
*EFI_SMM_REGISTER_PROTOCOL_NOTIFY
)(
129 IN CONST EFI_GUID
*Protocol
,
130 IN EFI_SMM_NOTIFY_FN Function
,
131 OUT VOID
**Registration
135 Manage SMI of a particular type.
137 @param[in] HandlerType Points to the handler type or NULL for root SMI handlers.
138 @param[in] Context Points to an optional context buffer.
139 @param[in,out] CommBuffer Points to the optional communication buffer.
140 @param[in,out] CommBufferSize Points to the size of the optional communication buffer.
142 @retval EFI_SUCCESS Interrupt source was processed successfully but not quiesced.
143 @retval EFI_INTERRUPT_PENDING One or more SMI sources could not be quiesced.
144 @retval EFI_WARN_INTERRUPT_SOURCE_PENDING Interrupt source was not handled or quiesced.
145 @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED Interrupt source was handled and quiesced.
149 (EFIAPI
*EFI_SMM_INTERRUPT_MANAGE
)(
150 IN CONST EFI_GUID
*HandlerType
,
151 IN CONST VOID
*Context OPTIONAL
,
152 IN OUT VOID
*CommBuffer OPTIONAL
,
153 IN OUT UINTN
*CommBufferSize OPTIONAL
157 Main entry point for an SMM handler dispatch or communicate-based callback.
159 @param[in] DispatchHandle The unique handle assigned to this handler by SmiHandlerRegister().
160 @param[in] Context Points to an optional handler context which was specified when the
161 handler was registered.
162 @param[in,out] CommBuffer A pointer to a collection of data in memory that will
163 be conveyed from a non-SMM environment into an SMM environment.
164 @param[in,out] CommBufferSize The size of the CommBuffer.
166 @retval EFI_SUCCESS The interrupt was handled and quiesced. No other handlers
167 should still be called.
168 @retval EFI_WARN_INTERRUPT_SOURCE_QUIESCED The interrupt has been quiesced but other handlers should
170 @retval EFI_WARN_INTERRUPT_SOURCE_PENDING The interrupt is still pending and other handlers should still
172 @retval EFI_INTERRUPT_PENDING The interrupt could not be quiesced.
176 (EFIAPI
*EFI_SMM_HANDLER_ENTRY_POINT2
)(
177 IN EFI_HANDLE DispatchHandle
,
178 IN CONST VOID
*Context OPTIONAL
,
179 IN OUT VOID
*CommBuffer OPTIONAL
,
180 IN OUT UINTN
*CommBufferSize OPTIONAL
184 Registers a handler to execute within SMM.
186 @param[in] Handler Handler service funtion pointer.
187 @param[in] HandlerType Points to the handler type or NULL for root SMI handlers.
188 @param[out] DispatchHandle On return, contains a unique handle which can be used to later
189 unregister the handler function.
191 @retval EFI_SUCCESS SMI handler added successfully.
192 @retval EFI_INVALID_PARAMETER Handler is NULL or DispatchHandle is NULL.
196 (EFIAPI
*EFI_SMM_INTERRUPT_REGISTER
)(
197 IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
,
198 IN CONST EFI_GUID
*HandlerType OPTIONAL
,
199 OUT EFI_HANDLE
*DispatchHandle
203 Unregister a handler in SMM.
205 @param[in] DispatchHandle The handle that was specified when the handler was registered.
207 @retval EFI_SUCCESS Handler function was successfully unregistered.
208 @retval EFI_INVALID_PARAMETER DispatchHandle does not refer to a valid handle.
212 (EFIAPI
*EFI_SMM_INTERRUPT_UNREGISTER
)(
213 IN EFI_HANDLE DispatchHandle
217 /// Processor information and functionality needed by SMM Foundation.
219 typedef struct _EFI_SMM_ENTRY_CONTEXT
{
220 EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp
;
222 /// A number between zero and the NumberOfCpus field. This field designates which
223 /// processor is executing the SMM Foundation.
225 UINTN CurrentlyExecutingCpu
;
227 /// The number of current operational processors in the platform. This is a 1 based
228 /// counter. This does not indicate the number of processors that entered SMM.
232 /// Points to an array, where each element describes the number of bytes in the
233 /// corresponding save state specified by CpuSaveState. There are always
234 /// NumberOfCpus entries in the array.
236 UINTN
*CpuSaveStateSize
;
238 /// Points to an array, where each element is a pointer to a CPU save state. The
239 /// corresponding element in CpuSaveStateSize specifies the number of bytes in the
240 /// save state area. There are always NumberOfCpus entries in the array.
243 } EFI_SMM_ENTRY_CONTEXT
;
246 This function is the main entry point to the SMM Foundation.
248 @param[in] SmmEntryContext Processor information and functionality needed by SMM Foundation.
252 (EFIAPI
*EFI_SMM_ENTRY_POINT
)(
253 IN CONST EFI_SMM_ENTRY_CONTEXT
*SmmEntryContext
257 /// System Management System Table (SMST)
259 /// The System Management System Table (SMST) is a table that contains a collection of common
260 /// services for managing SMRAM allocation and providing basic I/O services. These services are
261 /// intended for both preboot and runtime usage.
263 struct _EFI_SMM_SYSTEM_TABLE2
{
265 /// The table header for the SMST.
267 EFI_TABLE_HEADER Hdr
;
269 /// A pointer to a NULL-terminated Unicode string containing the vendor name.
270 /// It is permissible for this pointer to be NULL.
272 CHAR16
*SmmFirmwareVendor
;
274 /// The particular revision of the firmware.
276 UINT32 SmmFirmwareRevision
;
278 EFI_SMM_INSTALL_CONFIGURATION_TABLE2 SmmInstallConfigurationTable
;
283 EFI_SMM_CPU_IO2_PROTOCOL SmmIo
;
286 /// Runtime memory services
288 EFI_ALLOCATE_POOL SmmAllocatePool
;
289 EFI_FREE_POOL SmmFreePool
;
290 EFI_ALLOCATE_PAGES SmmAllocatePages
;
291 EFI_FREE_PAGES SmmFreePages
;
296 EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp
;
299 /// CPU information records
303 /// A number between zero and and the NumberOfCpus field. This field designates
304 /// which processor is executing the SMM infrastructure.
306 UINTN CurrentlyExecutingCpu
;
308 /// The number of current operational processors in the platform. This is a 1 based counter.
312 /// Points to an array, where each element describes the number of bytes in the
313 /// corresponding save state specified by CpuSaveState. There are always
314 /// NumberOfCpus entries in the array.
316 UINTN
*CpuSaveStateSize
;
318 /// Points to an array, where each element is a pointer to a CPU save state. The
319 /// corresponding element in CpuSaveStateSize specifies the number of bytes in the
320 /// save state area. There are always NumberOfCpus entries in the array.
325 /// Extensibility table
329 /// The number of UEFI Configuration Tables in the buffer SmmConfigurationTable.
331 UINTN NumberOfTableEntries
;
333 /// A pointer to the UEFI Configuration Tables. The number of entries in the table is
334 /// NumberOfTableEntries.
336 EFI_CONFIGURATION_TABLE
*SmmConfigurationTable
;
339 /// Protocol services
341 EFI_INSTALL_PROTOCOL_INTERFACE SmmInstallProtocolInterface
;
342 EFI_UNINSTALL_PROTOCOL_INTERFACE SmmUninstallProtocolInterface
;
343 EFI_HANDLE_PROTOCOL SmmHandleProtocol
;
344 EFI_SMM_REGISTER_PROTOCOL_NOTIFY SmmRegisterProtocolNotify
;
345 EFI_LOCATE_HANDLE SmmLocateHandle
;
346 EFI_LOCATE_PROTOCOL SmmLocateProtocol
;
349 /// SMI Management functions
351 EFI_SMM_INTERRUPT_MANAGE SmiManage
;
352 EFI_SMM_INTERRUPT_REGISTER SmiHandlerRegister
;
353 EFI_SMM_INTERRUPT_UNREGISTER SmiHandlerUnRegister
;