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
25 // Include common header file for this module.
27 #include "CommonHeader.h"
29 extern const EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid
;
30 extern const EFI_GUID mEfiDevicePathMessagingSASGuid
;
34 #define MIN_ALIGNMENT_SIZE sizeof(UINTN)
35 #define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)
37 #define IS_COMMA(a) ((a) == L',')
38 #define IS_HYPHEN(a) ((a) == L'-')
39 #define IS_DOT(a) ((a) == L'.')
40 #define IS_LEFT_PARENTH(a) ((a) == L'(')
41 #define IS_RIGHT_PARENTH(a) ((a) == L')')
42 #define IS_SLASH(a) ((a) == L'/')
43 #define IS_NULL(a) ((a) == L'\0')
45 #define DEVICE_NODE_END 1
46 #define DEVICE_PATH_INSTANCE_END 2
47 #define DEVICE_PATH_END 3
49 #define SetDevicePathInstanceEndNode(a) { \
50 (a)->Type = END_DEVICE_PATH_TYPE; \
51 (a)->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE; \
52 (a)->Length[0] = sizeof (EFI_DEVICE_PATH_PROTOCOL); \
57 // Private Data structure
68 VOID (*Function
) (POOL_PRINT
*, VOID
*, BOOLEAN
, BOOLEAN
);
69 } DEVICE_PATH_TO_TEXT_TABLE
;
72 CHAR16
*DevicePathNodeText
;
73 EFI_DEVICE_PATH_PROTOCOL
* (*Function
) (CHAR16
*);
74 } DEVICE_PATH_FROM_TEXT_TABLE
;
79 BOOLEAN SubClassExist
;
83 #define USB_CLASS_AUDIO 1
84 #define USB_CLASS_CDCCONTROL 2
85 #define USB_CLASS_HID 3
86 #define USB_CLASS_IMAGE 6
87 #define USB_CLASS_PRINTER 7
88 #define USB_CLASS_MASS_STORAGE 8
89 #define USB_CLASS_HUB 9
90 #define USB_CLASS_CDCDATA 10
91 #define USB_CLASS_SMART_CARD 11
92 #define USB_CLASS_VIDEO 14
93 #define USB_CLASS_DIAGNOSTIC 220
94 #define USB_CLASS_WIRELESS 224
96 #define USB_CLASS_RESERVE 254
97 #define USB_SUBCLASS_FW_UPDATE 1
98 #define USB_SUBCLASS_IRDA_BRIDGE 2
99 #define USB_SUBCLASS_TEST 3
102 EFI_DEVICE_PATH_PROTOCOL Header
;
104 UINT8 VendorDefinedData
[1];
105 } VENDOR_DEFINED_HARDWARE_DEVICE_PATH
;
108 EFI_DEVICE_PATH_PROTOCOL Header
;
110 UINT8 VendorDefinedData
[1];
111 } VENDOR_DEFINED_MESSAGING_DEVICE_PATH
;
114 EFI_DEVICE_PATH_PROTOCOL Header
;
116 UINT8 VendorDefinedData
[1];
117 } VENDOR_DEFINED_MEDIA_DEVICE_PATH
;
120 EFI_DEVICE_PATH_PROTOCOL Header
;
124 CHAR8 HidUidCidStr
[3];
125 } ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR
;
128 EFI_DEVICE_PATH_PROTOCOL Header
;
129 UINT16 NetworkProtocol
;
132 UINT16 TargetPortalGroupTag
;
134 CHAR16 iSCSITargetName
[1];
135 } ISCSI_DEVICE_PATH_WITH_NAME
;
138 EFI_DEVICE_PATH_PROTOCOL Header
;
140 UINT8 VendorDefinedData
[1];
141 } VENDOR_DEVICE_PATH_WITH_DATA
;
144 ConvertDeviceNodeToText (
145 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
146 IN BOOLEAN DisplayOnly
,
147 IN BOOLEAN AllowShortcuts
152 Convert a device node to its text representation.
155 DeviceNode - Points to the device node to be converted.
156 DisplayOnly - If DisplayOnly is TRUE, then the shorter text representation
157 of the display node is used, where applicable. If DisplayOnly
158 is FALSE, then the longer text representation of the display node
160 AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text
161 representation for a device node can be used, where applicable.
164 A pointer - a pointer to the allocated text representation of the device node.
165 NULL - if DeviceNode is NULL or there was insufficient memory.
171 ConvertDevicePathToText (
172 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
,
173 IN BOOLEAN DisplayOnly
,
174 IN BOOLEAN AllowShortcuts
179 Convert a device path to its text representation.
182 DeviceNode - Points to the device path to be converted.
183 DisplayOnly - If DisplayOnly is TRUE, then the shorter text representation
184 of the display node is used, where applicable. If DisplayOnly
185 is FALSE, then the longer text representation of the display node
187 AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text
188 representation for a device node can be used, where applicable.
191 A pointer - a pointer to the allocated text representation of the device path.
192 NULL - if DeviceNode is NULL or there was insufficient memory.
197 EFI_DEVICE_PATH_PROTOCOL
*
198 ConvertTextToDeviceNode (
199 IN CONST CHAR16
*TextDeviceNode
204 Convert text to the binary representation of a device node.
207 TextDeviceNode - TextDeviceNode points to the text representation of a device
208 node. Conversion starts with the first character and continues
209 until the first non-device node character.
212 A pointer - Pointer to the EFI device node.
213 NULL - if TextDeviceNode is NULL or there was insufficient memory.
218 EFI_DEVICE_PATH_PROTOCOL
*
219 ConvertTextToDevicePath (
220 IN CONST CHAR16
*TextDevicePath
225 Convert text to the binary representation of a device path.
228 TextDevicePath - TextDevicePath points to the text representation of a device
229 path. Conversion starts with the first character and continues
230 until the first non-device node character.
233 A pointer - Pointer to the allocated device path.
234 NULL - if TextDeviceNode is NULL or there was insufficient memory.
240 GetDevicePathSizeProtocolInterface (
241 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
246 Returns the size of the device path, in bytes.
249 DevicePath - Points to the start of the EFI device path.
252 Size - Size of the specified device path, in bytes, including the end-of-path tag.
257 EFI_DEVICE_PATH_PROTOCOL
*
258 DuplicateDevicePathProtocolInterface (
259 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
264 Create a duplicate of the specified path.
267 DevicePath - Points to the source EFI device path.
270 Pointer - A pointer to the duplicate device path.
271 NULL - Insufficient memory.
276 EFI_DEVICE_PATH_PROTOCOL
*
277 AppendDevicePathProtocolInterface (
278 IN CONST EFI_DEVICE_PATH_PROTOCOL
*Src1
,
279 IN CONST EFI_DEVICE_PATH_PROTOCOL
*Src2
284 Create a new path by appending the second device path to the first.
287 Src1 - Points to the first device path. If NULL, then it is ignored.
288 Src2 - Points to the second device path. If NULL, then it is ignored.
291 Pointer - A pointer to the newly created device path.
292 NULL - Memory could not be allocated
293 or either DevicePath or DeviceNode is NULL.
298 EFI_DEVICE_PATH_PROTOCOL
*
299 AppendDeviceNodeProtocolInterface (
300 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
301 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DeviceNode
306 Creates a new path by appending the device node to the device path.
309 DevicePath - Points to the device path.
310 DeviceNode - Points to the device node.
313 Pointer - A pointer to the allocated device node.
314 NULL - Memory could not be allocated
315 or either DevicePath or DeviceNode is NULL.
320 EFI_DEVICE_PATH_PROTOCOL
*
321 AppendDevicePathInstanceProtocolInterface (
322 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
323 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePathInstance
328 Creates a new path by appending the specified device path instance to the specified device path.
331 DevicePath - Points to the device path. If NULL, then ignored.
332 DevicePathInstance - Points to the device path instance.
335 Pointer - A pointer to the newly created device path
336 NULL - Memory could not be allocated or DevicePathInstance is NULL.
341 EFI_DEVICE_PATH_PROTOCOL
*
342 GetNextDevicePathInstanceProtocolInterface (
343 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePathInstance
,
344 OUT UINTN
*DevicePathInstanceSize
349 Creates a copy of the current device path instance and returns a pointer to the next device path instance.
352 DevicePathInstance - On input, this holds the pointer to the current device path
353 instance. On output, this holds the pointer to the next
354 device path instance or NULL if there are no more device
355 path instances in the device path.
356 DevicePathInstanceSize - On output, this holds the size of the device path instance,
357 in bytes or zero, if DevicePathInstance is zero.
360 Pointer - A pointer to the copy of the current device path instance.
361 NULL - DevicePathInstace was NULL on entry or there was insufficient memory.
367 IsDevicePathMultiInstanceProtocolInterface (
368 IN CONST EFI_DEVICE_PATH_PROTOCOL
*DevicePath
373 Returns whether a device path is multi-instance.
376 DevicePath - Points to the device path. If NULL, then ignored.
379 TRUE - The device path has more than one instance
380 FALSE - The device path is empty or contains only a single instance.
385 EFI_DEVICE_PATH_PROTOCOL
*
386 CreateDeviceNodeProtocolInterface (
388 IN UINT8 NodeSubType
,
394 Creates a device node
397 NodeType - NodeType is the device node type (EFI_DEVICE_PATH.Type) for
399 NodeSubType - NodeSubType is the device node sub-type
400 EFI_DEVICE_PATH.SubType) for the new device node.
401 NodeLength - NodeLength is the length of the device node
402 (EFI_DEVICE_PATH.Length) for the new device node.
405 Pointer - A pointer to the newly created device node.
406 NULL - NodeLength is less than
407 the size of the header or there was insufficient memory.