]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/Dxe/Include/EfiMgmtModeRuntimeLib.h
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / Dxe / Include / EfiMgmtModeRuntimeLib.h
CommitLineData
3eb9473e 1/*++\r
2\r
4ea9375a
HT
3Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>\r
4This program and the accompanying materials \r
3eb9473e 5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13 \r
14 EfiMgmtModeRuntimeLib.h\r
15\r
16Abstract:\r
17\r
18 Light weight lib to support EFI drivers.\r
19\r
20--*/\r
21\r
22#ifndef _EFI_RT_SUPPORT_LIB_H_\r
23#define _EFI_RT_SUPPORT_LIB_H_\r
24\r
25#ifndef EFI_LOAD_IMAGE_SMM\r
26#define EFI_LOAD_DRIVER_SMM FALSE\r
27#else\r
28#define EFI_LOAD_DRIVER_SMM TRUE\r
29#endif\r
30\r
31#ifndef EFI_NO_LOAD_IMAGE_RT\r
32#define EFI_NO_LOAD_DRIVER_RT FALSE\r
33#else\r
34#define EFI_NO_LOAD_DRIVER_RT TRUE\r
35#endif\r
36\r
37#include "EfiCommonLib.h"\r
38#include "LinkedList.h"\r
39#include "ProcDep.h"\r
40\r
41#include EFI_PROTOCOL_DEFINITION (CpuIo)\r
42#include EFI_PROTOCOL_DEFINITION (FirmwareVolumeBlock)\r
43\r
44//\r
45// Driver Lib Globals.\r
46//\r
47extern EFI_BOOT_SERVICES *gBS;\r
48extern EFI_SYSTEM_TABLE *gST;\r
49extern UINTN gRtErrorLevel;\r
50extern BOOLEAN mEfiLoadDriverSmm;\r
51extern BOOLEAN mEfiNoLoadDriverRt;\r
52extern EFI_DEVICE_PATH_PROTOCOL *mFilePath;\r
53\r
54//\r
55// Runtime Memory Allocation/De-Allocation tools (Should be used in Boot Phase only)\r
56//\r
57EFI_STATUS\r
58EfiAllocateRuntimeMemoryPool (\r
59 IN UINTN Size,\r
60 OUT VOID **Buffer\r
61 )\r
62/*++\r
63\r
64Routine Description:\r
65\r
66 Allocate EfiRuntimeServicesData pool of specified size.\r
67\r
68Arguments:\r
69\r
70 Size - Pool size\r
71 Buffer - Memory pointer for output\r
72\r
73Returns:\r
74\r
75 Status code\r
76\r
77--*/\r
78;\r
79\r
80EFI_STATUS\r
81EfiFreeRuntimeMemoryPool (\r
82 IN VOID *Buffer\r
83 )\r
84/*++\r
85\r
86Routine Description:\r
87\r
88 Free allocated pool\r
89\r
90Arguments:\r
91\r
92 Buffer - Pool to be freed\r
93\r
94Returns:\r
95\r
96 Status code\r
97\r
98--*/\r
99;\r
100\r
101EFI_STATUS\r
102EfiLocateProtocolHandleBuffers (\r
103 IN EFI_GUID *Protocol,\r
104 IN OUT UINTN *NumberHandles,\r
105 OUT EFI_HANDLE **Buffer\r
106 )\r
107/*++\r
108\r
109Routine Description:\r
110\r
111 Returns an array of handles that support the requested protocol in a buffer allocated from pool.\r
112\r
113Arguments:\r
114\r
115 Protocol - Provides the protocol to search by.\r
116 NumberHandles - The number of handles returned in Buffer.\r
117 Buffer - A pointer to the buffer to return the requested array of handles that\r
118 support Protocol.\r
119\r
120Returns:\r
121\r
122 Status code\r
123\r
124--*/\r
125;\r
126\r
127EFI_STATUS\r
128EfiHandleProtocol (\r
129 IN EFI_HANDLE Handle,\r
130 IN EFI_GUID *Protocol,\r
131 OUT VOID **Interface\r
132 )\r
133/*++\r
134\r
135Routine Description:\r
136\r
137 Queries a handle to determine if it supports a specified protocol.\r
138\r
139Arguments:\r
140\r
141 Handle - The handle being queried.\r
142 Protocol - The published unique identifier of the protocol.\r
143 Interface - Supplies the address where a pointer to the corresponding Protocol\r
144 Interface is returned. NULL will be returned in *Interface if a\r
145 structure is not associated with Protocol.\r
146\r
147Returns:\r
148\r
149 Status code\r
150\r
151--*/\r
152;\r
153\r
154EFI_STATUS\r
155EfiInstallProtocolInterface (\r
156 IN OUT EFI_HANDLE *Handle,\r
157 IN EFI_GUID *Protocol,\r
158 IN EFI_INTERFACE_TYPE InterfaceType,\r
159 IN VOID *Interface\r
160 )\r
161/*++\r
162\r
163Routine Description:\r
164\r
165 Installs a protocol interface on a device handle. If the handle does not exist, it is created and added\r
166to the list of handles in the system.\r
167\r
168Arguments:\r
169\r
170 Handle - A pointer to the EFI_HANDLE on which the interface is to be installed.\r
171 Protocol - The numeric ID of the protocol interface.\r
172 InterfaceType - Indicates whether Interface is supplied in native form.\r
173 Interface - A pointer to the protocol interface.\r
174\r
175Returns:\r
176\r
177 Status code\r
178\r
179--*/\r
180;\r
181\r
182EFI_STATUS\r
183EfiReinstallProtocolInterface (\r
184 IN EFI_HANDLE SmmProtocolHandle,\r
185 IN EFI_GUID *Protocol,\r
186 IN VOID *OldInterface,\r
187 IN VOID *NewInterface\r
188 )\r
189/*++\r
190\r
191Routine Description:\r
192\r
193 Reinstalls a protocol interface on a device handle.\r
194\r
195Arguments:\r
196\r
197 SmmProtocolHandle - Handle on which the interface is to be reinstalled.\r
198 Protocol - The numeric ID of the interface.\r
199 OldInterface - A pointer to the old interface.\r
200 NewInterface - A pointer to the new interface.\r
201\r
202Returns:\r
203\r
204 Status code\r
205\r
206--*/\r
207;\r
208\r
209EFI_STATUS\r
210EfiLocateProtocolInterface (\r
211 EFI_GUID *Protocol,\r
212 VOID *Registration, OPTIONAL\r
213 VOID **Interface\r
214 )\r
215/*++\r
216\r
217Routine Description:\r
218\r
219 Returns the first protocol instance that matches the given protocol.\r
220\r
221Arguments:\r
222\r
223 Protocol - Provides the protocol to search for.\r
224 Registration - Optional registration key returned from\r
225 RegisterProtocolNotify(). If Registration is NULL, then\r
226 it is ignored.\r
227 Interface - On return, a pointer to the first interface that matches Protocol and\r
228 Registration.\r
229\r
230Returns:\r
231\r
232 Status code\r
233\r
234--*/\r
235;\r
236\r
237EFI_STATUS\r
238UninstallProtocolInterface (\r
239 IN EFI_HANDLE SmmProtocolHandle,\r
240 IN EFI_GUID *Protocol,\r
241 IN VOID *Interface\r
242 )\r
243/*++\r
244\r
245Routine Description:\r
246\r
247 Removes a protocol interface from a device handle.\r
248\r
249Arguments:\r
250\r
251 SmmProtocolHandle - The handle on which the interface was installed.\r
252 Protocol - The numeric ID of the interface.\r
253 Interface - A pointer to the interface.\r
254\r
255Returns:\r
256\r
257 Status code\r
258\r
259--*/\r
260;\r
261\r
262EFI_STATUS\r
263EfiRegisterProtocolCallback (\r
264 IN EFI_EVENT_NOTIFY CallbackFunction,\r
265 IN VOID *Context,\r
266 IN EFI_GUID *ProtocolGuid,\r
267 IN EFI_TPL NotifyTpl,\r
268 OUT VOID **Registeration,\r
269 OUT EFI_EVENT *Event\r
270 )\r
271/*++\r
272\r
273Routine Description:\r
274\r
275 Register a callback function to be signaled whenever an interface is installed for \r
276 a specified protocol.\r
277\r
278Arguments:\r
279\r
280 CallbackFunction - Call back function\r
281 Context - Context of call back function\r
282 ProtocolGuid - The numeric ID of the protocol for which the callback function\r
283 is to be registered.\r
284 NotifyTpl - Notify tpl of callback function\r
285 Registeration - A pointer to a memory location to receive the registration value.\r
286 Event - Event that is to be signaled whenever a protocol interface is registered\r
287 for Protocol.\r
288\r
289Returns:\r
290\r
291 Status code\r
292\r
293--*/\r
294;\r
295\r
296EFI_STATUS\r
297EfiSignalProtocolEvent (\r
298 EFI_EVENT Event\r
299 )\r
300/*++\r
301\r
302Routine Description:\r
303\r
304 Signals an event.\r
305\r
306Arguments:\r
307\r
308 Event - The event to signal.\r
309\r
310Returns:\r
311\r
312 Status code\r
313\r
314--*/\r
315;\r
316\r
317EFI_STATUS\r
318EfiInstallVendorConfigurationTable (\r
319 IN EFI_GUID *Guid,\r
320 IN VOID *Table\r
321 )\r
322/*++\r
323\r
324Routine Description:\r
325\r
326 Adds, updates, or removes a configuration table entry from the EFI System Table.\r
327\r
328Arguments:\r
329\r
330 Guid - A pointer to the GUID for the entry to add, update, or remove.\r
331 Table - A pointer to the configuration table for the entry to add, update, or\r
332 remove. May be NULL.\r
333\r
334Returns:\r
335\r
336 Status code\r
337\r
338--*/\r
339;\r
340\r
341EFI_STATUS\r
342EfiGetVendorConfigurationTable (\r
343 IN EFI_GUID *Guid,\r
344 OUT VOID **Table\r
345 )\r
346/*++\r
347\r
348Routine Description:\r
349 \r
350 Return the EFI 1.0 System Tabl entry with TableGuid\r
351\r
352Arguments:\r
353\r
354 Guid - Name of entry to return in the system table\r
355 Table - Pointer in EFI system table associated with TableGuid\r
356\r
357Returns: \r
358\r
359 EFI_SUCCESS - Table returned;\r
360 EFI_NOT_FOUND - TableGuid not in EFI system table\r
361\r
362--*/\r
363;\r
364\r
365EFI_STATUS\r
366EfiInitializeUtilsRuntimeDriverLib (\r
367 IN EFI_HANDLE ImageHandle,\r
368 IN EFI_SYSTEM_TABLE *SystemTable,\r
369 IN EFI_EVENT_NOTIFY GoVirtualChildEvent\r
370 )\r
371/*++\r
372\r
373Routine Description:\r
374\r
375 Intialize runtime Driver Lib if it has not yet been initialized. \r
376\r
377Arguments:\r
378\r
379 ImageHandle - The firmware allocated handle for the EFI image.\r
380 \r
381 SystemTable - A pointer to the EFI System Table.\r
382\r
383 GoVirtualChildEvent - Caller can register a virtual notification event.\r
384\r
385Returns: \r
386\r
387 EFI_STATUS always returns EFI_SUCCESS\r
388\r
389--*/\r
390;\r
391\r
392BOOLEAN\r
393EfiInManagementInterrupt (\r
394 VOID\r
395 )\r
396/*++\r
397\r
398Routine Description:\r
399\r
400 Indicate whether the caller is already in SMM or not.\r
401\r
402Arguments:\r
403\r
404 None\r
405\r
406Returns:\r
407\r
408 TRUE - In SMM\r
409 FALSE - Not in SMM\r
410\r
411--*/\r
412;\r
413\r
414//\r
415// This MACRO initializes the RUNTIME invironment and optionally loads Image to SMM or Non-SMM space\r
416// based upon the presence of build flags EFI_LOAD_DRIVER_SMM and EFI_NO_LOAD_DRIVER_RT.\r
417//\r
418#define EFI_INITIALIZE_RUNTIME_DRIVER_LIB(ImageHandle, SystemTable, GoVirtualChildEvent, FilePath) \\r
419 mEfiLoadDriverSmm = EFI_LOAD_DRIVER_SMM; \\r
420 mEfiNoLoadDriverRt = EFI_NO_LOAD_DRIVER_RT; \\r
421 mFilePath = (EFI_DEVICE_PATH_PROTOCOL*) FilePath; \\r
422 EfiInitializeUtilsRuntimeDriverLib ((EFI_HANDLE) ImageHandle, (EFI_SYSTEM_TABLE*) SystemTable, (EFI_EVENT_NOTIFY) GoVirtualChildEvent); \\r
423 if (!EfiInManagementInterrupt()) { \\r
424 if (mEfiNoLoadDriverRt) { \\r
425 return EFI_SUCCESS; \\r
426 } \\r
427 } \r
428\r
429#endif\r