Removed CommonHeader.h from MdePkg & MdeModulePkg
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / Library.h
CommitLineData
28a00297 1/*++\r
2\r
3Copyright (c) 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
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 Library.h\r
15\r
16Abstract:\r
17\r
18Revision History\r
19\r
20--*/\r
21\r
22#ifndef _DXE_LIBRARY_H_\r
23#define _DXE_LIBRARY_H_\r
24\r
25\r
26VOID\r
27CoreReportProgressCode (\r
28 IN EFI_STATUS_CODE_VALUE Value\r
29 )\r
30/*++\r
31\r
32Routine Description:\r
33\r
34 Report status code of type EFI_PROGRESS_CODE by caller ID gEfiDxeServicesTableGuid.\r
35 \r
36Arguments:\r
37\r
38 Value - Describes the class/subclass/operation of the hardware or software entity \r
39 that the Status Code relates to. \r
40 \r
41Returns:\r
42\r
43 None\r
44\r
45--*/\r
46;\r
47\r
48VOID\r
49CoreReportProgressCodeSpecific (\r
50 IN EFI_STATUS_CODE_VALUE Value,\r
51 IN EFI_HANDLE Handle\r
52 )\r
53/*++\r
54\r
55Routine Description:\r
56\r
57 Report status code of type EFI_PROGRESS_CODE by caller ID gEfiDxeServicesTableGuid, \r
58 with a handle as additional information.\r
59 \r
60Arguments:\r
61\r
62 Value - Describes the class/subclass/operation of the hardware or software entity \r
63 that the Status Code relates to. \r
64 \r
65 Handle - Additional information.\r
66 \r
67Returns:\r
68\r
69 None\r
70\r
71--*/\r
72;\r
73\r
74VOID\r
75CoreAcquireLock (\r
76 IN EFI_LOCK *Lock\r
77 )\r
78/*++\r
79\r
80Routine Description:\r
81\r
82 Raising to the task priority level of the mutual exclusion\r
83 lock, and then acquires ownership of the lock.\r
84 \r
85Arguments:\r
86\r
87 Lock - The lock to acquire\r
88 \r
89Returns:\r
90\r
91 Lock owned\r
92\r
93--*/\r
94;\r
95\r
96EFI_STATUS\r
97CoreAcquireLockOrFail (\r
98 IN EFI_LOCK *Lock\r
99 )\r
100/*++\r
101\r
102Routine Description:\r
103\r
104 Initialize a basic mutual exclusion lock. Each lock\r
105 provides mutual exclusion access at it's task priority\r
106 level. Since there is no-premption (at any TPL) or\r
107 multiprocessor support, acquiring the lock only consists\r
108 of raising to the locks TPL.\r
109 \r
110Arguments:\r
111\r
112 Lock - The EFI_LOCK structure to initialize\r
113 \r
114Returns:\r
115\r
116 EFI_SUCCESS - Lock Owned.\r
117 EFI_ACCESS_DENIED - Reentrant Lock Acquisition, Lock not Owned.\r
118\r
119--*/\r
120;\r
121\r
122VOID\r
123CoreReleaseLock (\r
124 IN EFI_LOCK *Lock\r
125 )\r
126/*++\r
127\r
128Routine Description:\r
129\r
130 Releases ownership of the mutual exclusion lock, and\r
131 restores the previous task priority level.\r
132 \r
133Arguments:\r
134\r
135 Lock - The lock to release\r
136 \r
137Returns:\r
138\r
139 Lock unowned\r
140\r
141--*/\r
142;\r
143\r
144//\r
145// Device Path functions\r
146//\r
147\r
148UINTN\r
149CoreDevicePathSize (\r
150 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
151 )\r
152/*++\r
153\r
154Routine Description:\r
155\r
156 Calculate the size of a whole device path. \r
157 \r
158Arguments:\r
159\r
160 DevicePath - The pointer to the device path data.\r
161 \r
162Returns:\r
163\r
164 Size of device path data structure..\r
165\r
166--*/\r
167;\r
168\r
169BOOLEAN\r
170CoreIsDevicePathMultiInstance (\r
171 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
172 )\r
173/*++\r
174\r
175Routine Description:\r
176 Return TRUE is this is a multi instance device path.\r
177\r
178Arguments:\r
179 DevicePath - A pointer to a device path data structure.\r
180\r
181\r
182Returns:\r
183 TRUE - If DevicePath is multi instance. FALSE - If DevicePath is not multi\r
184 instance.\r
185\r
186--*/\r
187;\r
188\r
189\r
190EFI_DEVICE_PATH_PROTOCOL *\r
191CoreDuplicateDevicePath (\r
192 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
193 )\r
194/*++\r
195\r
196Routine Description:\r
197 Duplicate a new device path data structure from the old one.\r
198\r
199Arguments:\r
200 DevicePath - A pointer to a device path data structure.\r
201\r
202Returns:\r
203 A pointer to the new allocated device path data.\r
204 Caller must free the memory used by DevicePath if it is no longer needed.\r
205\r
206--*/\r
207;\r
208\r
209EFI_DEVICE_PATH_PROTOCOL *\r
210CoreAppendDevicePath (\r
211 IN EFI_DEVICE_PATH_PROTOCOL *Src1,\r
212 IN EFI_DEVICE_PATH_PROTOCOL *Node\r
213 )\r
214/*++\r
215\r
216Routine Description:\r
217 Function is used to append a Src1 and Src2 together.\r
218\r
219Arguments:\r
220 Src1 - A pointer to a device path data structure.\r
221\r
222 Node - A pointer to a device path data structure.\r
223\r
224Returns:\r
225\r
226 A pointer to the new device path is returned.\r
227 NULL is returned if space for the new device path could not be allocated from pool.\r
228 It is up to the caller to free the memory used by Src1 and Src2 if they are no longer needed.\r
229\r
230--*/\r
231;\r
232\r
233VOID *\r
234CoreAllocateBootServicesPool (\r
235 IN UINTN AllocationSize\r
236 )\r
237/*++\r
238\r
239Routine Description:\r
240\r
241 Allocate pool of type EfiBootServicesData, the size is specified with AllocationSize.\r
242 \r
243Arguments:\r
244\r
245 AllocationSize - Size to allocate.\r
246 \r
247Returns:\r
248\r
249 Pointer of the allocated pool.\r
250\r
251--*/\r
252;\r
253\r
254VOID *\r
255CoreAllocateZeroBootServicesPool (\r
256 IN UINTN AllocationSize\r
257 )\r
258/*++\r
259\r
260Routine Description:\r
261\r
262 Allocate pool of type EfiBootServicesData and zero it, the size is specified with AllocationSize.\r
263 \r
264Arguments:\r
265\r
266 AllocationSize - Size to allocate.\r
267 \r
268Returns:\r
269\r
270 Pointer of the allocated pool.\r
271\r
272--*/\r
273;\r
274\r
275EFI_STATUS\r
276CoreGetConfigTable (\r
277 IN EFI_GUID *Guid,\r
278 IN OUT VOID **Table\r
279 )\r
280/*++\r
281\r
282Routine Description:\r
283\r
284 Find a config table by name in system table's ConfigurationTable.\r
285\r
286Arguments:\r
287\r
288 Guid - The table name to look for\r
289 \r
290 Table - Pointer of the config table\r
291\r
292Returns: \r
293\r
294 EFI_NOT_FOUND - Could not find the table in system table's ConfigurationTable.\r
295 \r
296 EFI_SUCCESS - Table successfully found.\r
297\r
298--*/\r
299;\r
300\r
301VOID *\r
302CoreAllocateRuntimeCopyPool (\r
303 IN UINTN AllocationSize,\r
304 IN VOID *Buffer\r
305 )\r
306/*++\r
307\r
308Routine Description:\r
309\r
310 Allocate pool of specified size with EfiRuntimeServicesData type, and copy specified buffer to this pool.\r
311 \r
312Arguments:\r
313\r
314 AllocationSize - Size to allocate.\r
315 \r
316 Buffer - Specified buffer that will be copy to the allocated pool\r
317 \r
318Returns:\r
319\r
320 Pointer of the allocated pool.\r
321\r
322--*/\r
323;\r
324\r
325VOID *\r
326CoreAllocateRuntimePool (\r
327 IN UINTN AllocationSize\r
328 )\r
329/*++\r
330\r
331Routine Description:\r
332\r
333 Allocate pool of type EfiRuntimeServicesData, the size is specified with AllocationSize.\r
334 \r
335Arguments:\r
336\r
337 AllocationSize - Size to allocate.\r
338 \r
339Returns:\r
340\r
341 Pointer of the allocated pool.\r
342\r
343--*/\r
344;\r
345\r
346VOID *\r
347CoreAllocateCopyPool (\r
348 IN UINTN AllocationSize,\r
349 IN VOID *Buffer\r
350 )\r
351/*++\r
352\r
353Routine Description:\r
354\r
355 Allocate pool of specified size with EfiBootServicesData type, and copy specified buffer to this pool.\r
356 \r
357Arguments:\r
358\r
359 AllocationSize - Size to allocate.\r
360 \r
361 Buffer - Specified buffer that will be copy to the allocated pool\r
362 \r
363Returns:\r
364\r
365 Pointer of the allocated pool.\r
366\r
367--*/\r
368;\r
369\r
370EFI_EVENT\r
371CoreCreateProtocolNotifyEvent (\r
372 IN EFI_GUID *ProtocolGuid,\r
373 IN EFI_TPL NotifyTpl,\r
374 IN EFI_EVENT_NOTIFY NotifyFunction,\r
375 IN VOID *NotifyContext,\r
376 OUT VOID **Registration,\r
377 IN BOOLEAN SignalFlag\r
378 )\r
379/*++\r
380\r
381Routine Description:\r
382\r
383 Create a protocol notification event and return it.\r
384\r
385Arguments:\r
386\r
387 ProtocolGuid - Protocol to register notification event on.\r
388\r
389 NotifyTpl - Maximum TPL to signal the NotifyFunction.\r
390\r
391 NotifyFuncition - EFI notification routine.\r
392\r
393 NotifyContext - Context passed into Event when it is created.\r
394\r
395 Registration - Registration key returned from RegisterProtocolNotify().\r
396\r
397 SignalFlag - Boolean value to decide whether kick the event after register or not. \r
398\r
399Returns:\r
400\r
401 The EFI_EVENT that has been registered to be signaled when a ProtocolGuid\r
402 is added to the system.\r
403\r
404--*/\r
405;\r
406\r
407#endif\r