Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / include / ipxe / efi / Protocol / DevicePath.h
1 /** @file
2   The device path protocol as defined in UEFI 2.0.
3
4   The device path represents a programmatic path to a device,
5   from a software point of view. The path must persist from boot to boot, so
6   it can not contain things like PCI bus numbers that change from boot to boot.
7
8 Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
9 This program and the accompanying materials are licensed and made available under
10 the terms and conditions of the BSD License that accompanies this distribution.
11 The full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php.
13
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16
17 **/
18
19 #ifndef __EFI_DEVICE_PATH_PROTOCOL_H__
20 #define __EFI_DEVICE_PATH_PROTOCOL_H__
21
22 FILE_LICENCE ( BSD3 );
23
24 #include <ipxe/efi/Guid/PcAnsi.h>
25
26 ///
27 /// Device Path protocol.
28 ///
29 #define EFI_DEVICE_PATH_PROTOCOL_GUID \
30   { \
31     0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
32   }
33
34 ///
35 /// Device Path guid definition for backward-compatible with EFI1.1.
36 ///
37 #define DEVICE_PATH_PROTOCOL  EFI_DEVICE_PATH_PROTOCOL_GUID
38
39 #pragma pack(1)
40
41 /**
42   This protocol can be used on any device handle to obtain generic path/location
43   information concerning the physical device or logical device. If the handle does
44   not logically map to a physical device, the handle may not necessarily support
45   the device path protocol. The device path describes the location of the device
46   the handle is for. The size of the Device Path can be determined from the structures
47   that make up the Device Path.
48 **/
49 typedef struct {
50   UINT8 Type;       ///< 0x01 Hardware Device Path.
51                     ///< 0x02 ACPI Device Path.
52                     ///< 0x03 Messaging Device Path.
53                     ///< 0x04 Media Device Path.
54                     ///< 0x05 BIOS Boot Specification Device Path.
55                     ///< 0x7F End of Hardware Device Path.
56
57   UINT8 SubType;    ///< Varies by Type
58                     ///< 0xFF End Entire Device Path, or
59                     ///< 0x01 End This Instance of a Device Path and start a new
60                     ///< Device Path.
61
62   UINT8 Length[2];  ///< Specific Device Path data. Type and Sub-Type define
63                     ///< type of data. Size of data is included in Length.
64
65 } EFI_DEVICE_PATH_PROTOCOL;
66
67 ///
68 /// Device Path protocol definition for backward-compatible with EFI1.1.
69 ///
70 typedef EFI_DEVICE_PATH_PROTOCOL  EFI_DEVICE_PATH;
71
72 ///
73 /// Hardware Device Paths.
74 ///
75 #define HARDWARE_DEVICE_PATH      0x01
76
77 ///
78 /// PCI Device Path SubType.
79 ///
80 #define HW_PCI_DP                 0x01
81
82 ///
83 /// PCI Device Path.
84 ///
85 typedef struct {
86   EFI_DEVICE_PATH_PROTOCOL        Header;
87   ///
88   /// PCI Function Number.
89   ///
90   UINT8                           Function;
91   ///
92   /// PCI Device Number.
93   ///
94   UINT8                           Device;
95 } PCI_DEVICE_PATH;
96
97 ///
98 /// PCCARD Device Path SubType.
99 ///
100 #define HW_PCCARD_DP              0x02
101
102 ///
103 /// PCCARD Device Path.
104 ///
105 typedef struct {
106   EFI_DEVICE_PATH_PROTOCOL        Header;
107   ///
108   /// Function Number (0 = First Function).
109   ///
110   UINT8                           FunctionNumber;
111 } PCCARD_DEVICE_PATH;
112
113 ///
114 /// Memory Mapped Device Path SubType.
115 ///
116 #define HW_MEMMAP_DP              0x03
117
118 ///
119 /// Memory Mapped Device Path.
120 ///
121 typedef struct {
122   EFI_DEVICE_PATH_PROTOCOL        Header;
123   ///
124   /// EFI_MEMORY_TYPE
125   ///
126   UINT32                          MemoryType;
127   ///
128   /// Starting Memory Address.
129   ///
130   EFI_PHYSICAL_ADDRESS            StartingAddress;
131   ///
132   /// Ending Memory Address.
133   ///
134   EFI_PHYSICAL_ADDRESS            EndingAddress;
135 } MEMMAP_DEVICE_PATH;
136
137 ///
138 /// Hardware Vendor Device Path SubType.
139 ///
140 #define HW_VENDOR_DP              0x04
141
142 ///
143 /// The Vendor Device Path allows the creation of vendor-defined Device Paths. A vendor must
144 /// allocate a Vendor GUID for a Device Path. The Vendor GUID can then be used to define the
145 /// contents on the n bytes that follow in the Vendor Device Path node.
146 ///
147 typedef struct {
148   EFI_DEVICE_PATH_PROTOCOL        Header;
149   ///
150   /// Vendor-assigned GUID that defines the data that follows.
151   ///
152   EFI_GUID                        Guid;
153   ///
154   /// Vendor-defined variable size data.
155   ///
156 } VENDOR_DEVICE_PATH;
157
158 ///
159 /// Controller Device Path SubType.
160 ///
161 #define HW_CONTROLLER_DP          0x05
162
163 ///
164 /// Controller Device Path.
165 ///
166 typedef struct {
167   EFI_DEVICE_PATH_PROTOCOL        Header;
168   ///
169   /// Controller number.
170   ///
171   UINT32                          ControllerNumber;
172 } CONTROLLER_DEVICE_PATH;
173
174 ///
175 /// ACPI Device Paths.
176 ///
177 #define ACPI_DEVICE_PATH          0x02
178
179 ///
180 /// ACPI Device Path SubType.
181 ///
182 #define ACPI_DP                   0x01
183 typedef struct {
184   EFI_DEVICE_PATH_PROTOCOL        Header;
185   ///
186   /// Device's PnP hardware ID stored in a numeric 32-bit
187   /// compressed EISA-type ID. This value must match the
188   /// corresponding _HID in the ACPI name space.
189   ///
190   UINT32                          HID;
191   ///
192   /// Unique ID that is required by ACPI if two devices have the
193   /// same _HID. This value must also match the corresponding
194   /// _UID/_HID pair in the ACPI name space. Only the 32-bit
195   /// numeric value type of _UID is supported. Thus, strings must
196   /// not be used for the _UID in the ACPI name space.
197   ///
198   UINT32                          UID;
199 } ACPI_HID_DEVICE_PATH;
200
201 ///
202 /// Expanded ACPI Device Path SubType.
203 ///
204 #define ACPI_EXTENDED_DP          0x02
205 typedef struct {
206   EFI_DEVICE_PATH_PROTOCOL        Header;
207   ///
208   /// Device's PnP hardware ID stored in a numeric 32-bit
209   /// compressed EISA-type ID. This value must match the
210   /// corresponding _HID in the ACPI name space.
211   ///
212   UINT32                          HID;
213   ///
214   /// Unique ID that is required by ACPI if two devices have the
215   /// same _HID. This value must also match the corresponding
216   /// _UID/_HID pair in the ACPI name space.
217   ///
218   UINT32                          UID;
219   ///
220   /// Device's compatible PnP hardware ID stored in a numeric
221   /// 32-bit compressed EISA-type ID. This value must match at
222   /// least one of the compatible device IDs returned by the
223   /// corresponding _CID in the ACPI name space.
224   ///
225   UINT32                          CID;
226   ///
227   /// Optional variable length _HIDSTR.
228   /// Optional variable length _UIDSTR.
229   /// Optional variable length _CIDSTR.
230   ///
231 } ACPI_EXTENDED_HID_DEVICE_PATH;
232
233 //
234 //  EISA ID Macro
235 //  EISA ID Definition 32-bits
236 //   bits[15:0] - three character compressed ASCII EISA ID.
237 //   bits[31:16] - binary number
238 //    Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z'
239 //
240 #define PNP_EISA_ID_CONST         0x41d0
241 #define EISA_ID(_Name, _Num)      ((UINT32)((_Name) | (_Num) << 16))
242 #define EISA_PNP_ID(_PNPId)       (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
243 #define EFI_PNP_ID(_PNPId)        (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
244
245 #define PNP_EISA_ID_MASK          0xffff
246 #define EISA_ID_TO_NUM(_Id)       ((_Id) >> 16)
247
248 ///
249 /// ACPI _ADR Device Path SubType.
250 ///
251 #define ACPI_ADR_DP               0x03
252
253 ///
254 /// The _ADR device path is used to contain video output device attributes to support the Graphics
255 /// Output Protocol. The device path can contain multiple _ADR entries if multiple video output
256 /// devices are displaying the same output.
257 ///
258 typedef struct {
259   EFI_DEVICE_PATH_PROTOCOL        Header;
260   ///
261   /// _ADR value. For video output devices the value of this
262   /// field comes from Table B-2 of the ACPI 3.0 specification. At
263   /// least one _ADR value is required.
264   ///
265   UINT32                          ADR;
266   //
267   // This device path may optionally contain more than one _ADR entry.
268   //
269 } ACPI_ADR_DEVICE_PATH;
270
271 #define ACPI_ADR_DISPLAY_TYPE_OTHER             0
272 #define ACPI_ADR_DISPLAY_TYPE_VGA               1
273 #define ACPI_ADR_DISPLAY_TYPE_TV                2
274 #define ACPI_ADR_DISPLAY_TYPE_EXTERNAL_DIGITAL  3
275 #define ACPI_ADR_DISPLAY_TYPE_INTERNAL_DIGITAL  4
276
277 #define ACPI_DISPLAY_ADR(_DeviceIdScheme, _HeadId, _NonVgaOutput, _BiosCanDetect, _VendorInfo, _Type, _Port, _Index) \
278           ((UINT32)( (((_DeviceIdScheme) & 0x1) << 31) |  \
279                       (((_HeadId)         & 0x7) << 18) |  \
280                       (((_NonVgaOutput)   & 0x1) << 17) |  \
281                       (((_BiosCanDetect)  & 0x1) << 16) |  \
282                       (((_VendorInfo)     & 0xf) << 12) |  \
283                       (((_Type)           & 0xf) << 8)  |  \
284                       (((_Port)           & 0xf) << 4)  |  \
285                        ((_Index)          & 0xf) ))
286
287 ///
288 /// Messaging Device Paths.
289 /// This Device Path is used to describe the connection of devices outside the resource domain of the
290 /// system. This Device Path can describe physical messaging information like SCSI ID, or abstract
291 /// information like networking protocol IP addresses.
292 ///
293 #define MESSAGING_DEVICE_PATH     0x03
294
295 ///
296 /// ATAPI Device Path SubType
297 ///
298 #define MSG_ATAPI_DP              0x01
299 typedef struct {
300   EFI_DEVICE_PATH_PROTOCOL        Header;
301   ///
302   /// Set to zero for primary, or one for secondary.
303   ///
304   UINT8                           PrimarySecondary;
305   ///
306   /// Set to zero for master, or one for slave mode.
307   ///
308   UINT8                           SlaveMaster;
309   ///
310   /// Logical Unit Number.
311   ///
312   UINT16                          Lun;
313 } ATAPI_DEVICE_PATH;
314
315 ///
316 /// SCSI Device Path SubType.
317 ///
318 #define MSG_SCSI_DP               0x02
319 typedef struct {
320   EFI_DEVICE_PATH_PROTOCOL        Header;
321   ///
322   /// Target ID on the SCSI bus (PUN).
323   ///
324   UINT16                          Pun;
325   ///
326   /// Logical Unit Number (LUN).
327   ///
328   UINT16                          Lun;
329 } SCSI_DEVICE_PATH;
330
331 ///
332 /// Fibre Channel SubType.
333 ///
334 #define MSG_FIBRECHANNEL_DP       0x03
335 typedef struct {
336   EFI_DEVICE_PATH_PROTOCOL        Header;
337   ///
338   /// Reserved for the future.
339   ///
340   UINT32                          Reserved;
341   ///
342   /// Fibre Channel World Wide Number.
343   ///
344   UINT64                          WWN;
345   ///
346   /// Fibre Channel Logical Unit Number.
347   ///
348   UINT64                          Lun;
349 } FIBRECHANNEL_DEVICE_PATH;
350
351 ///
352 /// Fibre Channel Ex SubType.
353 ///
354 #define MSG_FIBRECHANNELEX_DP     0x15
355 typedef struct {
356   EFI_DEVICE_PATH_PROTOCOL        Header;
357   ///
358   /// Reserved for the future.
359   ///
360   UINT32                          Reserved;
361   ///
362   /// 8 byte array containing Fibre Channel End Device Port Name.
363   ///
364   UINT8                           WWN[8];
365   ///
366   /// 8 byte array containing Fibre Channel Logical Unit Number.
367   ///
368   UINT8                           Lun[8];
369 } FIBRECHANNELEX_DEVICE_PATH;
370
371 ///
372 /// 1394 Device Path SubType
373 ///
374 #define MSG_1394_DP               0x04
375 typedef struct {
376   EFI_DEVICE_PATH_PROTOCOL        Header;
377   ///
378   /// Reserved for the future.
379   ///
380   UINT32                          Reserved;
381   ///
382   /// 1394 Global Unique ID (GUID).
383   ///
384   UINT64                          Guid;
385 } F1394_DEVICE_PATH;
386
387 ///
388 /// USB Device Path SubType.
389 ///
390 #define MSG_USB_DP                0x05
391 typedef struct {
392   EFI_DEVICE_PATH_PROTOCOL      Header;
393   ///
394   /// USB Parent Port Number.
395   ///
396   UINT8                         ParentPortNumber;
397   ///
398   /// USB Interface Number.
399   ///
400   UINT8                         InterfaceNumber;
401 } USB_DEVICE_PATH;
402
403 ///
404 /// USB Class Device Path SubType.
405 ///
406 #define MSG_USB_CLASS_DP          0x0f
407 typedef struct {
408   EFI_DEVICE_PATH_PROTOCOL      Header;
409   ///
410   /// Vendor ID assigned by USB-IF. A value of 0xFFFF will
411   /// match any Vendor ID.
412   ///
413   UINT16                        VendorId;
414   ///
415   /// Product ID assigned by USB-IF. A value of 0xFFFF will
416   /// match any Product ID.
417   ///
418   UINT16                        ProductId;
419   ///
420   /// The class code assigned by the USB-IF. A value of 0xFF
421   /// will match any class code.
422   ///
423   UINT8                         DeviceClass;
424   ///
425   /// The subclass code assigned by the USB-IF. A value of
426   /// 0xFF will match any subclass code.
427   ///
428   UINT8                         DeviceSubClass;
429   ///
430   /// The protocol code assigned by the USB-IF. A value of
431   /// 0xFF will match any protocol code.
432   ///
433   UINT8                         DeviceProtocol;
434 } USB_CLASS_DEVICE_PATH;
435
436 ///
437 /// USB WWID Device Path SubType.
438 ///
439 #define MSG_USB_WWID_DP           0x10
440
441 ///
442 /// This device path describes a USB device using its serial number.
443 ///
444 typedef struct {
445   EFI_DEVICE_PATH_PROTOCOL      Header;
446   ///
447   /// USB interface number.
448   ///
449   UINT16                        InterfaceNumber;
450   ///
451   /// USB vendor id of the device.
452   ///
453   UINT16                        VendorId;
454   ///
455   /// USB product id of the device.
456   ///
457   UINT16                        ProductId;
458   ///
459   /// Last 64-or-fewer UTF-16 characters of the USB
460   /// serial number. The length of the string is
461   /// determined by the Length field less the offset of the
462   /// Serial Number field (10)
463   ///
464   /// CHAR16                     SerialNumber[...];
465 } USB_WWID_DEVICE_PATH;
466
467 ///
468 /// Device Logical Unit SubType.
469 ///
470 #define MSG_DEVICE_LOGICAL_UNIT_DP  0x11
471 typedef struct {
472   EFI_DEVICE_PATH_PROTOCOL      Header;
473   ///
474   /// Logical Unit Number for the interface.
475   ///
476   UINT8                         Lun;
477 } DEVICE_LOGICAL_UNIT_DEVICE_PATH;
478
479 ///
480 /// SATA Device Path SubType.
481 ///
482 #define MSG_SATA_DP               0x12
483 typedef struct {
484   EFI_DEVICE_PATH_PROTOCOL        Header;
485   ///
486   /// The HBA port number that facilitates the connection to the
487   /// device or a port multiplier. The value 0xFFFF is reserved.
488   ///
489   UINT16                          HBAPortNumber;
490   ///
491   /// The Port multiplier port number that facilitates the connection
492   /// to the device. Bit 15 should be set if the device is directly
493   /// connected to the HBA.
494   ///
495   UINT16                          PortMultiplierPortNumber;
496   ///
497   /// Logical Unit Number.
498   ///
499   UINT16                          Lun;
500 } SATA_DEVICE_PATH;
501
502 ///
503 /// Flag for if the device is directly connected to the HBA.
504 ///
505 #define SATA_HBA_DIRECT_CONNECT_FLAG 0x8000
506
507 ///
508 /// I2O Device Path SubType.
509 ///
510 #define MSG_I2O_DP                0x06
511 typedef struct {
512   EFI_DEVICE_PATH_PROTOCOL        Header;
513   ///
514   /// Target ID (TID) for a device.
515   ///
516   UINT32                          Tid;
517 } I2O_DEVICE_PATH;
518
519 ///
520 /// MAC Address Device Path SubType.
521 ///
522 #define MSG_MAC_ADDR_DP           0x0b
523 typedef struct {
524   EFI_DEVICE_PATH_PROTOCOL        Header;
525   ///
526   /// The MAC address for a network interface padded with 0s.
527   ///
528   EFI_MAC_ADDRESS                 MacAddress;
529   ///
530   /// Network interface type(i.e. 802.3, FDDI).
531   ///
532   UINT8                           IfType;
533 } MAC_ADDR_DEVICE_PATH;
534
535 ///
536 /// IPv4 Device Path SubType
537 ///
538 #define MSG_IPv4_DP               0x0c
539 typedef struct {
540   EFI_DEVICE_PATH_PROTOCOL        Header;
541   ///
542   /// The local IPv4 address.
543   ///
544   EFI_IPv4_ADDRESS                LocalIpAddress;
545   ///
546   /// The remote IPv4 address.
547   ///
548   EFI_IPv4_ADDRESS                RemoteIpAddress;
549   ///
550   /// The local port number.
551   ///
552   UINT16                          LocalPort;
553   ///
554   /// The remote port number.
555   ///
556   UINT16                          RemotePort;
557   ///
558   /// The network protocol(i.e. UDP, TCP).
559   ///
560   UINT16                          Protocol;
561   ///
562   /// 0x00 - The Source IP Address was assigned though DHCP.
563   /// 0x01 - The Source IP Address is statically bound.
564   ///
565   BOOLEAN                         StaticIpAddress;
566   ///
567   /// The gateway IP address
568   ///
569   EFI_IPv4_ADDRESS                GatewayIpAddress;
570   ///
571   /// The subnet mask
572   ///
573   EFI_IPv4_ADDRESS                SubnetMask;
574 } IPv4_DEVICE_PATH;
575
576 ///
577 /// IPv6 Device Path SubType.
578 ///
579 #define MSG_IPv6_DP               0x0d
580 typedef struct {
581   EFI_DEVICE_PATH_PROTOCOL        Header;
582   ///
583   /// The local IPv6 address.
584   ///
585   EFI_IPv6_ADDRESS                LocalIpAddress;
586   ///
587   /// The remote IPv6 address.
588   ///
589   EFI_IPv6_ADDRESS                RemoteIpAddress;
590   ///
591   /// The local port number.
592   ///
593   UINT16                          LocalPort;
594   ///
595   /// The remote port number.
596   ///
597   UINT16                          RemotePort;
598   ///
599   /// The network protocol(i.e. UDP, TCP).
600   ///
601   UINT16                          Protocol;
602   ///
603   /// 0x00 - The Local IP Address was manually configured.
604   /// 0x01 - The Local IP Address is assigned through IPv6
605   /// stateless auto-configuration.
606   /// 0x02 - The Local IP Address is assigned through IPv6
607   /// stateful configuration.
608   ///
609   UINT8                           IpAddressOrigin;
610   ///
611   /// The prefix length
612   ///
613   UINT8                           PrefixLength;
614   ///
615   /// The gateway IP address
616   ///
617   EFI_IPv6_ADDRESS                GatewayIpAddress;
618 } IPv6_DEVICE_PATH;
619
620 ///
621 /// InfiniBand Device Path SubType.
622 ///
623 #define MSG_INFINIBAND_DP         0x09
624 typedef struct {
625   EFI_DEVICE_PATH_PROTOCOL        Header;
626   ///
627   /// Flags to help identify/manage InfiniBand device path elements:
628   /// Bit 0 - IOC/Service (0b = IOC, 1b = Service).
629   /// Bit 1 - Extend Boot Environment.
630   /// Bit 2 - Console Protocol.
631   /// Bit 3 - Storage Protocol.
632   /// Bit 4 - Network Protocol.
633   /// All other bits are reserved.
634   ///
635   UINT32                          ResourceFlags;
636   ///
637   /// 128-bit Global Identifier for remote fabric port.
638   ///
639   UINT8                           PortGid[16];
640   ///
641   /// 64-bit unique identifier to remote IOC or server process.
642   /// Interpretation of field specified by Resource Flags (bit 0).
643   ///
644   UINT64                          ServiceId;
645   ///
646   /// 64-bit persistent ID of remote IOC port.
647   ///
648   UINT64                          TargetPortId;
649   ///
650   /// 64-bit persistent ID of remote device.
651   ///
652   UINT64                          DeviceId;
653 } INFINIBAND_DEVICE_PATH;
654
655 #define INFINIBAND_RESOURCE_FLAG_IOC_SERVICE                0x01
656 #define INFINIBAND_RESOURCE_FLAG_EXTENDED_BOOT_ENVIRONMENT  0x02
657 #define INFINIBAND_RESOURCE_FLAG_CONSOLE_PROTOCOL           0x04
658 #define INFINIBAND_RESOURCE_FLAG_STORAGE_PROTOCOL           0x08
659 #define INFINIBAND_RESOURCE_FLAG_NETWORK_PROTOCOL           0x10
660
661 ///
662 /// UART Device Path SubType.
663 ///
664 #define MSG_UART_DP               0x0e
665 typedef struct {
666   EFI_DEVICE_PATH_PROTOCOL        Header;
667   ///
668   /// Reserved.
669   ///
670   UINT32                          Reserved;
671   ///
672   /// The baud rate setting for the UART style device. A value of 0
673   /// means that the device's default baud rate will be used.
674   ///
675   UINT64                          BaudRate;
676   ///
677   /// The number of data bits for the UART style device. A value
678   /// of 0 means that the device's default number of data bits will be used.
679   ///
680   UINT8                           DataBits;
681   ///
682   /// The parity setting for the UART style device.
683   /// Parity 0x00 - Default Parity.
684   /// Parity 0x01 - No Parity.
685   /// Parity 0x02 - Even Parity.
686   /// Parity 0x03 - Odd Parity.
687   /// Parity 0x04 - Mark Parity.
688   /// Parity 0x05 - Space Parity.
689   ///
690   UINT8                           Parity;
691   ///
692   /// The number of stop bits for the UART style device.
693   /// Stop Bits 0x00 - Default Stop Bits.
694   /// Stop Bits 0x01 - 1 Stop Bit.
695   /// Stop Bits 0x02 - 1.5 Stop Bits.
696   /// Stop Bits 0x03 - 2 Stop Bits.
697   ///
698   UINT8                           StopBits;
699 } UART_DEVICE_PATH;
700
701 //
702 // Use VENDOR_DEVICE_PATH struct
703 //
704 #define MSG_VENDOR_DP             0x0a
705 typedef VENDOR_DEVICE_PATH        VENDOR_DEFINED_DEVICE_PATH;
706
707 #define DEVICE_PATH_MESSAGING_PC_ANSI     EFI_PC_ANSI_GUID
708 #define DEVICE_PATH_MESSAGING_VT_100      EFI_VT_100_GUID
709 #define DEVICE_PATH_MESSAGING_VT_100_PLUS EFI_VT_100_PLUS_GUID
710 #define DEVICE_PATH_MESSAGING_VT_UTF8     EFI_VT_UTF8_GUID
711
712 ///
713 /// A new device path node is defined to declare flow control characteristics.
714 /// UART Flow Control Messaging Device Path
715 ///
716 typedef struct {
717   EFI_DEVICE_PATH_PROTOCOL        Header;
718   ///
719   /// DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL GUID.
720   ///
721   EFI_GUID                        Guid;
722   ///
723   /// Bitmap of supported flow control types.
724   /// Bit 0 set indicates hardware flow control.
725   /// Bit 1 set indicates Xon/Xoff flow control.
726   /// All other bits are reserved and are clear.
727   ///
728   UINT32                          FlowControlMap;
729 } UART_FLOW_CONTROL_DEVICE_PATH;
730
731 #define UART_FLOW_CONTROL_HARDWARE         0x00000001
732 #define UART_FLOW_CONTROL_XON_XOFF         0x00000010
733
734 #define DEVICE_PATH_MESSAGING_SAS          EFI_SAS_DEVICE_PATH_GUID
735 ///
736 /// Serial Attached SCSI (SAS) Device Path.
737 ///
738 typedef struct {
739   EFI_DEVICE_PATH_PROTOCOL        Header;
740   ///
741   /// DEVICE_PATH_MESSAGING_SAS GUID.
742   ///
743   EFI_GUID                        Guid;
744   ///
745   /// Reserved for future use.
746   ///
747   UINT32                          Reserved;
748   ///
749   /// SAS Address for Serial Attached SCSI Target.
750   ///
751   UINT64                          SasAddress;
752   ///
753   /// SAS Logical Unit Number.
754   ///
755   UINT64                          Lun;
756   ///
757   /// More Information about the device and its interconnect.
758   ///
759   UINT16                          DeviceTopology;
760   ///
761   /// Relative Target Port (RTP).
762   ///
763   UINT16                          RelativeTargetPort;
764 } SAS_DEVICE_PATH;
765
766 ///
767 /// Serial Attached SCSI (SAS) Ex Device Path SubType
768 ///
769 #define MSG_SASEX_DP              0x16
770 typedef struct {
771   EFI_DEVICE_PATH_PROTOCOL        Header;
772   ///
773   /// 8-byte array of the SAS Address for Serial Attached SCSI Target Port.
774   ///
775   UINT8                           SasAddress[8];
776   ///
777   /// 8-byte array of the SAS Logical Unit Number.
778   ///
779   UINT8                           Lun[8];
780   ///
781   /// More Information about the device and its interconnect.
782   ///
783   UINT16                          DeviceTopology;
784   ///
785   /// Relative Target Port (RTP).
786   ///
787   UINT16                          RelativeTargetPort;
788 } SASEX_DEVICE_PATH;
789
790 ///
791 /// NvmExpress Namespace Device Path SubType.
792 ///
793 #define MSG_NVME_NAMESPACE_DP     0x17
794 typedef struct {
795   EFI_DEVICE_PATH_PROTOCOL        Header;
796   UINT32                          NamespaceId;
797   UINT64                          NamespaceUuid;
798 } NVME_NAMESPACE_DEVICE_PATH;
799
800 ///
801 /// iSCSI Device Path SubType
802 ///
803 #define MSG_ISCSI_DP              0x13
804 typedef struct {
805   EFI_DEVICE_PATH_PROTOCOL        Header;
806   ///
807   /// Network Protocol (0 = TCP, 1+ = reserved).
808   ///
809   UINT16                          NetworkProtocol;
810   ///
811   /// iSCSI Login Options.
812   ///
813   UINT16                          LoginOption;
814   ///
815   /// iSCSI Logical Unit Number.
816   ///
817   UINT64                          Lun;
818   ///
819   /// iSCSI Target Portal group tag the initiator intends
820   /// to establish a session with.
821   ///
822   UINT16                          TargetPortalGroupTag;
823   ///
824   /// iSCSI NodeTarget Name. The length of the name
825   /// is determined by subtracting the offset of this field from Length.
826   ///
827   /// CHAR8                        iSCSI Target Name.
828 } ISCSI_DEVICE_PATH;
829
830 #define ISCSI_LOGIN_OPTION_NO_HEADER_DIGEST             0x0000
831 #define ISCSI_LOGIN_OPTION_HEADER_DIGEST_USING_CRC32C   0x0002
832 #define ISCSI_LOGIN_OPTION_NO_DATA_DIGEST               0x0000
833 #define ISCSI_LOGIN_OPTION_DATA_DIGEST_USING_CRC32C     0x0008
834 #define ISCSI_LOGIN_OPTION_AUTHMETHOD_CHAP              0x0000
835 #define ISCSI_LOGIN_OPTION_AUTHMETHOD_NON               0x1000
836 #define ISCSI_LOGIN_OPTION_CHAP_BI                      0x0000
837 #define ISCSI_LOGIN_OPTION_CHAP_UNI                     0x2000
838
839 ///
840 /// VLAN Device Path SubType.
841 ///
842 #define MSG_VLAN_DP               0x14
843 typedef struct {
844   EFI_DEVICE_PATH_PROTOCOL        Header;
845   ///
846   /// VLAN identifier (0-4094).
847   ///
848   UINT16                          VlanId;
849 } VLAN_DEVICE_PATH;
850
851 //
852 // Media Device Path
853 //
854 #define MEDIA_DEVICE_PATH         0x04
855
856 ///
857 /// Hard Drive Media Device Path SubType.
858 ///
859 #define MEDIA_HARDDRIVE_DP        0x01
860
861 ///
862 /// The Hard Drive Media Device Path is used to represent a partition on a hard drive.
863 ///
864 typedef struct {
865   EFI_DEVICE_PATH_PROTOCOL        Header;
866   ///
867   /// Describes the entry in a partition table, starting with entry 1.
868   /// Partition number zero represents the entire device. Valid
869   /// partition numbers for a MBR partition are [1, 4]. Valid
870   /// partition numbers for a GPT partition are [1, NumberOfPartitionEntries].
871   ///
872   UINT32                          PartitionNumber;
873   ///
874   /// Starting LBA of the partition on the hard drive.
875   ///
876   UINT64                          PartitionStart;
877   ///
878   /// Size of the partition in units of Logical Blocks.
879   ///
880   UINT64                          PartitionSize;
881   ///
882   /// Signature unique to this partition:
883   /// If SignatureType is 0, this field has to be initialized with 16 zeros.
884   /// If SignatureType is 1, the MBR signature is stored in the first 4 bytes of this field.
885   /// The other 12 bytes are initialized with zeros.
886   /// If SignatureType is 2, this field contains a 16 byte signature.
887   ///
888   UINT8                           Signature[16];
889   ///
890   /// Partition Format: (Unused values reserved).
891   /// 0x01 - PC-AT compatible legacy MBR.
892   /// 0x02 - GUID Partition Table.
893   ///
894   UINT8                           MBRType;
895   ///
896   /// Type of Disk Signature: (Unused values reserved).
897   /// 0x00 - No Disk Signature.
898   /// 0x01 - 32-bit signature from address 0x1b8 of the type 0x01 MBR.
899   /// 0x02 - GUID signature.
900   ///
901   UINT8                           SignatureType;
902 } HARDDRIVE_DEVICE_PATH;
903
904 #define MBR_TYPE_PCAT             0x01
905 #define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02
906
907 #define NO_DISK_SIGNATURE         0x00
908 #define SIGNATURE_TYPE_MBR        0x01
909 #define SIGNATURE_TYPE_GUID       0x02
910
911 ///
912 /// CD-ROM Media Device Path SubType.
913 ///
914 #define MEDIA_CDROM_DP            0x02
915
916 ///
917 /// The CD-ROM Media Device Path is used to define a system partition that exists on a CD-ROM.
918 ///
919 typedef struct {
920   EFI_DEVICE_PATH_PROTOCOL        Header;
921   ///
922   /// Boot Entry number from the Boot Catalog. The Initial/Default entry is defined as zero.
923   ///
924   UINT32                          BootEntry;
925   ///
926   /// Starting RBA of the partition on the medium. CD-ROMs use Relative logical Block Addressing.
927   ///
928   UINT64                          PartitionStart;
929   ///
930   /// Size of the partition in units of Blocks, also called Sectors.
931   ///
932   UINT64                          PartitionSize;
933 } CDROM_DEVICE_PATH;
934
935 //
936 // Use VENDOR_DEVICE_PATH struct
937 //
938 #define MEDIA_VENDOR_DP           0x03  ///< Media vendor device path subtype.
939
940 ///
941 /// File Path Media Device Path SubType
942 ///
943 #define MEDIA_FILEPATH_DP         0x04
944 typedef struct {
945   EFI_DEVICE_PATH_PROTOCOL        Header;
946   ///
947   /// A NULL-terminated Path string including directory and file names.
948   ///
949   CHAR16                          PathName[1];
950 } FILEPATH_DEVICE_PATH;
951
952 #define SIZE_OF_FILEPATH_DEVICE_PATH  OFFSET_OF(FILEPATH_DEVICE_PATH,PathName)
953
954 ///
955 /// Media Protocol Device Path SubType.
956 ///
957 #define MEDIA_PROTOCOL_DP         0x05
958
959 ///
960 /// The Media Protocol Device Path is used to denote the protocol that is being
961 /// used in a device path at the location of the path specified.
962 /// Many protocols are inherent to the style of device path.
963 ///
964 typedef struct {
965   EFI_DEVICE_PATH_PROTOCOL        Header;
966   ///
967   /// The ID of the protocol.
968   ///
969   EFI_GUID                        Protocol;
970 } MEDIA_PROTOCOL_DEVICE_PATH;
971
972 ///
973 /// PIWG Firmware File SubType.
974 ///
975 #define MEDIA_PIWG_FW_FILE_DP     0x06
976
977 ///
978 /// This device path is used by systems implementing the UEFI PI Specification 1.0 to describe a firmware file.
979 ///
980 typedef struct {
981   EFI_DEVICE_PATH_PROTOCOL        Header;
982   ///
983   /// Firmware file name
984   ///
985   EFI_GUID                        FvFileName;
986 } MEDIA_FW_VOL_FILEPATH_DEVICE_PATH;
987
988 ///
989 /// PIWG Firmware Volume Device Path SubType.
990 ///
991 #define MEDIA_PIWG_FW_VOL_DP      0x07
992
993 ///
994 /// This device path is used by systems implementing the UEFI PI Specification 1.0 to describe a firmware volume.
995 ///
996 typedef struct {
997   EFI_DEVICE_PATH_PROTOCOL        Header;
998   ///
999   /// Firmware volume name.
1000   ///
1001   EFI_GUID                        FvName;
1002 } MEDIA_FW_VOL_DEVICE_PATH;
1003
1004 ///
1005 /// Media relative offset range device path.
1006 ///
1007 #define MEDIA_RELATIVE_OFFSET_RANGE_DP 0x08
1008
1009 ///
1010 /// Used to describe the offset range of media relative.
1011 ///
1012 typedef struct {
1013   EFI_DEVICE_PATH_PROTOCOL  Header;
1014   UINT32                    Reserved;
1015   UINT64                    StartingOffset;
1016   UINT64                    EndingOffset;
1017 } MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH;
1018
1019 ///
1020 /// BIOS Boot Specification Device Path.
1021 ///
1022 #define BBS_DEVICE_PATH           0x05
1023
1024 ///
1025 /// BIOS Boot Specification Device Path SubType.
1026 ///
1027 #define BBS_BBS_DP                0x01
1028
1029 ///
1030 /// This Device Path is used to describe the booting of non-EFI-aware operating systems.
1031 ///
1032 typedef struct {
1033   EFI_DEVICE_PATH_PROTOCOL        Header;
1034   ///
1035   /// Device Type as defined by the BIOS Boot Specification.
1036   ///
1037   UINT16                          DeviceType;
1038   ///
1039   /// Status Flags as defined by the BIOS Boot Specification.
1040   ///
1041   UINT16                          StatusFlag;
1042   ///
1043   /// Null-terminated ASCII string that describes the boot device to a user.
1044   ///
1045   CHAR8                           String[1];
1046 } BBS_BBS_DEVICE_PATH;
1047
1048 //
1049 // DeviceType definitions - from BBS specification
1050 //
1051 #define BBS_TYPE_FLOPPY           0x01
1052 #define BBS_TYPE_HARDDRIVE        0x02
1053 #define BBS_TYPE_CDROM            0x03
1054 #define BBS_TYPE_PCMCIA           0x04
1055 #define BBS_TYPE_USB              0x05
1056 #define BBS_TYPE_EMBEDDED_NETWORK 0x06
1057 #define BBS_TYPE_BEV              0x80
1058 #define BBS_TYPE_UNKNOWN          0xFF
1059
1060
1061 ///
1062 /// Union of all possible Device Paths and pointers to Device Paths.
1063 ///
1064 typedef union {
1065   EFI_DEVICE_PATH_PROTOCOL                   DevPath;
1066   PCI_DEVICE_PATH                            Pci;
1067   PCCARD_DEVICE_PATH                         PcCard;
1068   MEMMAP_DEVICE_PATH                         MemMap;
1069   VENDOR_DEVICE_PATH                         Vendor;
1070
1071   CONTROLLER_DEVICE_PATH                     Controller;
1072   ACPI_HID_DEVICE_PATH                       Acpi;
1073   ACPI_EXTENDED_HID_DEVICE_PATH              ExtendedAcpi;
1074   ACPI_ADR_DEVICE_PATH                       AcpiAdr;
1075
1076   ATAPI_DEVICE_PATH                          Atapi;
1077   SCSI_DEVICE_PATH                           Scsi;
1078   ISCSI_DEVICE_PATH                          Iscsi;
1079   FIBRECHANNEL_DEVICE_PATH                   FibreChannel;
1080   FIBRECHANNELEX_DEVICE_PATH                 FibreChannelEx;
1081
1082   F1394_DEVICE_PATH                          F1394;
1083   USB_DEVICE_PATH                            Usb;
1084   SATA_DEVICE_PATH                           Sata;
1085   USB_CLASS_DEVICE_PATH                      UsbClass;
1086   USB_WWID_DEVICE_PATH                       UsbWwid;
1087   DEVICE_LOGICAL_UNIT_DEVICE_PATH            LogicUnit;
1088   I2O_DEVICE_PATH                            I2O;
1089   MAC_ADDR_DEVICE_PATH                       MacAddr;
1090   IPv4_DEVICE_PATH                           Ipv4;
1091   IPv6_DEVICE_PATH                           Ipv6;
1092   VLAN_DEVICE_PATH                           Vlan;
1093   INFINIBAND_DEVICE_PATH                     InfiniBand;
1094   UART_DEVICE_PATH                           Uart;
1095   UART_FLOW_CONTROL_DEVICE_PATH              UartFlowControl;
1096   SAS_DEVICE_PATH                            Sas;
1097   SASEX_DEVICE_PATH                          SasEx;
1098   NVME_NAMESPACE_DEVICE_PATH                 NvmeNamespace;
1099   HARDDRIVE_DEVICE_PATH                      HardDrive;
1100   CDROM_DEVICE_PATH                          CD;
1101
1102   FILEPATH_DEVICE_PATH                       FilePath;
1103   MEDIA_PROTOCOL_DEVICE_PATH                 MediaProtocol;
1104
1105   MEDIA_FW_VOL_DEVICE_PATH                   FirmwareVolume;
1106   MEDIA_FW_VOL_FILEPATH_DEVICE_PATH          FirmwareFile;
1107   MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH    Offset;
1108
1109   BBS_BBS_DEVICE_PATH                        Bbs;
1110 } EFI_DEV_PATH;
1111
1112
1113
1114 typedef union {
1115   EFI_DEVICE_PATH_PROTOCOL                   *DevPath;
1116   PCI_DEVICE_PATH                            *Pci;
1117   PCCARD_DEVICE_PATH                         *PcCard;
1118   MEMMAP_DEVICE_PATH                         *MemMap;
1119   VENDOR_DEVICE_PATH                         *Vendor;
1120
1121   CONTROLLER_DEVICE_PATH                     *Controller;
1122   ACPI_HID_DEVICE_PATH                       *Acpi;
1123   ACPI_EXTENDED_HID_DEVICE_PATH              *ExtendedAcpi;
1124   ACPI_ADR_DEVICE_PATH                       *AcpiAdr;
1125
1126   ATAPI_DEVICE_PATH                          *Atapi;
1127   SCSI_DEVICE_PATH                           *Scsi;
1128   ISCSI_DEVICE_PATH                          *Iscsi;
1129   FIBRECHANNEL_DEVICE_PATH                   *FibreChannel;
1130   FIBRECHANNELEX_DEVICE_PATH                 *FibreChannelEx;
1131
1132   F1394_DEVICE_PATH                          *F1394;
1133   USB_DEVICE_PATH                            *Usb;
1134   SATA_DEVICE_PATH                           *Sata;
1135   USB_CLASS_DEVICE_PATH                      *UsbClass;
1136   USB_WWID_DEVICE_PATH                       *UsbWwid;
1137   DEVICE_LOGICAL_UNIT_DEVICE_PATH            *LogicUnit;
1138   I2O_DEVICE_PATH                            *I2O;
1139   MAC_ADDR_DEVICE_PATH                       *MacAddr;
1140   IPv4_DEVICE_PATH                           *Ipv4;
1141   IPv6_DEVICE_PATH                           *Ipv6;
1142   VLAN_DEVICE_PATH                           *Vlan;
1143   INFINIBAND_DEVICE_PATH                     *InfiniBand;
1144   UART_DEVICE_PATH                           *Uart;
1145   UART_FLOW_CONTROL_DEVICE_PATH              *UartFlowControl;
1146   SAS_DEVICE_PATH                            *Sas;
1147   SASEX_DEVICE_PATH                          *SasEx;
1148   NVME_NAMESPACE_DEVICE_PATH                 *NvmeNamespace;
1149   HARDDRIVE_DEVICE_PATH                      *HardDrive;
1150   CDROM_DEVICE_PATH                          *CD;
1151
1152   FILEPATH_DEVICE_PATH                       *FilePath;
1153   MEDIA_PROTOCOL_DEVICE_PATH                 *MediaProtocol;
1154
1155   MEDIA_FW_VOL_DEVICE_PATH                   *FirmwareVolume;
1156   MEDIA_FW_VOL_FILEPATH_DEVICE_PATH          *FirmwareFile;
1157   MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH    *Offset;
1158
1159   BBS_BBS_DEVICE_PATH                        *Bbs;
1160   UINT8                                      *Raw;
1161 } EFI_DEV_PATH_PTR;
1162
1163 #pragma pack()
1164
1165 #define END_DEVICE_PATH_TYPE                 0x7f
1166 #define END_ENTIRE_DEVICE_PATH_SUBTYPE       0xFF
1167 #define END_INSTANCE_DEVICE_PATH_SUBTYPE     0x01
1168
1169 extern EFI_GUID gEfiDevicePathProtocolGuid;
1170
1171 #endif