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