Move to directory "Include"
[mirror_edk2.git] / MdePkg / Include / Uefi / UefiDevicePath.h
CommitLineData
959ccb23 1/* @file\r
2 Device Path definitions introduced in UEFI.\r
3\r
4 This include file must only contain things defined in the UEFI 2.0 specification.\r
5 If a code construct is defined in the UEFI 2.0 specification it must be included\r
6 by this include file.\r
7\r
8 Copyright (c) 2006 - 2007, Intel Corporation\r
9 All rights reserved. This program and the accompanying materials\r
10 are licensed and made available under the terms and conditions of the BSD License\r
11 which accompanies this distribution. The full text of the license may be found at\r
12 http://opensource.org/licenses/bsd-license.php\r
13\r
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
16\r
17 Module Name: UefiDevicePath.h\r
18\r
19**/\r
20\r
21#ifndef __UEFI_DEVICE_PATH_H__\r
22#define __UEFI_DEVICE_PATH_H__\r
23\r
24//\r
25// Device Path information\r
26//\r
27\r
28#pragma pack(1)\r
29\r
30//\r
31// Hardware Device Paths\r
32//\r
33#define HARDWARE_DEVICE_PATH 0x01\r
34\r
35#define HW_PCI_DP 0x01\r
36typedef struct {\r
37 EFI_DEVICE_PATH_PROTOCOL Header;\r
38 UINT8 Function;\r
39 UINT8 Device;\r
40} PCI_DEVICE_PATH;\r
41\r
42#define HW_PCCARD_DP 0x02\r
43typedef struct {\r
44 EFI_DEVICE_PATH_PROTOCOL Header;\r
45 UINT8 FunctionNumber;\r
46} PCCARD_DEVICE_PATH;\r
47\r
48#define HW_MEMMAP_DP 0x03\r
49typedef struct {\r
50 EFI_DEVICE_PATH_PROTOCOL Header;\r
51 UINT32 MemoryType;\r
52 EFI_PHYSICAL_ADDRESS StartingAddress;\r
53 EFI_PHYSICAL_ADDRESS EndingAddress;\r
54} MEMMAP_DEVICE_PATH;\r
55\r
56#define HW_VENDOR_DP 0x04\r
57typedef struct {\r
58 EFI_DEVICE_PATH_PROTOCOL Header;\r
59 EFI_GUID Guid;\r
60} VENDOR_DEVICE_PATH;\r
61\r
62#define HW_CONTROLLER_DP 0x05\r
63typedef struct {\r
64 EFI_DEVICE_PATH_PROTOCOL Header;\r
65 UINT32 ControllerNumber;\r
66} CONTROLLER_DEVICE_PATH;\r
67\r
68//\r
69// ACPI Device Paths\r
70//\r
71#define ACPI_DEVICE_PATH 0x02\r
72\r
73#define ACPI_DP 0x01\r
74typedef struct {\r
75 EFI_DEVICE_PATH_PROTOCOL Header;\r
76 UINT32 HID;\r
77 UINT32 UID;\r
78} ACPI_HID_DEVICE_PATH;\r
79\r
80#define ACPI_EXTENDED_DP 0x02\r
81typedef struct {\r
82 EFI_DEVICE_PATH_PROTOCOL Header;\r
83 UINT32 HID;\r
84 UINT32 UID;\r
85 UINT32 CID;\r
86 //\r
87 // Optional variable length _HIDSTR\r
88 // Optional variable length _UIDSTR\r
89 //\r
90} ACPI_EXTENDED_HID_DEVICE_PATH;\r
91\r
92//\r
93// EISA ID Macro\r
94// EISA ID Definition 32-bits\r
95// bits[15:0] - three character compressed ASCII EISA ID.\r
96// bits[31:16] - binary number\r
97// Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z'\r
98//\r
99#define PNP_EISA_ID_CONST 0x41d0\r
100#define EISA_ID(_Name, _Num) ((UINT32) ((_Name) | (_Num) << 16))\r
101#define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))\r
102#define EFI_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))\r
103\r
104#define PNP_EISA_ID_MASK 0xffff\r
105#define EISA_ID_TO_NUM(_Id) ((_Id) >> 16)\r
106\r
107\r
108#define ACPI_ADR_DP 0x03\r
109typedef struct {\r
110 EFI_DEVICE_PATH_PROTOCOL Header;\r
111 UINT32 ADR;\r
112} ACPI_ADR_DEVICE_PATH;\r
113\r
114\r
115//\r
116// Messaging Device Paths\r
117//\r
118#define MESSAGING_DEVICE_PATH 0x03\r
119\r
120#define MSG_ATAPI_DP 0x01\r
121typedef struct {\r
122 EFI_DEVICE_PATH_PROTOCOL Header;\r
123 UINT8 PrimarySecondary;\r
124 UINT8 SlaveMaster;\r
125 UINT16 Lun;\r
126} ATAPI_DEVICE_PATH;\r
127\r
128#define MSG_SCSI_DP 0x02\r
129typedef struct {\r
130 EFI_DEVICE_PATH_PROTOCOL Header;\r
131 UINT16 Pun;\r
132 UINT16 Lun;\r
133} SCSI_DEVICE_PATH;\r
134\r
135#define MSG_FIBRECHANNEL_DP 0x03\r
136typedef struct {\r
137 EFI_DEVICE_PATH_PROTOCOL Header;\r
138 UINT32 Reserved;\r
139 UINT64 WWN;\r
140 UINT64 Lun;\r
141} FIBRECHANNEL_DEVICE_PATH;\r
142\r
143#define MSG_1394_DP 0x04\r
144typedef struct {\r
145 EFI_DEVICE_PATH_PROTOCOL Header;\r
146 UINT32 Reserved;\r
147 UINT64 Guid;\r
148} F1394_DEVICE_PATH;\r
149\r
150#define MSG_USB_DP 0x05\r
151typedef struct {\r
152 EFI_DEVICE_PATH_PROTOCOL Header;\r
153 UINT8 ParentPortNumber;\r
154 UINT8 InterfaceNumber;\r
155} USB_DEVICE_PATH;\r
156\r
157#define MSG_USB_CLASS_DP 0x0f\r
158typedef struct {\r
159 EFI_DEVICE_PATH_PROTOCOL Header;\r
160 UINT16 VendorId;\r
161 UINT16 ProductId;\r
162 UINT8 DeviceClass;\r
163 UINT8 DeviceSubClass;\r
164 UINT8 DeviceProtocol;\r
165} USB_CLASS_DEVICE_PATH;\r
166\r
167#define MSG_USB_WWID_DP 0x10\r
168typedef struct {\r
169 EFI_DEVICE_PATH_PROTOCOL Header;\r
170 UINT16 InterfaceNumber;\r
171 UINT16 VendorId;\r
172 UINT16 ProductId;\r
173 // CHAR16 SerialNumber[...];\r
174} USB_WWID_DEVICE_PATH;\r
175\r
176\r
177#define MSG_DEVICE_LOGICAL_UNIT_DP 0x11\r
178typedef struct {\r
179 EFI_DEVICE_PATH_PROTOCOL Header;\r
180 UINT8 Lun;\r
181} DEVICE_LOGICAL_UNIT_DEVICE_PATH;\r
182\r
183#define MSG_SATA_DP 0x12\r
184typedef struct {\r
185 EFI_DEVICE_PATH_PROTOCOL Header;\r
186 UINT16 HbaPortNumber;\r
187 UINT16 PortMultiplierPort;\r
188 UINT16 LogicalUnitNumber;\r
189} SATA_DEVICE_PATH;\r
190\r
191#define MSG_I2O_DP 0x06\r
192typedef struct {\r
193 EFI_DEVICE_PATH_PROTOCOL Header;\r
194 UINT32 Tid;\r
195} I2O_DEVICE_PATH;\r
196\r
197#define MSG_MAC_ADDR_DP 0x0b\r
198typedef struct {\r
199 EFI_DEVICE_PATH_PROTOCOL Header;\r
200 EFI_MAC_ADDRESS MacAddress;\r
201 UINT8 IfType;\r
202} MAC_ADDR_DEVICE_PATH;\r
203\r
204#define MSG_IPv4_DP 0x0c\r
205typedef struct {\r
206 EFI_DEVICE_PATH_PROTOCOL Header;\r
207 EFI_IPv4_ADDRESS LocalIpAddress;\r
208 EFI_IPv4_ADDRESS RemoteIpAddress;\r
209 UINT16 LocalPort;\r
210 UINT16 RemotePort;\r
211 UINT16 Protocol;\r
212 BOOLEAN StaticIpAddress;\r
213} IPv4_DEVICE_PATH;\r
214\r
215#define MSG_IPv6_DP 0x0d\r
216typedef struct {\r
217 EFI_DEVICE_PATH_PROTOCOL Header;\r
218 EFI_IPv6_ADDRESS LocalIpAddress;\r
219 EFI_IPv6_ADDRESS RemoteIpAddress;\r
220 UINT16 LocalPort;\r
221 UINT16 RemotePort;\r
222 UINT16 Protocol;\r
223 BOOLEAN StaticIpAddress;\r
224} IPv6_DEVICE_PATH;\r
225\r
226#define MSG_INFINIBAND_DP 0x09\r
227typedef struct {\r
228 EFI_DEVICE_PATH_PROTOCOL Header;\r
229 UINT32 ResourceFlags;\r
230 UINT8 PortGid[16];\r
231 UINT64 ServiceId;\r
232 UINT64 TargetPortId;\r
233 UINT64 DeviceId;\r
234} INFINIBAND_DEVICE_PATH;\r
235\r
236#define INFINIBAND_RESOURCE_FLAG_IOC_SERVICE 0x01\r
237#define INFINIBAND_RESOURCE_FLAG_EXTENDED_BOOT_ENVIRONMENT 0x02\r
238#define INFINIBAND_RESOURCE_FLAG_CONSOLE_PROTOCOL 0x04\r
239#define INFINIBAND_RESOURCE_FLAG_STORAGE_PROTOCOL 0x08\r
240#define INFINIBAND_RESOURCE_FLAG_NETWORK_PROTOCOL 0x10\r
241\r
242#define MSG_UART_DP 0x0e\r
243typedef struct {\r
244 EFI_DEVICE_PATH_PROTOCOL Header;\r
245 UINT32 Reserved;\r
246 UINT64 BaudRate;\r
247 UINT8 DataBits;\r
248 UINT8 Parity;\r
249 UINT8 StopBits;\r
250} UART_DEVICE_PATH;\r
251\r
252//\r
253// Use VENDOR_DEVICE_PATH struct\r
254//\r
255#define MSG_VENDOR_DP 0x0a\r
256typedef VENDOR_DEVICE_PATH VENDOR_DEFINED_DEVICE_PATH;\r
257\r
258#define DEVICE_PATH_MESSAGING_PC_ANSI EFI_PC_ANSI_GUID\r
259#define DEVICE_PATH_MESSAGING_VT_100 EFI_VT_100_GUID\r
260#define DEVICE_PATH_MESSAGING_VT_100_PLUS EFI_VT_100_PLUS_GUID\r
261#define DEVICE_PATH_MESSAGING_VT_UTF8 EFI_VT_UTF8_GUID\r
262\r
263#define DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL EFI_UART_DEVICE_PATH_GUID\r
264\r
265typedef struct {\r
266 EFI_DEVICE_PATH_PROTOCOL Header;\r
267 EFI_GUID Guid;\r
268 UINT32 FlowControlMap;\r
269} UART_FLOW_CONTROL_DEVICE_PATH;\r
270\r
271#define DEVICE_PATH_MESSAGING_SAS EFI_SAS_DEVICE_PATH_GUID\r
272\r
273typedef struct {\r
274 EFI_DEVICE_PATH_PROTOCOL Header;\r
275 EFI_GUID Guid;\r
276 UINT32 Reserved;\r
277 UINT64 SasAddress;\r
278 UINT64 Lun;\r
279 UINT16 DeviceTopology;\r
280 UINT16 RelativeTargetPort;\r
281} SAS_DEVICE_PATH;\r
282\r
283#define MSG_ISCSI_DP 0x13\r
284typedef struct {\r
285 EFI_DEVICE_PATH_PROTOCOL Header;\r
286 UINT16 NetworkProtocol;\r
287 UINT16 LoginOption;\r
288 UINT16 Reserved;\r
289 UINT16 TargetPortalGroupTag;\r
290 UINT64 LUN;\r
291 // CHAR8 iSCSI Target Name\r
292} ISCSI_DEVICE_PATH;\r
293\r
294#define ISCSI_LOGIN_OPTION_NO_HEADER_DIGEST 0x0000\r
295#define ISCSI_LOGIN_OPTION_HEADER_DIGEST_USING_CRC32C 0x0002\r
296#define ISCSI_LOGIN_OPTION_NO_DATA_DIGEST 0x0000\r
297#define ISCSI_LOGIN_OPTION_DATA_DIGEST_USING_CRC32C 0x0008\r
298#define ISCSI_LOGIN_OPTION_AUTHMETHOD_CHAP 0x0000\r
299#define ISCSI_LOGIN_OPTION_AUTHMETHOD_NON 0x1000\r
300#define ISCSI_LOGIN_OPTION_CHAP_BI 0x0000\r
301#define ISCSI_LOGIN_OPTION_CHAP_UNI 0x2000\r
302\r
303//\r
304// Media Device Path\r
305//\r
306#define MEDIA_DEVICE_PATH 0x04\r
307\r
308#define MEDIA_HARDDRIVE_DP 0x01\r
309typedef struct {\r
310 EFI_DEVICE_PATH_PROTOCOL Header;\r
311 UINT32 PartitionNumber;\r
312 UINT64 PartitionStart;\r
313 UINT64 PartitionSize;\r
314 UINT8 Signature[16];\r
315 UINT8 MBRType;\r
316 UINT8 SignatureType;\r
317} HARDDRIVE_DEVICE_PATH;\r
318\r
319#define MBR_TYPE_PCAT 0x01\r
320#define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02\r
321\r
322#define SIGNATURE_TYPE_MBR 0x01\r
323#define SIGNATURE_TYPE_GUID 0x02\r
324\r
325#define MEDIA_CDROM_DP 0x02\r
326typedef struct {\r
327 EFI_DEVICE_PATH_PROTOCOL Header;\r
328 UINT32 BootEntry;\r
329 UINT64 PartitionStart;\r
330 UINT64 PartitionSize;\r
331} CDROM_DEVICE_PATH;\r
332\r
333//\r
334// Use VENDOR_DEVICE_PATH struct\r
335//\r
336#define MEDIA_VENDOR_DP 0x03\r
337\r
338#define MEDIA_FILEPATH_DP 0x04\r
339typedef struct {\r
340 EFI_DEVICE_PATH_PROTOCOL Header;\r
341 CHAR16 PathName[1];\r
342} FILEPATH_DEVICE_PATH;\r
343\r
344#define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName)\r
345\r
346#define MEDIA_PROTOCOL_DP 0x05\r
347typedef struct {\r
348 EFI_DEVICE_PATH_PROTOCOL Header;\r
349 EFI_GUID Protocol;\r
350} MEDIA_PROTOCOL_DEVICE_PATH;\r
351\r
352\r
353#define MEDIA_PIWG_FW_VOL_DP 0x6\r
354typedef MEDIA_PROTOCOL_DEVICE_PATH MEDIA_FW_VOL_FILEPATH_DEVICE_PATH;\r
355\r
356\r
357#define MEDIA_PIWG_FW_FILE_DP 0x7\r
358typedef MEDIA_PROTOCOL_DEVICE_PATH MEDIA_FW_VOL_DEVICE_PATH;\r
359\r
360//\r
361// BBS Device Path\r
362//\r
363#define BBS_DEVICE_PATH 0x05\r
364#define BBS_BBS_DP 0x01\r
365typedef struct {\r
366 EFI_DEVICE_PATH_PROTOCOL Header;\r
367 UINT16 DeviceType;\r
368 UINT16 StatusFlag;\r
369 CHAR8 String[1];\r
370} BBS_BBS_DEVICE_PATH;\r
371\r
372//\r
373// DeviceType definitions - from BBS specification\r
374//\r
375#define BBS_TYPE_FLOPPY 0x01\r
376#define BBS_TYPE_HARDDRIVE 0x02\r
377#define BBS_TYPE_CDROM 0x03\r
378#define BBS_TYPE_PCMCIA 0x04\r
379#define BBS_TYPE_USB 0x05\r
380#define BBS_TYPE_EMBEDDED_NETWORK 0x06\r
381#define BBS_TYPE_BEV 0x80\r
382#define BBS_TYPE_UNKNOWN 0xFF\r
383\r
384\r
385//\r
386// Union of all possible Device Paths and pointers to Device Paths\r
387//\r
388\r
389typedef union {\r
390 EFI_DEVICE_PATH_PROTOCOL DevPath;\r
391 PCI_DEVICE_PATH Pci;\r
392 PCCARD_DEVICE_PATH PcCard;\r
393 MEMMAP_DEVICE_PATH MemMap;\r
394 VENDOR_DEVICE_PATH Vendor;\r
395\r
396 CONTROLLER_DEVICE_PATH Controller;\r
397 ACPI_HID_DEVICE_PATH Acpi;\r
398\r
399 ATAPI_DEVICE_PATH Atapi;\r
400 SCSI_DEVICE_PATH Scsi;\r
401 FIBRECHANNEL_DEVICE_PATH FibreChannel;\r
402\r
403 F1394_DEVICE_PATH F1394;\r
404 USB_DEVICE_PATH Usb;\r
405 SATA_DEVICE_PATH Sata;\r
406 USB_CLASS_DEVICE_PATH UsbClass;\r
407 I2O_DEVICE_PATH I2O;\r
408 MAC_ADDR_DEVICE_PATH MacAddr;\r
409 IPv4_DEVICE_PATH Ipv4;\r
410 IPv6_DEVICE_PATH Ipv6;\r
411 INFINIBAND_DEVICE_PATH InfiniBand;\r
412 UART_DEVICE_PATH Uart;\r
413\r
414 HARDDRIVE_DEVICE_PATH HardDrive;\r
415 CDROM_DEVICE_PATH CD;\r
416\r
417 FILEPATH_DEVICE_PATH FilePath;\r
418 MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol;\r
419\r
420 BBS_BBS_DEVICE_PATH Bbs;\r
421} EFI_DEV_PATH;\r
422\r
423\r
424\r
425typedef union {\r
426 EFI_DEVICE_PATH_PROTOCOL *DevPath;\r
427 PCI_DEVICE_PATH *Pci;\r
428 PCCARD_DEVICE_PATH *PcCard;\r
429 MEMMAP_DEVICE_PATH *MemMap;\r
430 VENDOR_DEVICE_PATH *Vendor;\r
431\r
432 CONTROLLER_DEVICE_PATH *Controller;\r
433 ACPI_HID_DEVICE_PATH *Acpi;\r
434 ACPI_EXTENDED_HID_DEVICE_PATH *ExtendedAcpi;\r
435\r
436 ATAPI_DEVICE_PATH *Atapi;\r
437 SCSI_DEVICE_PATH *Scsi;\r
438 FIBRECHANNEL_DEVICE_PATH *FibreChannel;\r
439\r
440 F1394_DEVICE_PATH *F1394;\r
441 USB_DEVICE_PATH *Usb;\r
442 SATA_DEVICE_PATH *Sata;\r
443 USB_CLASS_DEVICE_PATH *UsbClass;\r
444 I2O_DEVICE_PATH *I2O;\r
445 MAC_ADDR_DEVICE_PATH *MacAddr;\r
446 IPv4_DEVICE_PATH *Ipv4;\r
447 IPv6_DEVICE_PATH *Ipv6;\r
448 INFINIBAND_DEVICE_PATH *InfiniBand;\r
449 UART_DEVICE_PATH *Uart;\r
450\r
451 HARDDRIVE_DEVICE_PATH *HardDrive;\r
452 CDROM_DEVICE_PATH *CD;\r
453\r
454 FILEPATH_DEVICE_PATH *FilePath;\r
455 MEDIA_PROTOCOL_DEVICE_PATH *MediaProtocol;\r
456\r
457 BBS_BBS_DEVICE_PATH *Bbs;\r
458 UINT8 *Raw;\r
459} EFI_DEV_PATH_PTR;\r
460\r
461#pragma pack()\r
462\r
463\r
464#endif\r
465 \r
466\r