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