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