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