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 const EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid
;
25 extern const EFI_GUID mEfiDevicePathMessagingSASGuid
;
29 #define MIN_ALIGNMENT_SIZE sizeof(UINTN)
30 #define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)
32 #define IS_COMMA(a) ((a) == L',')
33 #define IS_HYPHEN(a) ((a) == L'-')
34 #define IS_DOT(a) ((a) == L'.')
35 #define IS_LEFT_PARENTH(a) ((a) == L'(')
36 #define IS_RIGHT_PARENTH(a) ((a) == L')')
37 #define IS_SLASH(a) ((a) == L'/')
38 #define IS_NULL(a) ((a) == L'\0')
40 #define DEVICE_NODE_END 1
41 #define DEVICE_PATH_INSTANCE_END 2
42 #define DEVICE_PATH_END 3
44 #define SetDevicePathInstanceEndNode(a) { \
45 (a)->Type = END_DEVICE_PATH_TYPE; \
46 (a)->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE; \
47 (a)->Length[0] = sizeof (EFI_DEVICE_PATH_PROTOCOL); \
52 // Private Data structure
63 VOID (*Function
) (POOL_PRINT
*, VOID
*, BOOLEAN
, BOOLEAN
);
64 } DEVICE_PATH_TO_TEXT_TABLE
;
67 CHAR16
*DevicePathNodeText
;
68 EFI_DEVICE_PATH_PROTOCOL
* (*Function
) (CHAR16
*);
69 } DEVICE_PATH_FROM_TEXT_TABLE
;
74 BOOLEAN SubClassExist
;
78 #define USB_CLASS_AUDIO 1
79 #define USB_CLASS_CDCCONTROL 2
80 #define USB_CLASS_HID 3
81 #define USB_CLASS_IMAGE 6
82 #define USB_CLASS_PRINTER 7
83 #define USB_CLASS_MASS_STORAGE 8
84 #define USB_CLASS_HUB 9
85 #define USB_CLASS_CDCDATA 10
86 #define USB_CLASS_SMART_CARD 11
87 #define USB_CLASS_VIDEO 14
88 #define USB_CLASS_DIAGNOSTIC 220
89 #define USB_CLASS_WIRELESS 224
91 #define USB_CLASS_RESERVE 254
92 #define USB_SUBCLASS_FW_UPDATE 1
93 #define USB_SUBCLASS_IRDA_BRIDGE 2
94 #define USB_SUBCLASS_TEST 3
97 EFI_DEVICE_PATH_PROTOCOL Header
;
99 UINT8 VendorDefinedData
[1];
100 } VENDOR_DEFINED_HARDWARE_DEVICE_PATH
;
103 EFI_DEVICE_PATH_PROTOCOL Header
;
105 UINT8 VendorDefinedData
[1];
106 } VENDOR_DEFINED_MESSAGING_DEVICE_PATH
;
109 EFI_DEVICE_PATH_PROTOCOL Header
;
111 UINT8 VendorDefinedData
[1];
112 } VENDOR_DEFINED_MEDIA_DEVICE_PATH
;
115 EFI_DEVICE_PATH_PROTOCOL Header
;
119 CHAR8 HidUidCidStr
[3];
120 } ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR
;
123 EFI_DEVICE_PATH_PROTOCOL Header
;
124 UINT16 NetworkProtocol
;
127 UINT16 TargetPortalGroupTag
;
129 CHAR16 iSCSITargetName
[1];
130 } ISCSI_DEVICE_PATH_WITH_NAME
;
133 EFI_DEVICE_PATH_PROTOCOL Header
;
135 UINT8 VendorDefinedData
[1];
136 } VENDOR_DEVICE_PATH_WITH_DATA
;
139 ConvertDeviceNodeToText (
140 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
141 IN BOOLEAN DisplayOnly
,
142 IN BOOLEAN AllowShortcuts
147 Convert a device node to its text representation.
150 DeviceNode - Points to the device node to be converted.
151 DisplayOnly - If DisplayOnly is TRUE, then the shorter text representation
152 of the display node is used, where applicable. If DisplayOnly
153 is FALSE, then the longer text representation of the display node
155 AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text
156 representation for a device node can be used, where applicable.
159 A pointer - a pointer to the allocated text representation of the device node.
160 NULL - if DeviceNode is NULL or there was insufficient memory.
166 ConvertDevicePathToText (
167 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
168 IN BOOLEAN DisplayOnly
,
169 IN BOOLEAN AllowShortcuts
174 Convert a device path to its text representation.
177 DeviceNode - Points to the device path to be converted.
178 DisplayOnly - If DisplayOnly is TRUE, then the shorter text representation
179 of the display node is used, where applicable. If DisplayOnly
180 is FALSE, then the longer text representation of the display node
182 AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text
183 representation for a device node can be used, where applicable.
186 A pointer - a pointer to the allocated text representation of the device path.
187 NULL - if DeviceNode is NULL or there was insufficient memory.
192 EFI_DEVICE_PATH_PROTOCOL
*
193 ConvertTextToDeviceNode (
194 IN CONST CHAR16
*TextDeviceNode
199 Convert text to the binary representation of a device node.
202 TextDeviceNode - TextDeviceNode points to the text representation of a device
203 node. Conversion starts with the first character and continues
204 until the first non-device node character.
207 A pointer - Pointer to the EFI device node.
208 NULL - if TextDeviceNode is NULL or there was insufficient memory.
213 EFI_DEVICE_PATH_PROTOCOL
*
214 ConvertTextToDevicePath (
215 IN CONST CHAR16
*TextDevicePath
220 Convert text to the binary representation of a device path.
223 TextDevicePath - TextDevicePath points to the text representation of a device
224 path. Conversion starts with the first character and continues
225 until the first non-device node character.
228 A pointer - Pointer to the allocated device path.
229 NULL - if TextDeviceNode is NULL or there was insufficient memory.
235 GetDevicePathSizeProtocolInterface (
236 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
241 Returns the size of the device path, in bytes.
244 DevicePath - Points to the start of the EFI device path.
247 Size - Size of the specified device path, in bytes, including the end-of-path tag.
252 EFI_DEVICE_PATH_PROTOCOL
*
253 DuplicateDevicePathProtocolInterface (
254 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
259 Create a duplicate of the specified path.
262 DevicePath - Points to the source EFI device path.
265 Pointer - A pointer to the duplicate device path.
266 NULL - Insufficient memory.
271 EFI_DEVICE_PATH_PROTOCOL
*
272 AppendDevicePathProtocolInterface (
273 IN CONST EFI_DEVICE_PATH_PROTOCOL
*Src1
,
274 IN CONST EFI_DEVICE_PATH_PROTOCOL
*Src2
279 Create a new path by appending the second device path to the first.
282 Src1 - Points to the first device path. If NULL, then it is ignored.
283 Src2 - Points to the second device path. If NULL, then it is ignored.
286 Pointer - A pointer to the newly created device path.
287 NULL - Memory could not be allocated
288 or either DevicePath or DeviceNode is NULL.
293 EFI_DEVICE_PATH_PROTOCOL
*
294 AppendDeviceNodeProtocolInterface (
295 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
296 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
301 Creates a new path by appending the device node to the device path.
304 DevicePath - Points to the device path.
305 DeviceNode - Points to the device node.
308 Pointer - A pointer to the allocated device node.
309 NULL - Memory could not be allocated
310 or either DevicePath or DeviceNode is NULL.
315 EFI_DEVICE_PATH_PROTOCOL
*
316 AppendDevicePathInstanceProtocolInterface (
317 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
318 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePathInstance
323 Creates a new path by appending the specified device path instance to the specified device path.
326 DevicePath - Points to the device path. If NULL, then ignored.
327 DevicePathInstance - Points to the device path instance.
330 Pointer - A pointer to the newly created device path
331 NULL - Memory could not be allocated or DevicePathInstance is NULL.
336 EFI_DEVICE_PATH_PROTOCOL
*
337 GetNextDevicePathInstanceProtocolInterface (
338 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePathInstance
,
339 OUT UINTN
*DevicePathInstanceSize
344 Creates a copy of the current device path instance and returns a pointer to the next device path instance.
347 DevicePathInstance - On input, this holds the pointer to the current device path
348 instance. On output, this holds the pointer to the next
349 device path instance or NULL if there are no more device
350 path instances in the device path.
351 DevicePathInstanceSize - On output, this holds the size of the device path instance,
352 in bytes or zero, if DevicePathInstance is zero.
355 Pointer - A pointer to the copy of the current device path instance.
356 NULL - DevicePathInstace was NULL on entry or there was insufficient memory.
362 IsDevicePathMultiInstanceProtocolInterface (
363 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
368 Returns whether a device path is multi-instance.
371 DevicePath - Points to the device path. If NULL, then ignored.
374 TRUE - The device path has more than one instance
375 FALSE - The device path is empty or contains only a single instance.
380 EFI_DEVICE_PATH_PROTOCOL
*
381 CreateDeviceNodeProtocolInterface (
383 IN UINT8 NodeSubType
,
389 Creates a device node
392 NodeType - NodeType is the device node type (EFI_DEVICE_PATH.Type) for
394 NodeSubType - NodeSubType is the device node sub-type
395 EFI_DEVICE_PATH.SubType) for the new device node.
396 NodeLength - NodeLength is the length of the device node
397 (EFI_DEVICE_PATH.Length) for the new device node.
400 Pointer - A pointer to the newly created device node.
401 NULL - NodeLength is less than
402 the size of the header or there was insufficient memory.