]>
Commit | Line | Data |
---|---|---|
fb3df220 | 1 | /** @file\r |
50a64e5b | 2 | Provides library functions to construct and parse UEFI Device Paths.\r |
fb3df220 | 3 | \r |
d80b2f71 | 4 | This library provides defines, macros, and functions to help create and parse \r |
bcdff90d | 5 | EFI_DEVICE_PATH_PROTOCOL structures.\r |
d80b2f71 | 6 | \r |
4d0a30a4 | 7 | Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r |
af2dc6a7 | 8 | This program and the accompanying materials are licensed and made available under \r |
9 | the terms and conditions of the BSD License that accompanies this distribution. \r | |
10 | The full text of the license may be found at\r | |
11 | http://opensource.org/licenses/bsd-license.php.\r | |
fb3df220 | 12 | \r |
50a64e5b | 13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
14 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
fb3df220 | 15 | \r |
fb3df220 | 16 | **/\r |
17 | \r | |
18 | #ifndef __DEVICE_PATH_LIB_H__\r | |
19 | #define __DEVICE_PATH_LIB_H__\r | |
20 | \r | |
e5dab016 | 21 | #define END_DEVICE_PATH_LENGTH (sizeof (EFI_DEVICE_PATH_PROTOCOL))\r |
d80b2f71 | 22 | \r |
771729c7 RN |
23 | /**\r |
24 | Determine whether a given device path is valid.\r | |
25 | If DevicePath is NULL, then ASSERT().\r | |
26 | \r | |
27 | @param DevicePath A pointer to a device path data structure.\r | |
28 | @param MaxSize The maximum size of the device path data structure.\r | |
29 | \r | |
30 | @retval TRUE DevicePath is valid.\r | |
31 | @retval FALSE The length of any node node in the DevicePath is less\r | |
32 | than sizeof (EFI_DEVICE_PATH_PROTOCOL).\r | |
33 | @retval FALSE If MaxSize is not zero, the size of the DevicePath\r | |
34 | exceeds MaxSize.\r | |
35 | @retval FALSE If PcdMaximumDevicePathNodeCount is not zero, the node\r | |
36 | count of the DevicePath exceeds PcdMaximumDevicePathNodeCount.\r | |
37 | **/\r | |
38 | BOOLEAN\r | |
39 | EFIAPI\r | |
40 | IsDevicePathValid (\r | |
41 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r | |
42 | IN UINTN MaxSize\r | |
43 | );\r | |
44 | \r | |
d80b2f71 | 45 | /**\r |
3dc728fb | 46 | Returns the Type field of a device path node.\r |
d80b2f71 | 47 | \r |
48 | Returns the Type field of the device path node specified by Node.\r | |
49 | \r | |
3dc728fb | 50 | If Node is NULL, then ASSERT().\r |
51 | \r | |
d80b2f71 | 52 | @param Node A pointer to a device path node data structure.\r |
53 | \r | |
54 | @return The Type field of the device path node specified by Node.\r | |
55 | \r | |
56 | **/\r | |
3dc728fb | 57 | UINT8\r |
5cba121d | 58 | EFIAPI\r |
3dc728fb | 59 | DevicePathType (\r |
60 | IN CONST VOID *Node\r | |
61 | );\r | |
d80b2f71 | 62 | \r |
63 | /**\r | |
3dc728fb | 64 | Returns the SubType field of a device path node.\r |
d80b2f71 | 65 | \r |
66 | Returns the SubType field of the device path node specified by Node.\r | |
67 | \r | |
3dc728fb | 68 | If Node is NULL, then ASSERT().\r |
69 | \r | |
d80b2f71 | 70 | @param Node A pointer to a device path node data structure.\r |
71 | \r | |
72 | @return The SubType field of the device path node specified by Node.\r | |
73 | \r | |
74 | **/\r | |
3dc728fb | 75 | UINT8\r |
5cba121d | 76 | EFIAPI\r |
3dc728fb | 77 | DevicePathSubType (\r |
78 | IN CONST VOID *Node\r | |
79 | );\r | |
d80b2f71 | 80 | \r |
81 | /**\r | |
3dc728fb | 82 | Returns the 16-bit Length field of a device path node.\r |
d80b2f71 | 83 | \r |
3dc728fb | 84 | Returns the 16-bit Length field of the device path node specified by Node. \r |
85 | Node is not required to be aligned on a 16-bit boundary, so it is recommended\r | |
86 | that a function such as ReadUnaligned16() be used to extract the contents of \r | |
87 | the Length field.\r | |
88 | \r | |
89 | If Node is NULL, then ASSERT().\r | |
d80b2f71 | 90 | \r |
91 | @param Node A pointer to a device path node data structure.\r | |
92 | \r | |
93 | @return The 16-bit Length field of the device path node specified by Node.\r | |
94 | \r | |
95 | **/\r | |
3dc728fb | 96 | UINTN\r |
5cba121d | 97 | EFIAPI\r |
3dc728fb | 98 | DevicePathNodeLength (\r |
99 | IN CONST VOID *Node\r | |
100 | );\r | |
d80b2f71 | 101 | \r |
102 | /**\r | |
3dc728fb | 103 | Returns a pointer to the next node in a device path.\r |
d80b2f71 | 104 | \r |
105 | Returns a pointer to the device path node that follows the device path node specified by Node.\r | |
106 | \r | |
3dc728fb | 107 | If Node is NULL, then ASSERT().\r |
108 | \r | |
d80b2f71 | 109 | @param Node A pointer to a device path node data structure.\r |
110 | \r | |
111 | @return a pointer to the device path node that follows the device path node specified by Node.\r | |
112 | \r | |
113 | **/\r | |
3dc728fb | 114 | EFI_DEVICE_PATH_PROTOCOL *\r |
5cba121d | 115 | EFIAPI\r |
3dc728fb | 116 | NextDevicePathNode (\r |
117 | IN CONST VOID *Node\r | |
118 | );\r | |
d80b2f71 | 119 | \r |
120 | /**\r | |
3dc728fb | 121 | Determines if a device path node is an end node of a device path.\r |
af2dc6a7 | 122 | This includes nodes that are the end of a device path instance and nodes that \r |
123 | are the end of an entire device path.\r | |
d80b2f71 | 124 | \r |
125 | Determines if the device path node specified by Node is an end node of a device path. \r | |
126 | This includes nodes that are the end of a device path instance and nodes that are the \r | |
127 | end of an entire device path. If Node represents an end node of a device path, \r | |
128 | then TRUE is returned. Otherwise, FALSE is returned.\r | |
129 | \r | |
3dc728fb | 130 | If Node is NULL, then ASSERT().\r |
131 | \r | |
d80b2f71 | 132 | @param Node A pointer to a device path node data structure.\r |
133 | \r | |
134 | @retval TRUE The device path node specified by Node is an end node of a device path.\r | |
135 | @retval FALSE The device path node specified by Node is not an end node of a device path.\r | |
136 | \r | |
137 | **/\r | |
3dc728fb | 138 | BOOLEAN\r |
5cba121d | 139 | EFIAPI\r |
3dc728fb | 140 | IsDevicePathEndType (\r |
141 | IN CONST VOID *Node\r | |
142 | );\r | |
d80b2f71 | 143 | \r |
144 | /**\r | |
3dc728fb | 145 | Determines if a device path node is an end node of an entire device path.\r |
d80b2f71 | 146 | \r |
147 | Determines if a device path node specified by Node is an end node of an entire device path.\r | |
771729c7 RN |
148 | If Node represents the end of an entire device path, then TRUE is returned.\r |
149 | Otherwise, FALSE is returned.\r | |
d80b2f71 | 150 | \r |
3dc728fb | 151 | If Node is NULL, then ASSERT().\r |
152 | \r | |
d80b2f71 | 153 | @param Node A pointer to a device path node data structure.\r |
154 | \r | |
155 | @retval TRUE The device path node specified by Node is the end of an entire device path.\r | |
156 | @retval FALSE The device path node specified by Node is not the end of an entire device path.\r | |
157 | \r | |
158 | **/\r | |
3dc728fb | 159 | BOOLEAN\r |
5cba121d | 160 | EFIAPI\r |
3dc728fb | 161 | IsDevicePathEnd (\r |
162 | IN CONST VOID *Node\r | |
163 | );\r | |
d80b2f71 | 164 | \r |
165 | /**\r | |
3dc728fb | 166 | Determines if a device path node is an end node of a device path instance.\r |
d80b2f71 | 167 | \r |
168 | Determines if a device path node specified by Node is an end node of a device path instance.\r | |
771729c7 RN |
169 | If Node represents the end of a device path instance, then TRUE is returned.\r |
170 | Otherwise, FALSE is returned.\r | |
d80b2f71 | 171 | \r |
3dc728fb | 172 | If Node is NULL, then ASSERT().\r |
173 | \r | |
d80b2f71 | 174 | @param Node A pointer to a device path node data structure.\r |
175 | \r | |
176 | @retval TRUE The device path node specified by Node is the end of a device path instance.\r | |
177 | @retval FALSE The device path node specified by Node is not the end of a device path instance.\r | |
178 | \r | |
179 | **/\r | |
3dc728fb | 180 | BOOLEAN\r |
5cba121d | 181 | EFIAPI\r |
3dc728fb | 182 | IsDevicePathEndInstance (\r |
183 | IN CONST VOID *Node\r | |
184 | );\r | |
e5dab016 | 185 | \r |
d80b2f71 | 186 | /**\r |
3dc728fb | 187 | Sets the length, in bytes, of a device path node.\r |
188 | \r | |
189 | Sets the length of the device path node specified by Node to the value specified \r | |
190 | by NodeLength. NodeLength is returned. Node is not required to be aligned on \r | |
191 | a 16-bit boundary, so it is recommended that a function such as WriteUnaligned16()\r | |
192 | be used to set the contents of the Length field.\r | |
d80b2f71 | 193 | \r |
3dc728fb | 194 | If Node is NULL, then ASSERT().\r |
195 | If NodeLength >= 0x10000, then ASSERT().\r | |
771729c7 | 196 | If NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL), then ASSERT().\r |
d80b2f71 | 197 | \r |
198 | @param Node A pointer to a device path node data structure.\r | |
199 | @param Length The length, in bytes, of the device path node.\r | |
200 | \r | |
201 | @return Length\r | |
202 | \r | |
203 | **/\r | |
3dc728fb | 204 | UINT16\r |
5cba121d | 205 | EFIAPI\r |
3dc728fb | 206 | SetDevicePathNodeLength (\r |
9bb407c6 | 207 | IN OUT VOID *Node,\r |
208 | IN UINTN Length\r | |
3dc728fb | 209 | );\r |
d80b2f71 | 210 | \r |
211 | /**\r | |
3dc728fb | 212 | Fills in all the fields of a device path node that is the end of an entire device path.\r |
d80b2f71 | 213 | \r |
3dc728fb | 214 | Fills in all the fields of a device path node specified by Node so Node represents \r |
215 | the end of an entire device path. The Type field of Node is set to \r | |
216 | END_DEVICE_PATH_TYPE, the SubType field of Node is set to \r | |
217 | END_ENTIRE_DEVICE_PATH_SUBTYPE, and the Length field of Node is set to \r | |
218 | END_DEVICE_PATH_LENGTH. Node is not required to be aligned on a 16-bit boundary, \r | |
219 | so it is recommended that a function such as WriteUnaligned16() be used to set \r | |
220 | the contents of the Length field. \r | |
221 | \r | |
222 | If Node is NULL, then ASSERT(). \r | |
d80b2f71 | 223 | \r |
224 | @param Node A pointer to a device path node data structure.\r | |
225 | \r | |
226 | **/\r | |
3dc728fb | 227 | VOID\r |
5cba121d | 228 | EFIAPI\r |
3dc728fb | 229 | SetDevicePathEndNode (\r |
9bb407c6 | 230 | OUT VOID *Node\r |
3dc728fb | 231 | );\r |
e5dab016 | 232 | \r |
fb3df220 | 233 | /**\r |
234 | Returns the size of a device path in bytes.\r | |
235 | \r | |
771729c7 RN |
236 | This function returns the size, in bytes, of the device path data structure \r |
237 | specified by DevicePath including the end of device path node.\r | |
238 | If DevicePath is NULL or invalid, then 0 is returned.\r | |
fb3df220 | 239 | \r |
771729c7 RN |
240 | @param DevicePath A pointer to a device path data structure.\r |
241 | \r | |
242 | @retval 0 If DevicePath is NULL or invalid.\r | |
243 | @retval Others The size of a device path in bytes.\r | |
fb3df220 | 244 | \r |
245 | **/\r | |
246 | UINTN\r | |
247 | EFIAPI\r | |
248 | GetDevicePathSize (\r | |
249 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
250 | );\r | |
251 | \r | |
252 | /**\r | |
bc7e6003 | 253 | Creates a new copy of an existing device path.\r |
fb3df220 | 254 | \r |
255 | This function allocates space for a new copy of the device path specified by DevicePath. If\r | |
256 | DevicePath is NULL, then NULL is returned. If the memory is successfully allocated, then the\r | |
257 | contents of DevicePath are copied to the newly allocated buffer, and a pointer to that buffer\r | |
258 | is returned. Otherwise, NULL is returned. \r | |
d80b2f71 | 259 | The memory for the new device path is allocated from EFI boot services memory. \r |
260 | It is the responsibility of the caller to free the memory allocated. \r | |
fb3df220 | 261 | \r |
262 | @param DevicePath A pointer to a device path data structure.\r | |
263 | \r | |
771729c7 | 264 | @retval NULL DevicePath is NULL or invalid.\r |
d80b2f71 | 265 | @retval Others A pointer to the duplicated device path.\r |
266 | \r | |
fb3df220 | 267 | **/\r |
268 | EFI_DEVICE_PATH_PROTOCOL *\r | |
269 | EFIAPI\r | |
270 | DuplicateDevicePath (\r | |
271 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
272 | );\r | |
273 | \r | |
274 | /**\r | |
275 | Creates a new device path by appending a second device path to a first device path.\r | |
276 | \r | |
277 | This function creates a new device path by appending a copy of SecondDevicePath to a copy of\r | |
278 | FirstDevicePath in a newly allocated buffer. Only the end-of-device-path device node from\r | |
279 | SecondDevicePath is retained. The newly created device path is returned. \r | |
280 | If FirstDevicePath is NULL, then it is ignored, and a duplicate of SecondDevicePath is returned. \r | |
281 | If SecondDevicePath is NULL, then it is ignored, and a duplicate of FirstDevicePath is returned. \r | |
98a14db6 | 282 | If both FirstDevicePath and SecondDevicePath are NULL, then a copy of an end-of-device-path is\r |
283 | returned. \r | |
fb3df220 | 284 | If there is not enough memory for the newly allocated buffer, then NULL is returned.\r |
285 | The memory for the new device path is allocated from EFI boot services memory. It is the\r | |
286 | responsibility of the caller to free the memory allocated.\r | |
287 | \r | |
288 | @param FirstDevicePath A pointer to a device path data structure.\r | |
289 | @param SecondDevicePath A pointer to a device path data structure.\r | |
d80b2f71 | 290 | \r |
291 | @retval NULL If there is not enough memory for the newly allocated buffer.\r | |
771729c7 | 292 | @retval NULL If FirstDevicePath or SecondDevicePath is invalid.\r |
d80b2f71 | 293 | @retval Others A pointer to the new device path if success.\r |
294 | Or a copy an end-of-device-path if both FirstDevicePath and SecondDevicePath are NULL.\r | |
fb3df220 | 295 | \r |
296 | **/\r | |
297 | EFI_DEVICE_PATH_PROTOCOL *\r | |
298 | EFIAPI\r | |
299 | AppendDevicePath (\r | |
300 | IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath, OPTIONAL\r | |
301 | IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL\r | |
302 | );\r | |
303 | \r | |
304 | /**\r | |
305 | Creates a new path by appending the device node to the device path.\r | |
306 | \r | |
307 | This function creates a new device path by appending a copy of the device node specified by\r | |
308 | DevicePathNode to a copy of the device path specified by DevicePath in an allocated buffer.\r | |
309 | The end-of-device-path device node is moved after the end of the appended device node.\r | |
98a14db6 | 310 | If DevicePathNode is NULL then a copy of DevicePath is returned.\r |
6336a895 | 311 | If DevicePath is NULL then a copy of DevicePathNode, followed by an end-of-device path device\r |
312 | node is returned.\r | |
98a14db6 | 313 | If both DevicePathNode and DevicePath are NULL then a copy of an end-of-device-path device node\r |
314 | is returned.\r | |
fb3df220 | 315 | If there is not enough memory to allocate space for the new device path, then NULL is returned. \r |
316 | The memory is allocated from EFI boot services memory. It is the responsibility of the caller to\r | |
317 | free the memory allocated.\r | |
318 | \r | |
319 | @param DevicePath A pointer to a device path data structure.\r | |
320 | @param DevicePathNode A pointer to a single device path node.\r | |
321 | \r | |
af2dc6a7 | 322 | @retval NULL There is not enough memory for the new device path.\r |
d80b2f71 | 323 | @retval Others A pointer to the new device path if success.\r |
324 | A copy of DevicePathNode followed by an end-of-device-path node \r | |
325 | if both FirstDevicePath and SecondDevicePath are NULL.\r | |
326 | A copy of an end-of-device-path node if both FirstDevicePath and SecondDevicePath are NULL.\r | |
fb3df220 | 327 | \r |
328 | **/\r | |
329 | EFI_DEVICE_PATH_PROTOCOL *\r | |
330 | EFIAPI\r | |
331 | AppendDevicePathNode (\r | |
332 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL\r | |
333 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL\r | |
334 | );\r | |
335 | \r | |
336 | /**\r | |
337 | Creates a new device path by appending the specified device path instance to the specified device\r | |
338 | path.\r | |
339 | \r | |
340 | This function creates a new device path by appending a copy of the device path instance specified\r | |
341 | by DevicePathInstance to a copy of the device path secified by DevicePath in a allocated buffer.\r | |
342 | The end-of-device-path device node is moved after the end of the appended device path instance\r | |
343 | and a new end-of-device-path-instance node is inserted between. \r | |
344 | If DevicePath is NULL, then a copy if DevicePathInstance is returned.\r | |
345 | If DevicePathInstance is NULL, then NULL is returned.\r | |
771729c7 | 346 | If DevicePath or DevicePathInstance is invalid, then NULL is returned.\r |
fb3df220 | 347 | If there is not enough memory to allocate space for the new device path, then NULL is returned. \r |
348 | The memory is allocated from EFI boot services memory. It is the responsibility of the caller to\r | |
349 | free the memory allocated.\r | |
350 | \r | |
351 | @param DevicePath A pointer to a device path data structure.\r | |
352 | @param DevicePathInstance A pointer to a device path instance.\r | |
353 | \r | |
354 | @return A pointer to the new device path.\r | |
355 | \r | |
356 | **/\r | |
357 | EFI_DEVICE_PATH_PROTOCOL *\r | |
358 | EFIAPI\r | |
359 | AppendDevicePathInstance (\r | |
360 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL\r | |
361 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL\r | |
362 | );\r | |
363 | \r | |
364 | /**\r | |
365 | Creates a copy of the current device path instance and returns a pointer to the next device path\r | |
366 | instance.\r | |
367 | \r | |
368 | This function creates a copy of the current device path instance. It also updates DevicePath to\r | |
369 | point to the next device path instance in the device path (or NULL if no more) and updates Size\r | |
370 | to hold the size of the device path instance copy.\r | |
371 | If DevicePath is NULL, then NULL is returned.\r | |
771729c7 | 372 | If DevicePath points to a invalid device path, then NULL is returned.\r |
fb3df220 | 373 | If there is not enough memory to allocate space for the new device path, then NULL is returned. \r |
374 | The memory is allocated from EFI boot services memory. It is the responsibility of the caller to\r | |
375 | free the memory allocated.\r | |
376 | If Size is NULL, then ASSERT().\r | |
377 | \r | |
378 | @param DevicePath On input, this holds the pointer to the current device path\r | |
379 | instance. On output, this holds the pointer to the next device\r | |
380 | path instance or NULL if there are no more device path\r | |
381 | instances in the device path pointer to a device path data\r | |
382 | structure.\r | |
383 | @param Size On output, this holds the size of the device path instance, in\r | |
384 | bytes or zero, if DevicePath is NULL.\r | |
385 | \r | |
386 | @return A pointer to the current device path instance.\r | |
387 | \r | |
388 | **/\r | |
389 | EFI_DEVICE_PATH_PROTOCOL *\r | |
390 | EFIAPI\r | |
391 | GetNextDevicePathInstance (\r | |
392 | IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,\r | |
393 | OUT UINTN *Size\r | |
394 | );\r | |
395 | \r | |
396 | /**\r | |
d80b2f71 | 397 | Creates a device node.\r |
fb3df220 | 398 | \r |
399 | This function creates a new device node in a newly allocated buffer of size NodeLength and\r | |
400 | initializes the device path node header with NodeType and NodeSubType. The new device path node\r | |
401 | is returned.\r | |
402 | If NodeLength is smaller than a device path header, then NULL is returned. \r | |
403 | If there is not enough memory to allocate space for the new device path, then NULL is returned. \r | |
404 | The memory is allocated from EFI boot services memory. It is the responsibility of the caller to\r | |
405 | free the memory allocated.\r | |
406 | \r | |
407 | @param NodeType The device node type for the new device node.\r | |
408 | @param NodeSubType The device node sub-type for the new device node.\r | |
409 | @param NodeLength The length of the new device node.\r | |
410 | \r | |
411 | @return The new device path.\r | |
412 | \r | |
413 | **/\r | |
414 | EFI_DEVICE_PATH_PROTOCOL *\r | |
415 | EFIAPI\r | |
416 | CreateDeviceNode (\r | |
417 | IN UINT8 NodeType,\r | |
418 | IN UINT8 NodeSubType,\r | |
419 | IN UINT16 NodeLength\r | |
420 | );\r | |
421 | \r | |
422 | /**\r | |
423 | Determines if a device path is single or multi-instance.\r | |
424 | \r | |
425 | This function returns TRUE if the device path specified by DevicePath is multi-instance.\r | |
771729c7 RN |
426 | Otherwise, FALSE is returned.\r |
427 | If DevicePath is NULL or invalid, then FALSE is returned.\r | |
fb3df220 | 428 | \r |
429 | @param DevicePath A pointer to a device path data structure.\r | |
430 | \r | |
431 | @retval TRUE DevicePath is multi-instance.\r | |
771729c7 | 432 | @retval FALSE DevicePath is not multi-instance, or DevicePath is NULL or invalid.\r |
fb3df220 | 433 | \r |
434 | **/\r | |
435 | BOOLEAN\r | |
436 | EFIAPI\r | |
437 | IsDevicePathMultiInstance (\r | |
438 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
439 | );\r | |
440 | \r | |
441 | /**\r | |
442 | Retrieves the device path protocol from a handle.\r | |
443 | \r | |
444 | This function returns the device path protocol from the handle specified by Handle. If Handle is\r | |
445 | NULL or Handle does not contain a device path protocol, then NULL is returned.\r | |
446 | \r | |
447 | @param Handle The handle from which to retrieve the device path protocol.\r | |
448 | \r | |
449 | @return The device path protocol from the handle specified by Handle.\r | |
450 | \r | |
451 | **/\r | |
452 | EFI_DEVICE_PATH_PROTOCOL *\r | |
453 | EFIAPI\r | |
454 | DevicePathFromHandle (\r | |
455 | IN EFI_HANDLE Handle\r | |
456 | );\r | |
457 | \r | |
458 | /**\r | |
459 | Allocates a device path for a file and appends it to an existing device path.\r | |
460 | \r | |
461 | If Device is a valid device handle that contains a device path protocol, then a device path for\r | |
462 | the file specified by FileName is allocated and appended to the device path associated with the\r | |
463 | handle Device. The allocated device path is returned. If Device is NULL or Device is a handle\r | |
464 | that does not support the device path protocol, then a device path containing a single device\r | |
465 | path node for the file specified by FileName is allocated and returned.\r | |
d80b2f71 | 466 | The memory for the new device path is allocated from EFI boot services memory. It is the responsibility\r |
467 | of the caller to free the memory allocated.\r | |
468 | \r | |
fb3df220 | 469 | If FileName is NULL, then ASSERT().\r |
d80b2f71 | 470 | If FileName is not aligned on a 16-bit boundary, then ASSERT().\r |
fb3df220 | 471 | \r |
472 | @param Device A pointer to a device handle. This parameter is optional and\r | |
473 | may be NULL.\r | |
474 | @param FileName A pointer to a Null-terminated Unicode string.\r | |
475 | \r | |
476 | @return The allocated device path.\r | |
477 | \r | |
478 | **/\r | |
479 | EFI_DEVICE_PATH_PROTOCOL *\r | |
480 | EFIAPI\r | |
481 | FileDevicePath (\r | |
482 | IN EFI_HANDLE Device, OPTIONAL\r | |
483 | IN CONST CHAR16 *FileName\r | |
484 | );\r | |
485 | \r | |
4d0a30a4 RN |
486 | /**\r |
487 | Converts a device path to its text representation.\r | |
488 | \r | |
489 | @param DevicePath A Pointer to the device to be converted.\r | |
490 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
491 | of the display node is used, where applicable. If DisplayOnly\r | |
492 | is FALSE, then the longer text representation of the display node\r | |
493 | is used.\r | |
494 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
495 | representation for a device node can be used, where applicable.\r | |
496 | \r | |
497 | @return A pointer to the allocated text representation of the device path or\r | |
498 | NULL if DeviceNode is NULL or there was insufficient memory.\r | |
499 | \r | |
500 | **/\r | |
501 | CHAR16 *\r | |
502 | EFIAPI\r | |
503 | ConvertDevicePathToText (\r | |
504 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r | |
505 | IN BOOLEAN DisplayOnly,\r | |
506 | IN BOOLEAN AllowShortcuts\r | |
507 | );\r | |
508 | \r | |
509 | /**\r | |
510 | Converts a device node to its string representation.\r | |
511 | \r | |
512 | @param DeviceNode A Pointer to the device node to be converted.\r | |
513 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation\r | |
514 | of the display node is used, where applicable. If DisplayOnly\r | |
515 | is FALSE, then the longer text representation of the display node\r | |
516 | is used.\r | |
517 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
518 | representation for a device node can be used, where applicable.\r | |
519 | \r | |
520 | @return A pointer to the allocated text representation of the device node or NULL if DeviceNode\r | |
521 | is NULL or there was insufficient memory.\r | |
522 | \r | |
523 | **/\r | |
524 | CHAR16 *\r | |
525 | EFIAPI\r | |
526 | ConvertDeviceNodeToText (\r | |
527 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode,\r | |
528 | IN BOOLEAN DisplayOnly,\r | |
529 | IN BOOLEAN AllowShortcuts\r | |
530 | );\r | |
531 | \r | |
532 | /**\r | |
533 | Convert text to the binary representation of a device node.\r | |
534 | \r | |
535 | @param TextDeviceNode TextDeviceNode points to the text representation of a device\r | |
536 | node. Conversion starts with the first character and continues\r | |
537 | until the first non-device node character.\r | |
538 | \r | |
539 | @return A pointer to the EFI device node or NULL if TextDeviceNode is NULL or there was\r | |
540 | insufficient memory or text unsupported.\r | |
541 | \r | |
542 | **/\r | |
543 | EFI_DEVICE_PATH_PROTOCOL *\r | |
544 | EFIAPI\r | |
545 | ConvertTextToDeviceNode (\r | |
546 | IN CONST CHAR16 *TextDeviceNode\r | |
547 | );\r | |
548 | \r | |
549 | /**\r | |
550 | Convert text to the binary representation of a device path.\r | |
551 | \r | |
552 | @param TextDevicePath TextDevicePath points to the text representation of a device\r | |
553 | path. Conversion starts with the first character and continues\r | |
554 | until the first non-device node character.\r | |
555 | \r | |
556 | @return A pointer to the allocated device path or NULL if TextDeviceNode is NULL or\r | |
557 | there was insufficient memory.\r | |
558 | \r | |
559 | **/\r | |
560 | EFI_DEVICE_PATH_PROTOCOL *\r | |
561 | EFIAPI\r | |
562 | ConvertTextToDevicePath (\r | |
563 | IN CONST CHAR16 *TextDevicePath\r | |
564 | );\r | |
565 | \r | |
fb3df220 | 566 | #endif\r |