3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 Definition for Device Path Utilities driver
21 #ifndef _DEVICE_PATH_DRIVER_H
22 #define _DEVICE_PATH_DRIVER_H
24 extern EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid
;
25 extern EFI_GUID mEfiDevicePathMessagingSASGuid
;
27 #define DEVICE_PATH_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('D', 'P', 'D', 'V')
36 EFI_DEVICE_PATH_UTILITIES_PROTOCOL DevicePathUtilities
;
37 EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL DevicePathFromText
;
38 EFI_DEVICE_PATH_TO_TEXT_PROTOCOL DevicePathToText
;
40 } DEVICE_PATH_DRIVER_PRIVATE_DATA
;
44 #define MIN_ALIGNMENT_SIZE sizeof(UINTN)
45 #define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)
47 #define IS_COMMA(a) ((a) == L',')
48 #define IS_HYPHEN(a) ((a) == L'-')
49 #define IS_DOT(a) ((a) == L'.')
50 #define IS_LEFT_PARENTH(a) ((a) == L'(')
51 #define IS_RIGHT_PARENTH(a) ((a) == L')')
52 #define IS_SLASH(a) ((a) == L'/')
53 #define IS_NULL(a) ((a) == L'\0')
55 #define DEVICE_NODE_END 1
56 #define DEVICE_PATH_INSTANCE_END 2
57 #define DEVICE_PATH_END 3
59 #define SetDevicePathInstanceEndNode(a) { \
60 (a)->Type = END_DEVICE_PATH_TYPE; \
61 (a)->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE; \
62 (a)->Length[0] = sizeof (EFI_DEVICE_PATH_PROTOCOL); \
67 // Private Data structure
78 VOID (*Function
) (POOL_PRINT
*, VOID
*, BOOLEAN
, BOOLEAN
);
79 } DEVICE_PATH_TO_TEXT_TABLE
;
82 CHAR16
*DevicePathNodeText
;
83 EFI_DEVICE_PATH_PROTOCOL
* (*Function
) (CHAR16
*);
84 } DEVICE_PATH_FROM_TEXT_TABLE
;
89 BOOLEAN SubClassExist
;
93 #define USB_CLASS_AUDIO 1
94 #define USB_CLASS_CDCCONTROL 2
95 #define USB_CLASS_HID 3
96 #define USB_CLASS_IMAGE 6
97 #define USB_CLASS_PRINTER 7
98 #define USB_CLASS_MASS_STORAGE 8
99 #define USB_CLASS_HUB 9
100 #define USB_CLASS_CDCDATA 10
101 #define USB_CLASS_SMART_CARD 11
102 #define USB_CLASS_VIDEO 14
103 #define USB_CLASS_DIAGNOSTIC 220
104 #define USB_CLASS_WIRELESS 224
106 #define USB_CLASS_RESERVE 254
107 #define USB_SUBCLASS_FW_UPDATE 1
108 #define USB_SUBCLASS_IRDA_BRIDGE 2
109 #define USB_SUBCLASS_TEST 3
112 EFI_DEVICE_PATH_PROTOCOL Header
;
114 UINT8 VendorDefinedData
[1];
115 } VENDOR_DEFINED_HARDWARE_DEVICE_PATH
;
118 EFI_DEVICE_PATH_PROTOCOL Header
;
120 UINT8 VendorDefinedData
[1];
121 } VENDOR_DEFINED_MESSAGING_DEVICE_PATH
;
124 EFI_DEVICE_PATH_PROTOCOL Header
;
126 UINT8 VendorDefinedData
[1];
127 } VENDOR_DEFINED_MEDIA_DEVICE_PATH
;
130 EFI_DEVICE_PATH_PROTOCOL Header
;
134 CHAR8 HidUidCidStr
[3];
135 } ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR
;
138 EFI_DEVICE_PATH_PROTOCOL Header
;
139 UINT16 NetworkProtocol
;
142 UINT16 TargetPortalGroupTag
;
144 CHAR16 iSCSITargetName
[1];
145 } ISCSI_DEVICE_PATH_WITH_NAME
;
148 EFI_DEVICE_PATH_PROTOCOL Header
;
150 UINT8 VendorDefinedData
[1];
151 } VENDOR_DEVICE_PATH_WITH_DATA
;
154 ConvertDeviceNodeToText (
155 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
156 IN BOOLEAN DisplayOnly
,
157 IN BOOLEAN AllowShortcuts
162 Convert a device node to its text representation.
165 DeviceNode - Points to the device node to be converted.
166 DisplayOnly - If DisplayOnly is TRUE, then the shorter text representation
167 of the display node is used, where applicable. If DisplayOnly
168 is FALSE, then the longer text representation of the display node
170 AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text
171 representation for a device node can be used, where applicable.
174 A pointer - a pointer to the allocated text representation of the device node.
175 NULL - if DeviceNode is NULL or there was insufficient memory.
181 ConvertDevicePathToText (
182 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
183 IN BOOLEAN DisplayOnly
,
184 IN BOOLEAN AllowShortcuts
189 Convert a device path to its text representation.
192 DeviceNode - Points to the device path to be converted.
193 DisplayOnly - If DisplayOnly is TRUE, then the shorter text representation
194 of the display node is used, where applicable. If DisplayOnly
195 is FALSE, then the longer text representation of the display node
197 AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text
198 representation for a device node can be used, where applicable.
201 A pointer - a pointer to the allocated text representation of the device path.
202 NULL - if DeviceNode is NULL or there was insufficient memory.
207 EFI_DEVICE_PATH_PROTOCOL
*
208 ConvertTextToDeviceNode (
209 IN CONST CHAR16
*TextDeviceNode
214 Convert text to the binary representation of a device node.
217 TextDeviceNode - TextDeviceNode points to the text representation of a device
218 node. Conversion starts with the first character and continues
219 until the first non-device node character.
222 A pointer - Pointer to the EFI device node.
223 NULL - if TextDeviceNode is NULL or there was insufficient memory.
228 EFI_DEVICE_PATH_PROTOCOL
*
229 ConvertTextToDevicePath (
230 IN CONST CHAR16
*TextDevicePath
235 Convert text to the binary representation of a device path.
238 TextDevicePath - TextDevicePath points to the text representation of a device
239 path. Conversion starts with the first character and continues
240 until the first non-device node character.
243 A pointer - Pointer to the allocated device path.
244 NULL - if TextDeviceNode is NULL or there was insufficient memory.
250 GetDevicePathSizeProtocolInterface (
251 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
256 Returns the size of the device path, in bytes.
259 DevicePath - Points to the start of the EFI device path.
262 Size - Size of the specified device path, in bytes, including the end-of-path tag.
267 EFI_DEVICE_PATH_PROTOCOL
*
268 DuplicateDevicePathProtocolInterface (
269 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
274 Create a duplicate of the specified path.
277 DevicePath - Points to the source EFI device path.
280 Pointer - A pointer to the duplicate device path.
281 NULL - Insufficient memory.
286 EFI_DEVICE_PATH_PROTOCOL
*
287 AppendDevicePathProtocolInterface (
288 IN CONST EFI_DEVICE_PATH_PROTOCOL
*Src1
,
289 IN CONST EFI_DEVICE_PATH_PROTOCOL
*Src2
294 Create a new path by appending the second device path to the first.
297 Src1 - Points to the first device path. If NULL, then it is ignored.
298 Src2 - Points to the second device path. If NULL, then it is ignored.
301 Pointer - A pointer to the newly created device path.
302 NULL - Memory could not be allocated
303 or either DevicePath or DeviceNode is NULL.
308 EFI_DEVICE_PATH_PROTOCOL
*
309 AppendDeviceNodeProtocolInterface (
310 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
311 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
316 Creates a new path by appending the device node to the device path.
319 DevicePath - Points to the device path.
320 DeviceNode - Points to the device node.
323 Pointer - A pointer to the allocated device node.
324 NULL - Memory could not be allocated
325 or either DevicePath or DeviceNode is NULL.
330 EFI_DEVICE_PATH_PROTOCOL
*
331 AppendDevicePathInstanceProtocolInterface (
332 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
333 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePathInstance
338 Creates a new path by appending the specified device path instance to the specified device path.
341 DevicePath - Points to the device path. If NULL, then ignored.
342 DevicePathInstance - Points to the device path instance.
345 Pointer - A pointer to the newly created device path
346 NULL - Memory could not be allocated or DevicePathInstance is NULL.
351 EFI_DEVICE_PATH_PROTOCOL
*
352 GetNextDevicePathInstanceProtocolInterface (
353 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePathInstance
,
354 OUT UINTN
*DevicePathInstanceSize
359 Creates a copy of the current device path instance and returns a pointer to the next device path instance.
362 DevicePathInstance - On input, this holds the pointer to the current device path
363 instance. On output, this holds the pointer to the next
364 device path instance or NULL if there are no more device
365 path instances in the device path.
366 DevicePathInstanceSize - On output, this holds the size of the device path instance,
367 in bytes or zero, if DevicePathInstance is zero.
370 Pointer - A pointer to the copy of the current device path instance.
371 NULL - DevicePathInstace was NULL on entry or there was insufficient memory.
377 IsDevicePathMultiInstanceProtocolInterface (
378 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
383 Returns whether a device path is multi-instance.
386 DevicePath - Points to the device path. If NULL, then ignored.
389 TRUE - The device path has more than one instance
390 FALSE - The device path is empty or contains only a single instance.
395 EFI_DEVICE_PATH_PROTOCOL
*
396 CreateDeviceNodeProtocolInterface (
398 IN UINT8 NodeSubType
,
404 Creates a device node
407 NodeType - NodeType is the device node type (EFI_DEVICE_PATH.Type) for
409 NodeSubType - NodeSubType is the device node sub-type
410 EFI_DEVICE_PATH.SubType) for the new device node.
411 NodeLength - NodeLength is the length of the device node
412 (EFI_DEVICE_PATH.Length) for the new device node.
415 Pointer - A pointer to the newly created device node.
416 NULL - NodeLength is less than
417 the size of the header or there was insufficient memory.