]> git.proxmox.com Git - mirror_edk2.git/blame - OldMdePkg/Include/Library/DevicePathLib.h
Moved the MdePkg to OldMdePkg so that new code in MdePkg does not break existing...
[mirror_edk2.git] / OldMdePkg / Include / Library / DevicePathLib.h
CommitLineData
878ddf1f 1/** @file\r
24e25d11 2 Entry point to a DXE Boot Services Driver\r
878ddf1f 3\r
24e25d11 4 Copyright (c) 2006, Intel Corporation \r
5 All rights reserved. This program and the accompanying materials \r
6 are licensed and made available under the terms and conditions of the BSD License \r
7 which accompanies this distribution. The full text of the license may be found at \r
8 http://opensource.org/licenses/bsd-license.php \r
878ddf1f 9\r
24e25d11 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
878ddf1f 12\r
24e25d11 13 Module Name: DevicePathLib.h\r
878ddf1f 14\r
15**/\r
16\r
17#ifndef __DEVICE_PATH_LIB_H__\r
18#define __DEVICE_PATH_LIB_H__\r
19\r
20/**\r
add13dc2 21 Returns the size of a device path in bytes.\r
878ddf1f 22\r
add13dc2 23 This function returns the size, in bytes, of the device path data structure specified by\r
24 DevicePath including the end of device path node. If DevicePath is NULL, then 0 is returned.\r
25\r
26 @param DevicePath A pointer to a device path data structure.\r
878ddf1f 27\r
24e25d11 28 @return The size of a device path in bytes.\r
878ddf1f 29\r
30**/\r
31UINTN\r
32EFIAPI\r
33GetDevicePathSize (\r
34 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
add13dc2 35 );\r
878ddf1f 36\r
37/**\r
add13dc2 38 Creates a new device path by appending a second device path to a first device path.\r
878ddf1f 39\r
add13dc2 40 This function allocates space for a new copy of the device path specified by DevicePath. If\r
41 DevicePath is NULL, then NULL is returned. If the memory is successfully allocated, then the\r
42 contents of DevicePath are copied to the newly allocated buffer, and a pointer to that buffer\r
43 is returned. Otherwise, NULL is returned. \r
44 \r
45 @param DevicePath A pointer to a device path data structure.\r
878ddf1f 46\r
add13dc2 47 @return A pointer to the duplicated device path.\r
878ddf1f 48\r
49**/\r
50EFI_DEVICE_PATH_PROTOCOL *\r
51EFIAPI\r
52DuplicateDevicePath (\r
add13dc2 53 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
54 );\r
878ddf1f 55\r
56/**\r
add13dc2 57 Creates a new device path by appending a second device path to a first device path.\r
878ddf1f 58\r
add13dc2 59 This function creates a new device path by appending a copy of SecondDevicePath to a copy of\r
60 FirstDevicePath in a newly allocated buffer. Only the end-of-device-path device node from\r
61 SecondDevicePath is retained. The newly created device path is returned. \r
62 If FirstDevicePath is NULL, then it is ignored, and a duplicate of SecondDevicePath is returned. \r
63 If SecondDevicePath is NULL, then it is ignored, and a duplicate of FirstDevicePath is returned. \r
64 If both FirstDevicePath and SecondDevicePath are NULL, then NULL is returned. \r
65 If there is not enough memory for the newly allocated buffer, then NULL is returned.\r
66 The memory for the new device path is allocated from EFI boot services memory. It is the\r
67 responsibility of the caller to free the memory allocated.\r
68\r
69 @param FirstDevicePath A pointer to a device path data structure.\r
70 @param SecondDevicePath A pointer to a device path data structure.\r
878ddf1f 71\r
add13dc2 72 @return A pointer to the new device path.\r
878ddf1f 73\r
74**/\r
75EFI_DEVICE_PATH_PROTOCOL *\r
76EFIAPI\r
77AppendDevicePath (\r
add13dc2 78 IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath, OPTIONAL\r
79 IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL\r
80 );\r
878ddf1f 81\r
82/**\r
add13dc2 83 Creates a new path by appending the device node to the device path.\r
878ddf1f 84\r
add13dc2 85 This function creates a new device path by appending a copy of the device node specified by\r
86 DevicePathNode to a copy of the device path specified by DevicePath in an allocated buffer.\r
87 The end-of-device-path device node is moved after the end of the appended device node.\r
88 If DevicePath is NULL, then NULL is returned.\r
89 If DevicePathNode is NULL, then NULL is returned.\r
90 If there is not enough memory to allocate space for the new device path, then NULL is returned. \r
91 The memory is allocated from EFI boot services memory. It is the responsibility of the caller to\r
92 free the memory allocated.\r
93\r
94 @param DevicePath A pointer to a device path data structure.\r
95 @param DevicePathNode A pointer to a single device path node.\r
878ddf1f 96\r
5f10fa01 97 @return A pointer to the new device path.\r
878ddf1f 98\r
99**/\r
100EFI_DEVICE_PATH_PROTOCOL *\r
101EFIAPI\r
102AppendDevicePathNode (\r
add13dc2 103 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL\r
104 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL\r
105 );\r
878ddf1f 106\r
107/**\r
add13dc2 108 Creates a new device path by appending the specified device path instance to the specified device\r
109 path.\r
110 \r
111 This function creates a new device path by appending a copy of the device path instance specified\r
112 by DevicePathInstance to a copy of the device path secified by DevicePath in a allocated buffer.\r
113 The end-of-device-path device node is moved after the end of the appended device path instance\r
114 and a new end-of-device-path-instance node is inserted between. \r
115 If DevicePath is NULL, then a copy if DevicePathInstance is returned.\r
116 If DevicePathInstance is NULL, then NULL is returned.\r
117 If there is not enough memory to allocate space for the new device path, then NULL is returned. \r
118 The memory is allocated from EFI boot services memory. It is the responsibility of the caller to\r
119 free the memory allocated.\r
120 \r
121 @param DevicePath A pointer to a device path data structure.\r
122 @param DevicePathInstance A pointer to a device path instance.\r
878ddf1f 123\r
add13dc2 124 @return A pointer to the new device path.\r
878ddf1f 125\r
126**/\r
127EFI_DEVICE_PATH_PROTOCOL *\r
128EFIAPI\r
129AppendDevicePathInstance (\r
add13dc2 130 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL\r
131 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL\r
132 );\r
878ddf1f 133\r
134/**\r
add13dc2 135 Creates a copy of the current device path instance and returns a pointer to the next device path\r
136 instance.\r
137\r
138 This function creates a copy of the current device path instance. It also updates DevicePath to\r
139 point to the next device path instance in the device path (or NULL if no more) and updates Size\r
140 to hold the size of the device path instance copy.\r
141 If DevicePath is NULL, then NULL is returned.\r
142 If there is not enough memory to allocate space for the new device path, then NULL is returned. \r
143 The memory is allocated from EFI boot services memory. It is the responsibility of the caller to\r
144 free the memory allocated.\r
145 If Size is NULL, then ASSERT().\r
146 \r
147 @param DevicePath On input, this holds the pointer to the current device path\r
148 instance. On output, this holds the pointer to the next device\r
149 path instance or NULL if there are no more device path\r
150 instances in the device path pointer to a device path data\r
151 structure.\r
152 @param Size On output, this holds the size of the device path instance, in\r
153 bytes or zero, if DevicePath is NULL.\r
154\r
155 @return A pointer to the current device path instance.\r
878ddf1f 156\r
add13dc2 157**/\r
158EFI_DEVICE_PATH_PROTOCOL *\r
159EFIAPI\r
160GetNextDevicePathInstance (\r
161 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,\r
162 OUT UINTN *Size\r
163 );\r
164\r
165/**\r
166 Creates a copy of the current device path instance and returns a pointer to the next device path\r
167 instance.\r
878ddf1f 168\r
add13dc2 169 This function creates a new device node in a newly allocated buffer of size NodeLength and\r
170 initializes the device path node header with NodeType and NodeSubType. The new device path node\r
171 is returned.\r
172 If NodeLength is smaller than a device path header, then NULL is returned. \r
173 If there is not enough memory to allocate space for the new device path, then NULL is returned. \r
174 The memory is allocated from EFI boot services memory. It is the responsibility of the caller to\r
175 free the memory allocated.\r
176\r
177 @param NodeType The device node type for the new device node.\r
178 @param NodeSubType The device node sub-type for the new device node.\r
179 @param NodeLength The length of the new device node.\r
180\r
181 @return The new device path.\r
878ddf1f 182\r
183**/\r
184EFI_DEVICE_PATH_PROTOCOL *\r
185EFIAPI\r
add13dc2 186CreateDeviceNode (\r
187 IN UINT8 NodeType,\r
188 IN UINT8 NodeSubType,\r
189 IN UINT16 NodeLength\r
190 );\r
878ddf1f 191\r
192/**\r
add13dc2 193 Determines if a device path is single or multi-instance.\r
878ddf1f 194\r
add13dc2 195 This function returns TRUE if the device path specified by DevicePath is multi-instance.\r
196 Otherwise, FALSE is returned. If DevicePath is NULL, then FALSE is returned.\r
878ddf1f 197\r
add13dc2 198 @param DevicePath A pointer to a device path data structure.\r
199\r
200 @retval TRUE DevicePath is multi-instance.\r
201 @retval FALSE DevicePath is not multi-instance or DevicePath is NULL.\r
878ddf1f 202\r
203**/\r
204BOOLEAN\r
205EFIAPI\r
206IsDevicePathMultiInstance (\r
207 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
add13dc2 208 );\r
878ddf1f 209\r
210/**\r
add13dc2 211 Retrieves the device path protocol from a handle.\r
878ddf1f 212\r
add13dc2 213 This function returns the device path protocol from the handle specified by Handle. If Handle is\r
214 NULL or Handle does not contain a device path protocol, then NULL is returned.\r
215 \r
216 @param Handle The handle from which to retrieve the device path protocol.\r
878ddf1f 217\r
add13dc2 218 @return The device path protocol from the handle specified by Handle.\r
878ddf1f 219\r
220**/\r
221EFI_DEVICE_PATH_PROTOCOL *\r
222EFIAPI\r
223DevicePathFromHandle (\r
add13dc2 224 IN EFI_HANDLE Handle\r
225 );\r
878ddf1f 226\r
227/**\r
add13dc2 228 Allocates a device path for a file and appends it to an existing device path.\r
229\r
230 If Device is a valid device handle that contains a device path protocol, then a device path for\r
231 the file specified by FileName is allocated and appended to the device path associated with the\r
232 handle Device. The allocated device path is returned. If Device is NULL or Device is a handle\r
233 that does not support the device path protocol, then a device path containing a single device\r
234 path node for the file specified by FileName is allocated and returned.\r
235 If FileName is NULL, then ASSERT().\r
24e25d11 236\r
add13dc2 237 @param Device A pointer to a device handle. This parameter is optional and\r
238 may be NULL.\r
239 @param FileName A pointer to a Null-terminated Unicode string.\r
24e25d11 240\r
add13dc2 241 @return The allocated device path.\r
878ddf1f 242\r
243**/\r
244EFI_DEVICE_PATH_PROTOCOL *\r
245EFIAPI\r
246FileDevicePath (\r
add13dc2 247 IN EFI_HANDLE Device, OPTIONAL\r
248 IN CONST CHAR16 *FileName\r
249 );\r
878ddf1f 250\r
251#endif\r