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