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