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