]>
Commit | Line | Data |
---|---|---|
562d2849 | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2006, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | DevicePathDriver.h\r | |
15 | \r | |
16 | Abstract:\r | |
17 | Definition for Device Path Utilities driver\r | |
18 | \r | |
19 | --*/\r | |
20 | \r | |
21 | #ifndef _DEVICE_PATH_DRIVER_H\r | |
22 | #define _DEVICE_PATH_DRIVER_H\r | |
23 | \r | |
e99aa5a2 | 24 | extern const EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid;\r |
25 | extern const EFI_GUID mEfiDevicePathMessagingSASGuid;\r | |
562d2849 | 26 | \r |
27 | #define MAX_CHAR 480\r | |
28 | \r | |
29 | #define MIN_ALIGNMENT_SIZE sizeof(UINTN)\r | |
30 | #define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)\r | |
31 | \r | |
32 | #define IS_COMMA(a) ((a) == L',')\r | |
33 | #define IS_HYPHEN(a) ((a) == L'-')\r | |
34 | #define IS_DOT(a) ((a) == L'.')\r | |
35 | #define IS_LEFT_PARENTH(a) ((a) == L'(')\r | |
36 | #define IS_RIGHT_PARENTH(a) ((a) == L')')\r | |
37 | #define IS_SLASH(a) ((a) == L'/')\r | |
38 | #define IS_NULL(a) ((a) == L'\0')\r | |
39 | \r | |
40 | #define DEVICE_NODE_END 1\r | |
41 | #define DEVICE_PATH_INSTANCE_END 2\r | |
42 | #define DEVICE_PATH_END 3\r | |
43 | \r | |
44 | #define SetDevicePathInstanceEndNode(a) { \\r | |
45 | (a)->Type = END_DEVICE_PATH_TYPE; \\r | |
46 | (a)->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE; \\r | |
47 | (a)->Length[0] = sizeof (EFI_DEVICE_PATH_PROTOCOL); \\r | |
48 | (a)->Length[1] = 0; \\r | |
49 | }\r | |
50 | \r | |
51 | //\r | |
52 | // Private Data structure\r | |
53 | //\r | |
54 | typedef struct {\r | |
55 | CHAR16 *Str;\r | |
56 | UINTN Len;\r | |
57 | UINTN MaxLen;\r | |
58 | } POOL_PRINT;\r | |
59 | \r | |
60 | typedef struct {\r | |
61 | UINT8 Type;\r | |
62 | UINT8 SubType;\r | |
63 | VOID (*Function) (POOL_PRINT *, VOID *, BOOLEAN, BOOLEAN);\r | |
64 | } DEVICE_PATH_TO_TEXT_TABLE;\r | |
65 | \r | |
66 | typedef struct {\r | |
67 | CHAR16 *DevicePathNodeText;\r | |
68 | EFI_DEVICE_PATH_PROTOCOL * (*Function) (CHAR16 *);\r | |
69 | } DEVICE_PATH_FROM_TEXT_TABLE;\r | |
70 | \r | |
71 | typedef struct {\r | |
72 | BOOLEAN ClassExist;\r | |
73 | UINT8 Class;\r | |
74 | BOOLEAN SubClassExist;\r | |
75 | UINT8 SubClass;\r | |
76 | } USB_CLASS_TEXT;\r | |
77 | \r | |
78 | #define USB_CLASS_AUDIO 1\r | |
79 | #define USB_CLASS_CDCCONTROL 2\r | |
80 | #define USB_CLASS_HID 3\r | |
81 | #define USB_CLASS_IMAGE 6\r | |
82 | #define USB_CLASS_PRINTER 7\r | |
83 | #define USB_CLASS_MASS_STORAGE 8\r | |
84 | #define USB_CLASS_HUB 9\r | |
85 | #define USB_CLASS_CDCDATA 10\r | |
86 | #define USB_CLASS_SMART_CARD 11\r | |
87 | #define USB_CLASS_VIDEO 14\r | |
88 | #define USB_CLASS_DIAGNOSTIC 220\r | |
89 | #define USB_CLASS_WIRELESS 224\r | |
90 | \r | |
91 | #define USB_CLASS_RESERVE 254\r | |
92 | #define USB_SUBCLASS_FW_UPDATE 1\r | |
93 | #define USB_SUBCLASS_IRDA_BRIDGE 2\r | |
94 | #define USB_SUBCLASS_TEST 3\r | |
95 | \r | |
96 | typedef struct {\r | |
97 | EFI_DEVICE_PATH_PROTOCOL Header;\r | |
98 | EFI_GUID Guid;\r | |
99 | UINT8 VendorDefinedData[1];\r | |
100 | } VENDOR_DEFINED_HARDWARE_DEVICE_PATH;\r | |
101 | \r | |
102 | typedef struct {\r | |
103 | EFI_DEVICE_PATH_PROTOCOL Header;\r | |
104 | EFI_GUID Guid;\r | |
105 | UINT8 VendorDefinedData[1];\r | |
106 | } VENDOR_DEFINED_MESSAGING_DEVICE_PATH;\r | |
107 | \r | |
108 | typedef struct {\r | |
109 | EFI_DEVICE_PATH_PROTOCOL Header;\r | |
110 | EFI_GUID Guid;\r | |
111 | UINT8 VendorDefinedData[1];\r | |
112 | } VENDOR_DEFINED_MEDIA_DEVICE_PATH;\r | |
113 | \r | |
114 | typedef struct {\r | |
115 | EFI_DEVICE_PATH_PROTOCOL Header;\r | |
116 | UINT32 HID;\r | |
117 | UINT32 UID;\r | |
118 | UINT32 CID;\r | |
119 | CHAR8 HidUidCidStr[3];\r | |
120 | } ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR;\r | |
121 | \r | |
122 | typedef struct {\r | |
123 | EFI_DEVICE_PATH_PROTOCOL Header;\r | |
124 | UINT16 NetworkProtocol;\r | |
125 | UINT16 LoginOption;\r | |
126 | UINT16 Reserved;\r | |
127 | UINT16 TargetPortalGroupTag;\r | |
128 | UINT64 Lun;\r | |
129 | CHAR16 iSCSITargetName[1];\r | |
130 | } ISCSI_DEVICE_PATH_WITH_NAME;\r | |
131 | \r | |
132 | typedef struct {\r | |
133 | EFI_DEVICE_PATH_PROTOCOL Header;\r | |
134 | EFI_GUID Guid;\r | |
135 | UINT8 VendorDefinedData[1];\r | |
136 | } VENDOR_DEVICE_PATH_WITH_DATA;\r | |
137 | \r | |
138 | CHAR16 *\r | |
139 | ConvertDeviceNodeToText (\r | |
140 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode,\r | |
141 | IN BOOLEAN DisplayOnly,\r | |
142 | IN BOOLEAN AllowShortcuts\r | |
143 | )\r | |
144 | /*++\r | |
145 | \r | |
146 | Routine Description:\r | |
147 | Convert a device node to its text representation.\r | |
148 | \r | |
149 | Arguments:\r | |
150 | DeviceNode - Points to the device node to be converted.\r | |
151 | DisplayOnly - If DisplayOnly is TRUE, then the shorter text representation\r | |
152 | of the display node is used, where applicable. If DisplayOnly\r | |
153 | is FALSE, then the longer text representation of the display node\r | |
154 | is used.\r | |
155 | AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
156 | representation for a device node can be used, where applicable.\r | |
157 | \r | |
158 | Returns:\r | |
159 | A pointer - a pointer to the allocated text representation of the device node.\r | |
160 | NULL - if DeviceNode is NULL or there was insufficient memory.\r | |
161 | \r | |
162 | --*/\r | |
163 | ;\r | |
164 | \r | |
165 | CHAR16 *\r | |
166 | ConvertDevicePathToText (\r | |
167 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode,\r | |
168 | IN BOOLEAN DisplayOnly,\r | |
169 | IN BOOLEAN AllowShortcuts\r | |
170 | )\r | |
171 | /*++\r | |
172 | \r | |
173 | Routine Description:\r | |
174 | Convert a device path to its text representation.\r | |
175 | \r | |
176 | Arguments:\r | |
177 | DeviceNode - Points to the device path to be converted.\r | |
178 | DisplayOnly - If DisplayOnly is TRUE, then the shorter text representation\r | |
179 | of the display node is used, where applicable. If DisplayOnly\r | |
180 | is FALSE, then the longer text representation of the display node\r | |
181 | is used.\r | |
182 | AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text\r | |
183 | representation for a device node can be used, where applicable.\r | |
184 | \r | |
185 | Returns:\r | |
186 | A pointer - a pointer to the allocated text representation of the device path.\r | |
187 | NULL - if DeviceNode is NULL or there was insufficient memory.\r | |
188 | \r | |
189 | --*/\r | |
190 | ;\r | |
191 | \r | |
192 | EFI_DEVICE_PATH_PROTOCOL *\r | |
193 | ConvertTextToDeviceNode (\r | |
194 | IN CONST CHAR16 *TextDeviceNode\r | |
195 | )\r | |
196 | /*++\r | |
197 | \r | |
198 | Routine Description:\r | |
199 | Convert text to the binary representation of a device node.\r | |
200 | \r | |
201 | Arguments:\r | |
202 | TextDeviceNode - TextDeviceNode points to the text representation of a device\r | |
203 | node. Conversion starts with the first character and continues\r | |
204 | until the first non-device node character.\r | |
205 | \r | |
206 | Returns:\r | |
207 | A pointer - Pointer to the EFI device node.\r | |
208 | NULL - if TextDeviceNode is NULL or there was insufficient memory.\r | |
209 | \r | |
210 | --*/\r | |
211 | ;\r | |
212 | \r | |
213 | EFI_DEVICE_PATH_PROTOCOL *\r | |
214 | ConvertTextToDevicePath (\r | |
215 | IN CONST CHAR16 *TextDevicePath\r | |
216 | )\r | |
217 | /*++\r | |
218 | \r | |
219 | Routine Description:\r | |
220 | Convert text to the binary representation of a device path.\r | |
221 | \r | |
222 | Arguments:\r | |
223 | TextDevicePath - TextDevicePath points to the text representation of a device\r | |
224 | path. Conversion starts with the first character and continues\r | |
225 | until the first non-device node character.\r | |
226 | \r | |
227 | Returns:\r | |
228 | A pointer - Pointer to the allocated device path.\r | |
229 | NULL - if TextDeviceNode is NULL or there was insufficient memory.\r | |
230 | \r | |
231 | --*/\r | |
232 | ;\r | |
233 | \r | |
234 | UINTN\r | |
ffac4bcb | 235 | GetDevicePathSizeProtocolInterface (\r |
562d2849 | 236 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r |
237 | )\r | |
238 | /*++\r | |
239 | \r | |
240 | Routine Description:\r | |
241 | Returns the size of the device path, in bytes.\r | |
242 | \r | |
243 | Arguments:\r | |
244 | DevicePath - Points to the start of the EFI device path.\r | |
245 | \r | |
246 | Returns:\r | |
247 | Size - Size of the specified device path, in bytes, including the end-of-path tag.\r | |
248 | \r | |
249 | --*/\r | |
250 | ;\r | |
251 | \r | |
252 | EFI_DEVICE_PATH_PROTOCOL *\r | |
ffac4bcb | 253 | DuplicateDevicePathProtocolInterface (\r |
562d2849 | 254 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r |
255 | )\r | |
256 | /*++\r | |
257 | \r | |
258 | Routine Description:\r | |
259 | Create a duplicate of the specified path.\r | |
260 | \r | |
261 | Arguments:\r | |
262 | DevicePath - Points to the source EFI device path.\r | |
263 | \r | |
264 | Returns:\r | |
265 | Pointer - A pointer to the duplicate device path.\r | |
266 | NULL - Insufficient memory.\r | |
267 | \r | |
268 | --*/\r | |
269 | ;\r | |
270 | \r | |
271 | EFI_DEVICE_PATH_PROTOCOL *\r | |
ffac4bcb | 272 | AppendDevicePathProtocolInterface (\r |
562d2849 | 273 | IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1,\r |
274 | IN CONST EFI_DEVICE_PATH_PROTOCOL *Src2\r | |
275 | )\r | |
276 | /*++\r | |
277 | \r | |
278 | Routine Description:\r | |
279 | Create a new path by appending the second device path to the first.\r | |
280 | \r | |
281 | Arguments:\r | |
282 | Src1 - Points to the first device path. If NULL, then it is ignored.\r | |
283 | Src2 - Points to the second device path. If NULL, then it is ignored.\r | |
284 | \r | |
285 | Returns:\r | |
286 | Pointer - A pointer to the newly created device path.\r | |
287 | NULL - Memory could not be allocated\r | |
288 | or either DevicePath or DeviceNode is NULL.\r | |
289 | \r | |
290 | --*/\r | |
291 | ;\r | |
292 | \r | |
293 | EFI_DEVICE_PATH_PROTOCOL *\r | |
ffac4bcb | 294 | AppendDeviceNodeProtocolInterface (\r |
562d2849 | 295 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r |
296 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode\r | |
297 | )\r | |
298 | /*++\r | |
299 | \r | |
300 | Routine Description:\r | |
301 | Creates a new path by appending the device node to the device path.\r | |
302 | \r | |
303 | Arguments:\r | |
304 | DevicePath - Points to the device path.\r | |
305 | DeviceNode - Points to the device node.\r | |
306 | \r | |
307 | Returns:\r | |
308 | Pointer - A pointer to the allocated device node.\r | |
309 | NULL - Memory could not be allocated\r | |
310 | or either DevicePath or DeviceNode is NULL.\r | |
311 | \r | |
312 | --*/\r | |
313 | ;\r | |
314 | \r | |
315 | EFI_DEVICE_PATH_PROTOCOL *\r | |
ffac4bcb | 316 | AppendDevicePathInstanceProtocolInterface (\r |
562d2849 | 317 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r |
318 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance\r | |
319 | )\r | |
320 | /*++\r | |
321 | \r | |
322 | Routine Description:\r | |
323 | Creates a new path by appending the specified device path instance to the specified device path.\r | |
324 | \r | |
325 | Arguments:\r | |
326 | DevicePath - Points to the device path. If NULL, then ignored.\r | |
327 | DevicePathInstance - Points to the device path instance.\r | |
328 | \r | |
329 | Returns:\r | |
330 | Pointer - A pointer to the newly created device path\r | |
331 | NULL - Memory could not be allocated or DevicePathInstance is NULL.\r | |
332 | \r | |
333 | --*/\r | |
334 | ;\r | |
335 | \r | |
336 | EFI_DEVICE_PATH_PROTOCOL *\r | |
ffac4bcb | 337 | GetNextDevicePathInstanceProtocolInterface (\r |
562d2849 | 338 | IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,\r |
339 | OUT UINTN *DevicePathInstanceSize\r | |
340 | )\r | |
341 | /*++\r | |
342 | \r | |
343 | Routine Description:\r | |
344 | Creates a copy of the current device path instance and returns a pointer to the next device path instance.\r | |
345 | \r | |
346 | Arguments:\r | |
347 | DevicePathInstance - On input, this holds the pointer to the current device path\r | |
348 | instance. On output, this holds the pointer to the next\r | |
349 | device path instance or NULL if there are no more device\r | |
350 | path instances in the device path.\r | |
351 | DevicePathInstanceSize - On output, this holds the size of the device path instance,\r | |
352 | in bytes or zero, if DevicePathInstance is zero.\r | |
353 | \r | |
354 | Returns:\r | |
355 | Pointer - A pointer to the copy of the current device path instance.\r | |
356 | NULL - DevicePathInstace was NULL on entry or there was insufficient memory.\r | |
357 | \r | |
358 | --*/\r | |
359 | ;\r | |
360 | \r | |
361 | BOOLEAN\r | |
ffac4bcb | 362 | IsDevicePathMultiInstanceProtocolInterface (\r |
562d2849 | 363 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r |
364 | )\r | |
365 | /*++\r | |
366 | \r | |
367 | Routine Description:\r | |
368 | Returns whether a device path is multi-instance.\r | |
369 | \r | |
370 | Arguments:\r | |
371 | DevicePath - Points to the device path. If NULL, then ignored.\r | |
372 | \r | |
373 | Returns:\r | |
374 | TRUE - The device path has more than one instance\r | |
375 | FALSE - The device path is empty or contains only a single instance.\r | |
376 | \r | |
377 | --*/\r | |
378 | ;\r | |
379 | \r | |
380 | EFI_DEVICE_PATH_PROTOCOL *\r | |
ffac4bcb | 381 | CreateDeviceNodeProtocolInterface (\r |
562d2849 | 382 | IN UINT8 NodeType,\r |
383 | IN UINT8 NodeSubType,\r | |
384 | IN UINT16 NodeLength\r | |
385 | )\r | |
386 | /*++\r | |
387 | \r | |
388 | Routine Description:\r | |
389 | Creates a device node\r | |
390 | \r | |
391 | Arguments:\r | |
392 | NodeType - NodeType is the device node type (EFI_DEVICE_PATH.Type) for\r | |
393 | the new device node.\r | |
394 | NodeSubType - NodeSubType is the device node sub-type\r | |
395 | EFI_DEVICE_PATH.SubType) for the new device node.\r | |
396 | NodeLength - NodeLength is the length of the device node\r | |
397 | (EFI_DEVICE_PATH.Length) for the new device node.\r | |
398 | \r | |
399 | Returns:\r | |
400 | Pointer - A pointer to the newly created device node.\r | |
401 | NULL - NodeLength is less than\r | |
402 | the size of the header or there was insufficient memory.\r | |
403 | \r | |
404 | --*/\r | |
405 | ;\r | |
406 | \r | |
407 | #endif\r |