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