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