]>
Commit | Line | Data |
---|---|---|
7dbc50bd YZ |
1 | /** @file\r |
2 | EFI_DEVICE_PATH_UTILITIES_PROTOCOL as defined in UEFI 2.0.\r | |
3 | Use to create and manipulate device paths and device nodes.\r | |
4 | \r | |
5 | Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r | |
6 | This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef __DEVICE_PATH_UTILITIES_H__\r | |
17 | #define __DEVICE_PATH_UTILITIES_H__\r | |
18 | \r | |
19 | ///\r | |
20 | /// Device Path Utilities protocol\r | |
21 | ///\r | |
22 | #define EFI_DEVICE_PATH_UTILITIES_GUID \\r | |
23 | { \\r | |
24 | 0x379be4e, 0xd706, 0x437d, {0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4 } \\r | |
25 | }\r | |
26 | \r | |
27 | /**\r | |
28 | Returns the size of the device path, in bytes.\r | |
29 | \r | |
30 | @param DevicePath Points to the start of the EFI device path.\r | |
31 | \r | |
32 | @return Size Size of the specified device path, in bytes, including the end-of-path tag.\r | |
33 | @retval 0 DevicePath is NULL\r | |
34 | \r | |
35 | **/\r | |
36 | typedef\r | |
37 | UINTN\r | |
38 | ( *EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE)(\r | |
39 | CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
40 | );\r | |
41 | \r | |
42 | \r | |
43 | /**\r | |
44 | Create a duplicate of the specified path.\r | |
45 | \r | |
46 | @param DevicePath Points to the source EFI device path.\r | |
47 | \r | |
48 | @retval Pointer A pointer to the duplicate device path.\r | |
49 | @retval NULL insufficient memory or DevicePath is NULL\r | |
50 | \r | |
51 | **/\r | |
52 | typedef\r | |
53 | EFI_DEVICE_PATH_PROTOCOL*\r | |
54 | ( *EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH)(\r | |
55 | CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
56 | );\r | |
57 | \r | |
58 | /**\r | |
59 | Create a new path by appending the second device path to the first.\r | |
60 | If Src1 is NULL and Src2 is non-NULL, then a duplicate of Src2 is returned.\r | |
61 | If Src1 is non-NULL and Src2 is NULL, then a duplicate of Src1 is returned.\r | |
62 | If Src1 and Src2 are both NULL, then a copy of an end-of-device-path is returned.\r | |
63 | \r | |
64 | @param Src1 Points to the first device path.\r | |
65 | @param Src2 Points to the second device path.\r | |
66 | \r | |
67 | @retval Pointer A pointer to the newly created device path.\r | |
68 | @retval NULL Memory could not be allocated\r | |
69 | \r | |
70 | **/\r | |
71 | typedef\r | |
72 | EFI_DEVICE_PATH_PROTOCOL*\r | |
73 | ( *EFI_DEVICE_PATH_UTILS_APPEND_PATH)(\r | |
74 | CONST EFI_DEVICE_PATH_PROTOCOL *Src1,\r | |
75 | CONST EFI_DEVICE_PATH_PROTOCOL *Src2\r | |
76 | );\r | |
77 | \r | |
78 | /**\r | |
79 | Creates a new path by appending the device node to the device path.\r | |
80 | If DeviceNode is NULL then a copy of DevicePath is returned.\r | |
81 | If DevicePath is NULL then a copy of DeviceNode, followed by an end-of-device path device node is returned.\r | |
82 | If both DeviceNode and DevicePath are NULL then a copy of an end-of-device-path device node is returned.\r | |
83 | \r | |
84 | @param DevicePath Points to the device path.\r | |
85 | @param DeviceNode Points to the device node.\r | |
86 | \r | |
87 | @retval Pointer A pointer to the allocated device node.\r | |
88 | @retval NULL There was insufficient memory.\r | |
89 | \r | |
90 | **/\r | |
91 | typedef\r | |
92 | EFI_DEVICE_PATH_PROTOCOL*\r | |
93 | ( *EFI_DEVICE_PATH_UTILS_APPEND_NODE)(\r | |
94 | CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r | |
95 | CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode\r | |
96 | );\r | |
97 | \r | |
98 | /**\r | |
99 | Creates a new path by appending the specified device path instance to the specified device path.\r | |
100 | \r | |
101 | @param DevicePath Points to the device path. If NULL, then ignored.\r | |
102 | @param DevicePathInstance Points to the device path instance.\r | |
103 | \r | |
104 | @retval Pointer A pointer to the newly created device path\r | |
105 | @retval NULL Memory could not be allocated or DevicePathInstance is NULL.\r | |
106 | \r | |
107 | **/\r | |
108 | typedef\r | |
109 | EFI_DEVICE_PATH_PROTOCOL*\r | |
110 | ( *EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE)(\r | |
111 | CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r | |
112 | CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance\r | |
113 | );\r | |
114 | \r | |
115 | /**\r | |
116 | Creates a copy of the current device path instance and returns a pointer to the next device path\r | |
117 | instance.\r | |
118 | \r | |
119 | @param DevicePathInstance On input, this holds the pointer to the current device path\r | |
120 | instance. On output, this holds the pointer to the next\r | |
121 | device path instance or NULL if there are no more device\r | |
122 | path instances in the device path.\r | |
123 | @param DevicePathInstanceSize On output, this holds the size of the device path instance,\r | |
124 | in bytes or zero, if DevicePathInstance is NULL.\r | |
125 | If NULL, then the instance size is not output.\r | |
126 | \r | |
127 | @retval Pointer A pointer to the copy of the current device path instance.\r | |
fb0b35e0 | 128 | @retval NULL DevicePathInstance was NULL on entry or there was insufficient memory.\r |
7dbc50bd YZ |
129 | \r |
130 | **/\r | |
131 | typedef\r | |
132 | EFI_DEVICE_PATH_PROTOCOL*\r | |
133 | ( *EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE)(\r | |
134 | EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,\r | |
135 | UINTN *DevicePathInstanceSize\r | |
136 | );\r | |
137 | \r | |
138 | /**\r | |
139 | Creates a device node\r | |
140 | \r | |
141 | @param NodeType NodeType is the device node type (EFI_DEVICE_PATH.Type) for\r | |
142 | the new device node.\r | |
143 | @param NodeSubType NodeSubType is the device node sub-type\r | |
144 | EFI_DEVICE_PATH.SubType) for the new device node.\r | |
145 | @param NodeLength NodeLength is the length of the device node\r | |
146 | (EFI_DEVICE_PATH.Length) for the new device node.\r | |
147 | \r | |
148 | @retval Pointer A pointer to the newly created device node.\r | |
149 | @retval NULL NodeLength is less than\r | |
150 | the size of the header or there was insufficient memory.\r | |
151 | \r | |
152 | **/\r | |
153 | typedef\r | |
154 | EFI_DEVICE_PATH_PROTOCOL*\r | |
155 | ( *EFI_DEVICE_PATH_UTILS_CREATE_NODE)(\r | |
156 | UINT8 NodeType,\r | |
157 | UINT8 NodeSubType,\r | |
158 | UINT16 NodeLength\r | |
159 | );\r | |
160 | \r | |
161 | /**\r | |
162 | Returns whether a device path is multi-instance.\r | |
163 | \r | |
164 | @param DevicePath Points to the device path. If NULL, then ignored.\r | |
165 | \r | |
166 | @retval TRUE The device path has more than one instance\r | |
167 | @retval FALSE The device path is empty or contains only a single instance.\r | |
168 | \r | |
169 | **/\r | |
170 | typedef\r | |
171 | BOOLEAN\r | |
172 | ( *EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE)(\r | |
173 | CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
174 | );\r | |
175 | \r | |
176 | ///\r | |
177 | /// This protocol is used to creates and manipulates device paths and device nodes.\r | |
178 | ///\r | |
179 | typedef struct {\r | |
180 | EFI_DEVICE_PATH_UTILS_GET_DEVICE_PATH_SIZE GetDevicePathSize;\r | |
181 | EFI_DEVICE_PATH_UTILS_DUP_DEVICE_PATH DuplicateDevicePath;\r | |
182 | EFI_DEVICE_PATH_UTILS_APPEND_PATH AppendDevicePath;\r | |
183 | EFI_DEVICE_PATH_UTILS_APPEND_NODE AppendDeviceNode;\r | |
184 | EFI_DEVICE_PATH_UTILS_APPEND_INSTANCE AppendDevicePathInstance;\r | |
185 | EFI_DEVICE_PATH_UTILS_GET_NEXT_INSTANCE GetNextDevicePathInstance;\r | |
186 | EFI_DEVICE_PATH_UTILS_IS_MULTI_INSTANCE IsDevicePathMultiInstance;\r | |
187 | EFI_DEVICE_PATH_UTILS_CREATE_NODE CreateDeviceNode;\r | |
188 | } EFI_DEVICE_PATH_UTILITIES_PROTOCOL;\r | |
189 | \r | |
190 | extern EFI_GUID gEfiDevicePathUtilitiesProtocolGuid;\r | |
191 | \r | |
192 | VOID\r | |
193 | SetDevicePathEndNode (\r | |
194 | VOID *Node\r | |
195 | );\r | |
196 | \r | |
197 | BOOLEAN\r | |
198 | IsDevicePathValid (\r | |
199 | CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r | |
200 | UINTN MaxSize\r | |
201 | );\r | |
202 | \r | |
203 | UINT8\r | |
204 | DevicePathType (\r | |
205 | CONST VOID *Node\r | |
206 | );\r | |
207 | \r | |
208 | UINT8\r | |
209 | DevicePathSubType (\r | |
210 | CONST VOID *Node\r | |
211 | );\r | |
212 | \r | |
213 | UINTN\r | |
214 | DevicePathNodeLength (\r | |
215 | CONST VOID *Node\r | |
216 | );\r | |
217 | \r | |
218 | EFI_DEVICE_PATH_PROTOCOL *\r | |
219 | NextDevicePathNode (\r | |
220 | CONST VOID *Node\r | |
221 | );\r | |
222 | \r | |
223 | BOOLEAN\r | |
224 | IsDevicePathEndType (\r | |
225 | CONST VOID *Node\r | |
226 | );\r | |
227 | \r | |
228 | BOOLEAN\r | |
229 | IsDevicePathEnd (\r | |
230 | CONST VOID *Node\r | |
231 | );\r | |
232 | BOOLEAN\r | |
233 | IsDevicePathEndInstance (\r | |
234 | CONST VOID *Node\r | |
235 | );\r | |
236 | \r | |
237 | UINT16\r | |
238 | SetDevicePathNodeLength (\r | |
239 | VOID *Node,\r | |
240 | UINTN Length\r | |
241 | );\r | |
242 | \r | |
243 | VOID\r | |
244 | SetDevicePathEndNode (\r | |
245 | VOID *Node\r | |
246 | );\r | |
247 | \r | |
248 | UINTN\r | |
249 | UefiDevicePathLibGetDevicePathSize (\r | |
250 | CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
251 | );\r | |
252 | \r | |
253 | EFI_DEVICE_PATH_PROTOCOL *\r | |
254 | UefiDevicePathLibDuplicateDevicePath (\r | |
255 | CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
256 | );\r | |
257 | \r | |
258 | EFI_DEVICE_PATH_PROTOCOL *\r | |
259 | UefiDevicePathLibAppendDevicePath (\r | |
260 | CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath,\r | |
261 | CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath\r | |
262 | );\r | |
263 | \r | |
264 | EFI_DEVICE_PATH_PROTOCOL *\r | |
265 | UefiDevicePathLibAppendDevicePathNode (\r | |
266 | CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r | |
267 | CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode\r | |
268 | );\r | |
269 | \r | |
270 | EFI_DEVICE_PATH_PROTOCOL *\r | |
271 | UefiDevicePathLibAppendDevicePathInstance (\r | |
272 | CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r | |
273 | CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance\r | |
274 | );\r | |
275 | \r | |
276 | EFI_DEVICE_PATH_PROTOCOL *\r | |
277 | UefiDevicePathLibGetNextDevicePathInstance (\r | |
278 | EFI_DEVICE_PATH_PROTOCOL **DevicePath,\r | |
279 | UINTN *Size\r | |
280 | );\r | |
281 | \r | |
282 | EFI_DEVICE_PATH_PROTOCOL *\r | |
283 | UefiDevicePathLibCreateDeviceNode (\r | |
284 | UINT8 NodeType,\r | |
285 | UINT8 NodeSubType,\r | |
286 | UINT16 NodeLength\r | |
287 | );\r | |
288 | \r | |
289 | BOOLEAN\r | |
290 | UefiDevicePathLibIsDevicePathMultiInstance (\r | |
291 | CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
292 | );\r | |
293 | \r | |
294 | #endif\r |