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