]> git.proxmox.com Git - mirror_edk2.git/blob - EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.h
Update Device Path Module to use PCD Feature Flags to determine of the Device Path...
[mirror_edk2.git] / EdkModulePkg / Universal / DevicePath / Dxe / DevicePath.h
1 /*++
2
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
8
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.
11
12 Module Name:
13
14 DevicePathDriver.h
15
16 Abstract:
17 Definition for Device Path Utilities driver
18
19 --*/
20
21 #ifndef _DEVICE_PATH_DRIVER_H
22 #define _DEVICE_PATH_DRIVER_H
23
24 extern const EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid;
25 extern const EFI_GUID mEfiDevicePathMessagingSASGuid;
26
27 #define MAX_CHAR 480
28
29 #define MIN_ALIGNMENT_SIZE sizeof(UINTN)
30 #define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)
31
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')
39
40 #define DEVICE_NODE_END 1
41 #define DEVICE_PATH_INSTANCE_END 2
42 #define DEVICE_PATH_END 3
43
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); \
48 (a)->Length[1] = 0; \
49 }
50
51 //
52 // Private Data structure
53 //
54 typedef struct {
55 CHAR16 *Str;
56 UINTN Len;
57 UINTN MaxLen;
58 } POOL_PRINT;
59
60 typedef struct {
61 UINT8 Type;
62 UINT8 SubType;
63 VOID (*Function) (POOL_PRINT *, VOID *, BOOLEAN, BOOLEAN);
64 } DEVICE_PATH_TO_TEXT_TABLE;
65
66 typedef struct {
67 CHAR16 *DevicePathNodeText;
68 EFI_DEVICE_PATH_PROTOCOL * (*Function) (CHAR16 *);
69 } DEVICE_PATH_FROM_TEXT_TABLE;
70
71 typedef struct {
72 BOOLEAN ClassExist;
73 UINT8 Class;
74 BOOLEAN SubClassExist;
75 UINT8 SubClass;
76 } USB_CLASS_TEXT;
77
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
90
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
95
96 typedef struct {
97 EFI_DEVICE_PATH_PROTOCOL Header;
98 EFI_GUID Guid;
99 UINT8 VendorDefinedData[1];
100 } VENDOR_DEFINED_HARDWARE_DEVICE_PATH;
101
102 typedef struct {
103 EFI_DEVICE_PATH_PROTOCOL Header;
104 EFI_GUID Guid;
105 UINT8 VendorDefinedData[1];
106 } VENDOR_DEFINED_MESSAGING_DEVICE_PATH;
107
108 typedef struct {
109 EFI_DEVICE_PATH_PROTOCOL Header;
110 EFI_GUID Guid;
111 UINT8 VendorDefinedData[1];
112 } VENDOR_DEFINED_MEDIA_DEVICE_PATH;
113
114 typedef struct {
115 EFI_DEVICE_PATH_PROTOCOL Header;
116 UINT32 HID;
117 UINT32 UID;
118 UINT32 CID;
119 CHAR8 HidUidCidStr[3];
120 } ACPI_EXTENDED_HID_DEVICE_PATH_WITH_STR;
121
122 typedef struct {
123 EFI_DEVICE_PATH_PROTOCOL Header;
124 UINT16 NetworkProtocol;
125 UINT16 LoginOption;
126 UINT16 Reserved;
127 UINT16 TargetPortalGroupTag;
128 UINT64 Lun;
129 CHAR16 iSCSITargetName[1];
130 } ISCSI_DEVICE_PATH_WITH_NAME;
131
132 typedef struct {
133 EFI_DEVICE_PATH_PROTOCOL Header;
134 EFI_GUID Guid;
135 UINT8 VendorDefinedData[1];
136 } VENDOR_DEVICE_PATH_WITH_DATA;
137
138 CHAR16 *
139 ConvertDeviceNodeToText (
140 IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode,
141 IN BOOLEAN DisplayOnly,
142 IN BOOLEAN AllowShortcuts
143 )
144 /*++
145
146 Routine Description:
147 Convert a device node to its text representation.
148
149 Arguments:
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
154 is used.
155 AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text
156 representation for a device node can be used, where applicable.
157
158 Returns:
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.
161
162 --*/
163 ;
164
165 CHAR16 *
166 ConvertDevicePathToText (
167 IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode,
168 IN BOOLEAN DisplayOnly,
169 IN BOOLEAN AllowShortcuts
170 )
171 /*++
172
173 Routine Description:
174 Convert a device path to its text representation.
175
176 Arguments:
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
181 is used.
182 AllowShortcuts - If AllowShortcuts is TRUE, then the shortcut forms of text
183 representation for a device node can be used, where applicable.
184
185 Returns:
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.
188
189 --*/
190 ;
191
192 EFI_DEVICE_PATH_PROTOCOL *
193 ConvertTextToDeviceNode (
194 IN CONST CHAR16 *TextDeviceNode
195 )
196 /*++
197
198 Routine Description:
199 Convert text to the binary representation of a device node.
200
201 Arguments:
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.
205
206 Returns:
207 A pointer - Pointer to the EFI device node.
208 NULL - if TextDeviceNode is NULL or there was insufficient memory.
209
210 --*/
211 ;
212
213 EFI_DEVICE_PATH_PROTOCOL *
214 ConvertTextToDevicePath (
215 IN CONST CHAR16 *TextDevicePath
216 )
217 /*++
218
219 Routine Description:
220 Convert text to the binary representation of a device path.
221
222 Arguments:
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.
226
227 Returns:
228 A pointer - Pointer to the allocated device path.
229 NULL - if TextDeviceNode is NULL or there was insufficient memory.
230
231 --*/
232 ;
233
234 UINTN
235 GetDevicePathSizeProtocolInterface (
236 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
237 )
238 /*++
239
240 Routine Description:
241 Returns the size of the device path, in bytes.
242
243 Arguments:
244 DevicePath - Points to the start of the EFI device path.
245
246 Returns:
247 Size - Size of the specified device path, in bytes, including the end-of-path tag.
248
249 --*/
250 ;
251
252 EFI_DEVICE_PATH_PROTOCOL *
253 DuplicateDevicePathProtocolInterface (
254 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
255 )
256 /*++
257
258 Routine Description:
259 Create a duplicate of the specified path.
260
261 Arguments:
262 DevicePath - Points to the source EFI device path.
263
264 Returns:
265 Pointer - A pointer to the duplicate device path.
266 NULL - Insufficient memory.
267
268 --*/
269 ;
270
271 EFI_DEVICE_PATH_PROTOCOL *
272 AppendDevicePathProtocolInterface (
273 IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1,
274 IN CONST EFI_DEVICE_PATH_PROTOCOL *Src2
275 )
276 /*++
277
278 Routine Description:
279 Create a new path by appending the second device path to the first.
280
281 Arguments:
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.
284
285 Returns:
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.
289
290 --*/
291 ;
292
293 EFI_DEVICE_PATH_PROTOCOL *
294 AppendDeviceNodeProtocolInterface (
295 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
296 IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode
297 )
298 /*++
299
300 Routine Description:
301 Creates a new path by appending the device node to the device path.
302
303 Arguments:
304 DevicePath - Points to the device path.
305 DeviceNode - Points to the device node.
306
307 Returns:
308 Pointer - A pointer to the allocated device node.
309 NULL - Memory could not be allocated
310 or either DevicePath or DeviceNode is NULL.
311
312 --*/
313 ;
314
315 EFI_DEVICE_PATH_PROTOCOL *
316 AppendDevicePathInstanceProtocolInterface (
317 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
318 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
319 )
320 /*++
321
322 Routine Description:
323 Creates a new path by appending the specified device path instance to the specified device path.
324
325 Arguments:
326 DevicePath - Points to the device path. If NULL, then ignored.
327 DevicePathInstance - Points to the device path instance.
328
329 Returns:
330 Pointer - A pointer to the newly created device path
331 NULL - Memory could not be allocated or DevicePathInstance is NULL.
332
333 --*/
334 ;
335
336 EFI_DEVICE_PATH_PROTOCOL *
337 GetNextDevicePathInstanceProtocolInterface (
338 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,
339 OUT UINTN *DevicePathInstanceSize
340 )
341 /*++
342
343 Routine Description:
344 Creates a copy of the current device path instance and returns a pointer to the next device path instance.
345
346 Arguments:
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.
353
354 Returns:
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.
357
358 --*/
359 ;
360
361 BOOLEAN
362 IsDevicePathMultiInstanceProtocolInterface (
363 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
364 )
365 /*++
366
367 Routine Description:
368 Returns whether a device path is multi-instance.
369
370 Arguments:
371 DevicePath - Points to the device path. If NULL, then ignored.
372
373 Returns:
374 TRUE - The device path has more than one instance
375 FALSE - The device path is empty or contains only a single instance.
376
377 --*/
378 ;
379
380 EFI_DEVICE_PATH_PROTOCOL *
381 CreateDeviceNodeProtocolInterface (
382 IN UINT8 NodeType,
383 IN UINT8 NodeSubType,
384 IN UINT16 NodeLength
385 )
386 /*++
387
388 Routine Description:
389 Creates a device node
390
391 Arguments:
392 NodeType - NodeType is the device node type (EFI_DEVICE_PATH.Type) for
393 the new device node.
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.
398
399 Returns:
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.
403
404 --*/
405 ;
406
407 #endif