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