]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Internal functions shared in DxeCore module.\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r | |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef _DXE_LIBRARY_H_\r | |
16 | #define _DXE_LIBRARY_H_\r | |
17 | \r | |
18 | \r | |
19 | \r | |
20 | /**\r | |
21 | Report status code of type EFI_PROGRESS_CODE by caller ID gEfiCallerIdGuid.\r | |
22 | \r | |
23 | @param Value Describes the class/subclass/operation of the \r | |
24 | hardware or software entity that the Status Code \r | |
25 | relates to.\r | |
26 | \r | |
27 | **/\r | |
28 | VOID\r | |
29 | CoreReportProgressCode (\r | |
30 | IN EFI_STATUS_CODE_VALUE Value\r | |
31 | );\r | |
32 | \r | |
33 | \r | |
34 | /**\r | |
35 | Report status code of type EFI_PROGRESS_CODE by caller ID gEfiCallerIdGuid,\r | |
36 | with a handle as additional information.\r | |
37 | \r | |
38 | @param Value Describes the class/subclass/operation of the \r | |
39 | hardware or software entity that the Status Code \r | |
40 | relates to. \r | |
41 | @param Handle Additional information.\r | |
42 | \r | |
43 | **/\r | |
44 | VOID\r | |
45 | CoreReportProgressCodeSpecific (\r | |
46 | IN EFI_STATUS_CODE_VALUE Value,\r | |
47 | IN EFI_HANDLE Handle\r | |
48 | );\r | |
49 | \r | |
50 | \r | |
51 | /**\r | |
52 | Raising to the task priority level of the mutual exclusion\r | |
53 | lock, and then acquires ownership of the lock.\r | |
54 | \r | |
55 | @param Lock The lock to acquire \r | |
56 | \r | |
57 | @return Lock owned\r | |
58 | \r | |
59 | **/\r | |
60 | VOID\r | |
61 | CoreAcquireLock (\r | |
62 | IN EFI_LOCK *Lock\r | |
63 | );\r | |
64 | \r | |
65 | \r | |
66 | /**\r | |
67 | Initialize a basic mutual exclusion lock. Each lock\r | |
68 | provides mutual exclusion access at it's task priority\r | |
69 | level. Since there is no-premption (at any TPL) or\r | |
70 | multiprocessor support, acquiring the lock only consists\r | |
71 | of raising to the locks TPL.\r | |
72 | \r | |
73 | @param Lock The EFI_LOCK structure to initialize \r | |
74 | \r | |
75 | @retval EFI_SUCCESS Lock Owned. \r | |
76 | @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.\r | |
77 | \r | |
78 | **/\r | |
79 | EFI_STATUS\r | |
80 | CoreAcquireLockOrFail (\r | |
81 | IN EFI_LOCK *Lock\r | |
82 | );\r | |
83 | \r | |
84 | \r | |
85 | /**\r | |
86 | Releases ownership of the mutual exclusion lock, and\r | |
87 | restores the previous task priority level.\r | |
88 | \r | |
89 | @param Lock The lock to release \r | |
90 | \r | |
91 | @return Lock unowned\r | |
92 | \r | |
93 | **/\r | |
94 | VOID\r | |
95 | CoreReleaseLock (\r | |
96 | IN EFI_LOCK *Lock\r | |
97 | );\r | |
98 | \r | |
99 | //\r | |
100 | // Device Path functions\r | |
101 | //\r | |
102 | \r | |
103 | \r | |
104 | /**\r | |
105 | Calculate the size of a whole device path.\r | |
106 | \r | |
107 | @param DevicePath The pointer to the device path data. \r | |
108 | \r | |
109 | @return Size of device path data structure..\r | |
110 | \r | |
111 | **/\r | |
112 | UINTN\r | |
113 | CoreDevicePathSize (\r | |
114 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
115 | );\r | |
116 | \r | |
117 | \r | |
118 | /**\r | |
119 | Return TRUE is this is a multi instance device path.\r | |
120 | \r | |
121 | @param DevicePath A pointer to a device path data structure. \r | |
122 | \r | |
123 | @retval TRUE If DevicePath is multi instance. FALSE - If \r | |
124 | DevicePath is not multi instance.\r | |
125 | \r | |
126 | **/\r | |
127 | BOOLEAN\r | |
128 | CoreIsDevicePathMultiInstance (\r | |
129 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
130 | );\r | |
131 | \r | |
132 | \r | |
133 | \r | |
134 | /**\r | |
135 | Duplicate a new device path data structure from the old one.\r | |
136 | \r | |
137 | @param DevicePath A pointer to a device path data structure. \r | |
138 | \r | |
139 | @return A pointer to the new allocated device path data.\r | |
140 | @return Caller must free the memory used by DevicePath if it is no longer needed.\r | |
141 | \r | |
142 | **/\r | |
143 | EFI_DEVICE_PATH_PROTOCOL *\r | |
144 | CoreDuplicateDevicePath (\r | |
145 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
146 | );\r | |
147 | \r | |
148 | \r | |
149 | /**\r | |
150 | Function is used to append a Src1 and Src2 together.\r | |
151 | \r | |
152 | @param Src1 A pointer to a device path data structure. \r | |
153 | @param Src2 A pointer to a device path data structure. \r | |
154 | \r | |
155 | @return A pointer to the new device path is returned.\r | |
156 | @return NULL is returned if space for the new device path could not be allocated from pool.\r | |
157 | @return It is up to the caller to free the memory used by Src1 and Src2 if they are no longer needed.\r | |
158 | \r | |
159 | **/\r | |
160 | EFI_DEVICE_PATH_PROTOCOL *\r | |
161 | CoreAppendDevicePath (\r | |
162 | IN EFI_DEVICE_PATH_PROTOCOL *Src1,\r | |
163 | IN EFI_DEVICE_PATH_PROTOCOL *Src2\r | |
164 | );\r | |
165 | \r | |
166 | \r | |
167 | /**\r | |
168 | Allocate pool of type EfiBootServicesData, the size is specified with AllocationSize.\r | |
169 | \r | |
170 | @param AllocationSize Size to allocate. \r | |
171 | \r | |
172 | @return Pointer of the allocated pool.\r | |
173 | \r | |
174 | **/\r | |
175 | VOID *\r | |
176 | CoreAllocateBootServicesPool (\r | |
177 | IN UINTN AllocationSize\r | |
178 | );\r | |
179 | \r | |
180 | \r | |
181 | /**\r | |
182 | Allocate pool of type EfiBootServicesData and zero it, the size is specified with AllocationSize.\r | |
183 | \r | |
184 | @param AllocationSize Size to allocate. \r | |
185 | \r | |
186 | @return Pointer of the allocated pool.\r | |
187 | \r | |
188 | **/\r | |
189 | VOID *\r | |
190 | CoreAllocateZeroBootServicesPool (\r | |
191 | IN UINTN AllocationSize\r | |
192 | );\r | |
193 | \r | |
194 | \r | |
195 | /**\r | |
196 | Find a config table by name in system table's ConfigurationTable.\r | |
197 | \r | |
198 | @param Guid The table name to look for \r | |
199 | @param Table Pointer of the config table \r | |
200 | \r | |
201 | @retval EFI_NOT_FOUND Could not find the table in system table's \r | |
202 | ConfigurationTable. \r | |
203 | @retval EFI_SUCCESS Table successfully found.\r | |
204 | \r | |
205 | **/\r | |
206 | EFI_STATUS\r | |
207 | CoreGetConfigTable (\r | |
208 | IN EFI_GUID *Guid,\r | |
209 | OUT VOID **Table\r | |
210 | );\r | |
211 | \r | |
212 | \r | |
213 | /**\r | |
214 | Allocate pool of specified size with EfiRuntimeServicesData type, and copy specified buffer to this pool.\r | |
215 | \r | |
216 | @param AllocationSize Size to allocate. \r | |
217 | @param Buffer Specified buffer that will be copy to the allocated \r | |
218 | pool \r | |
219 | \r | |
220 | @return Pointer of the allocated pool.\r | |
221 | \r | |
222 | **/\r | |
223 | VOID *\r | |
224 | CoreAllocateRuntimeCopyPool (\r | |
225 | IN UINTN AllocationSize,\r | |
226 | IN VOID *Buffer\r | |
227 | );\r | |
228 | \r | |
229 | \r | |
230 | /**\r | |
231 | Allocate pool of type EfiRuntimeServicesData, the size is specified with AllocationSize.\r | |
232 | \r | |
233 | @param AllocationSize Size to allocate. \r | |
234 | \r | |
235 | @return Pointer of the allocated pool.\r | |
236 | \r | |
237 | **/\r | |
238 | VOID *\r | |
239 | CoreAllocateRuntimePool (\r | |
240 | IN UINTN AllocationSize\r | |
241 | );\r | |
242 | \r | |
243 | \r | |
244 | /**\r | |
245 | Allocate pool of specified size with EfiBootServicesData type, and copy specified buffer to this pool.\r | |
246 | \r | |
247 | @param AllocationSize Size to allocate. \r | |
248 | @param Buffer Specified buffer that will be copy to the allocated \r | |
249 | pool \r | |
250 | \r | |
251 | @return Pointer of the allocated pool.\r | |
252 | \r | |
253 | **/\r | |
254 | VOID *\r | |
255 | CoreAllocateCopyPool (\r | |
256 | IN UINTN AllocationSize,\r | |
257 | IN VOID *Buffer\r | |
258 | );\r | |
259 | \r | |
260 | \r | |
261 | /**\r | |
262 | Create a protocol notification event and return it.\r | |
263 | \r | |
264 | @param ProtocolGuid Protocol to register notification event on. \r | |
265 | @param NotifyTpl Maximum TPL to signal the NotifyFunction. \r | |
266 | @param NotifyFunction EFI notification routine. \r | |
267 | @param NotifyContext Context passed into Event when it is created. \r | |
268 | @param Registration Registration key returned from \r | |
269 | RegisterProtocolNotify(). \r | |
270 | @param SignalFlag Boolean value to decide whether kick the event after \r | |
271 | register or not. \r | |
272 | \r | |
273 | @return The EFI_EVENT that has been registered to be signaled when a ProtocolGuid\r | |
274 | is added to the system.\r | |
275 | \r | |
276 | **/\r | |
277 | EFI_EVENT\r | |
278 | CoreCreateProtocolNotifyEvent (\r | |
279 | IN EFI_GUID *ProtocolGuid,\r | |
280 | IN EFI_TPL NotifyTpl,\r | |
281 | IN EFI_EVENT_NOTIFY NotifyFunction,\r | |
282 | IN VOID *NotifyContext,\r | |
283 | OUT VOID **Registration,\r | |
284 | IN BOOLEAN SignalFlag\r | |
285 | );\r | |
286 | \r | |
287 | #endif\r |