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