xref: /DragonStub/inc/efidevp.h (revision 7993cbcc72d7b3293455b40e2a9ab3c2a3e38da3)
1530d68baSNigel Croxon #ifndef _DEVPATH_H
2530d68baSNigel Croxon #define _DEVPATH_H
3530d68baSNigel Croxon 
4530d68baSNigel Croxon /*++
5530d68baSNigel Croxon 
6530d68baSNigel Croxon Copyright (c) 1998  Intel Corporation
7530d68baSNigel Croxon 
8530d68baSNigel Croxon Module Name:
9530d68baSNigel Croxon 
10530d68baSNigel Croxon     devpath.h
11530d68baSNigel Croxon 
12530d68baSNigel Croxon Abstract:
13530d68baSNigel Croxon 
14530d68baSNigel Croxon     Defines for parsing the EFI Device Path structures
15530d68baSNigel Croxon 
16530d68baSNigel Croxon 
17530d68baSNigel Croxon 
18530d68baSNigel Croxon Revision History
19530d68baSNigel Croxon 
20530d68baSNigel Croxon --*/
21530d68baSNigel Croxon 
22530d68baSNigel Croxon //
23530d68baSNigel Croxon // Device Path structures - Section C
24530d68baSNigel Croxon //
25530d68baSNigel Croxon 
261b10394eSNigel Croxon typedef struct _EFI_DEVICE_PATH_PROTOCOL {
27530d68baSNigel Croxon         UINT8                           Type;
28530d68baSNigel Croxon         UINT8                           SubType;
29530d68baSNigel Croxon         UINT8                           Length[2];
301b10394eSNigel Croxon } EFI_DEVICE_PATH_PROTOCOL;
311b10394eSNigel Croxon 
321b10394eSNigel Croxon typedef struct _EFI_DEVICE_PATH_PROTOCOL _EFI_DEVICE_PATH;
331b10394eSNigel Croxon typedef EFI_DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH;
34530d68baSNigel Croxon 
35530d68baSNigel Croxon #define EFI_DP_TYPE_MASK                    0x7F
36530d68baSNigel Croxon #define EFI_DP_TYPE_UNPACKED                0x80
37530d68baSNigel Croxon 
38530d68baSNigel Croxon //#define END_DEVICE_PATH_TYPE                0xff
39530d68baSNigel Croxon #define END_DEVICE_PATH_TYPE                0x7f
40530d68baSNigel Croxon //#define END_DEVICE_PATH_TYPE_UNPACKED       0x7f
41530d68baSNigel Croxon 
42530d68baSNigel Croxon #define END_ENTIRE_DEVICE_PATH_SUBTYPE      0xff
43530d68baSNigel Croxon #define END_INSTANCE_DEVICE_PATH_SUBTYPE    0x01
441b10394eSNigel Croxon #define END_DEVICE_PATH_LENGTH              (sizeof(EFI_DEVICE_PATH_PROTOCOL))
45530d68baSNigel Croxon 
46530d68baSNigel Croxon 
47530d68baSNigel Croxon #define DP_IS_END_TYPE(a)
48530d68baSNigel Croxon #define DP_IS_END_SUBTYPE(a)        ( ((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE )
49530d68baSNigel Croxon 
50530d68baSNigel Croxon #define DevicePathType(a)           ( ((a)->Type) & EFI_DP_TYPE_MASK )
51530d68baSNigel Croxon #define DevicePathSubType(a)        ( (a)->SubType )
52530d68baSNigel Croxon #define DevicePathNodeLength(a)     ( ((a)->Length[0]) | ((a)->Length[1] << 8) )
531b10394eSNigel Croxon #define NextDevicePathNode(a)       ( (EFI_DEVICE_PATH_PROTOCOL *) ( ((UINT8 *) (a)) + DevicePathNodeLength(a)))
54530d68baSNigel Croxon //#define IsDevicePathEndType(a)      ( DevicePathType(a) == END_DEVICE_PATH_TYPE_UNPACKED )
55530d68baSNigel Croxon #define IsDevicePathEndType(a)      ( DevicePathType(a) == END_DEVICE_PATH_TYPE )
56530d68baSNigel Croxon #define IsDevicePathEndSubType(a)   ( (a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE )
57530d68baSNigel Croxon #define IsDevicePathEnd(a)          ( IsDevicePathEndType(a) && IsDevicePathEndSubType(a) )
58530d68baSNigel Croxon #define IsDevicePathUnpacked(a)     ( (a)->Type & EFI_DP_TYPE_UNPACKED )
59530d68baSNigel Croxon 
60530d68baSNigel Croxon 
61530d68baSNigel Croxon #define SetDevicePathNodeLength(a,l) {                  \
62530d68baSNigel Croxon             (a)->Length[0] = (UINT8) (l);               \
63530d68baSNigel Croxon             (a)->Length[1] = (UINT8) ((l) >> 8);        \
64530d68baSNigel Croxon             }
65530d68baSNigel Croxon 
66530d68baSNigel Croxon #define SetDevicePathEndNode(a)  {                      \
67530d68baSNigel Croxon             (a)->Type = END_DEVICE_PATH_TYPE;           \
68530d68baSNigel Croxon             (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE;     \
691b10394eSNigel Croxon             (a)->Length[0] = sizeof(EFI_DEVICE_PATH_PROTOCOL); \
70530d68baSNigel Croxon             (a)->Length[1] = 0;                         \
71530d68baSNigel Croxon             }
72530d68baSNigel Croxon 
73530d68baSNigel Croxon 
74530d68baSNigel Croxon /*
75530d68baSNigel Croxon  * Hardware Device Path (UEFI 2.4 specification, version 2.4 § 9.3.2.)
76530d68baSNigel Croxon  */
77530d68baSNigel Croxon 
78530d68baSNigel Croxon #define HARDWARE_DEVICE_PATH            0x01
79530d68baSNigel Croxon 
80530d68baSNigel Croxon #define HW_PCI_DP                       0x01
81530d68baSNigel Croxon typedef struct _PCI_DEVICE_PATH {
821b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
83530d68baSNigel Croxon         UINT8                           Function;
84530d68baSNigel Croxon         UINT8                           Device;
85530d68baSNigel Croxon } PCI_DEVICE_PATH;
86530d68baSNigel Croxon 
87530d68baSNigel Croxon #define HW_PCCARD_DP                    0x02
88530d68baSNigel Croxon typedef struct _PCCARD_DEVICE_PATH {
891b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
90530d68baSNigel Croxon         UINT8                           FunctionNumber ;
91530d68baSNigel Croxon } PCCARD_DEVICE_PATH;
92530d68baSNigel Croxon 
93530d68baSNigel Croxon #define HW_MEMMAP_DP                    0x03
94530d68baSNigel Croxon typedef struct _MEMMAP_DEVICE_PATH {
951b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
96530d68baSNigel Croxon         UINT32                          MemoryType;
97530d68baSNigel Croxon         EFI_PHYSICAL_ADDRESS            StartingAddress;
98530d68baSNigel Croxon         EFI_PHYSICAL_ADDRESS            EndingAddress;
99530d68baSNigel Croxon } MEMMAP_DEVICE_PATH;
100530d68baSNigel Croxon 
101530d68baSNigel Croxon #define HW_VENDOR_DP                    0x04
102530d68baSNigel Croxon typedef struct _VENDOR_DEVICE_PATH {
1031b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
104530d68baSNigel Croxon         EFI_GUID                        Guid;
105530d68baSNigel Croxon } VENDOR_DEVICE_PATH;
106530d68baSNigel Croxon 
107530d68baSNigel Croxon #define UNKNOWN_DEVICE_GUID \
108530d68baSNigel Croxon     { 0xcf31fac5, 0xc24e, 0x11d2,  {0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b}  }
109530d68baSNigel Croxon 
110530d68baSNigel Croxon typedef struct _UKNOWN_DEVICE_VENDOR_DP {
111530d68baSNigel Croxon     VENDOR_DEVICE_PATH      DevicePath;
112530d68baSNigel Croxon     UINT8                   LegacyDriveLetter;
113530d68baSNigel Croxon } UNKNOWN_DEVICE_VENDOR_DEVICE_PATH;
114530d68baSNigel Croxon 
115530d68baSNigel Croxon #define HW_CONTROLLER_DP            0x05
116530d68baSNigel Croxon typedef struct _CONTROLLER_DEVICE_PATH {
1171b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL  Header;
118530d68baSNigel Croxon         UINT32                    Controller;
119530d68baSNigel Croxon } CONTROLLER_DEVICE_PATH;
120530d68baSNigel Croxon 
121530d68baSNigel Croxon 
122530d68baSNigel Croxon /*
123530d68baSNigel Croxon  * ACPI Device Path (UEFI 2.4 specification, version 2.4 § 9.3.3 and 9.3.4.)
124530d68baSNigel Croxon  */
125530d68baSNigel Croxon #define ACPI_DEVICE_PATH                 0x02
126530d68baSNigel Croxon 
127530d68baSNigel Croxon #define ACPI_DP                         0x01
128530d68baSNigel Croxon typedef struct _ACPI_HID_DEVICE_PATH {
1291b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
130530d68baSNigel Croxon         UINT32                          HID;
131530d68baSNigel Croxon         UINT32                          UID;
132530d68baSNigel Croxon } ACPI_HID_DEVICE_PATH;
133530d68baSNigel Croxon 
134530d68baSNigel Croxon #define EXPANDED_ACPI_DP		0x02
135530d68baSNigel Croxon typedef struct _EXPANDED_ACPI_HID_DEVICE_PATH {
1361b10394eSNigel Croxon 	EFI_DEVICE_PATH_PROTOCOL	Header;
137530d68baSNigel Croxon 	UINT32				HID;
138530d68baSNigel Croxon 	UINT32				UID;
139530d68baSNigel Croxon 	UINT32				CID;
140530d68baSNigel Croxon 	UINT8				HidStr[1];
141530d68baSNigel Croxon } EXPANDED_ACPI_HID_DEVICE_PATH;
142530d68baSNigel Croxon 
143530d68baSNigel Croxon #define ACPI_ADR_DP 3
144530d68baSNigel Croxon typedef struct _ACPI_ADR_DEVICE_PATH {
1451b10394eSNigel Croxon     EFI_DEVICE_PATH_PROTOCOL Header ;
146530d68baSNigel Croxon     UINT32 ADR ;
147530d68baSNigel Croxon } ACPI_ADR_DEVICE_PATH ;
148530d68baSNigel Croxon 
149530d68baSNigel Croxon //
150530d68baSNigel Croxon // EISA ID Macro
151530d68baSNigel Croxon // EISA ID Definition 32-bits
152530d68baSNigel Croxon //  bits[15:0] - three character compressed ASCII EISA ID.
153530d68baSNigel Croxon //  bits[31:16] - binary number
154530d68baSNigel Croxon //   Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z'
155530d68baSNigel Croxon //
156530d68baSNigel Croxon #define PNP_EISA_ID_CONST       0x41d0
157530d68baSNigel Croxon #define EISA_ID(_Name, _Num)    ((UINT32) ((_Name) | (_Num) << 16))
158530d68baSNigel Croxon #define EISA_PNP_ID(_PNPId)     (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
159530d68baSNigel Croxon 
160530d68baSNigel Croxon #define PNP_EISA_ID_MASK        0xffff
161530d68baSNigel Croxon #define EISA_ID_TO_NUM(_Id)     ((_Id) >> 16)
162530d68baSNigel Croxon 
163530d68baSNigel Croxon 
164530d68baSNigel Croxon /*
165530d68baSNigel Croxon  * Messaging Device Path (UEFI 2.4 specification, version 2.4 § 9.3.5.)
166530d68baSNigel Croxon  */
167530d68baSNigel Croxon #define MESSAGING_DEVICE_PATH           0x03
168530d68baSNigel Croxon 
169530d68baSNigel Croxon #define MSG_ATAPI_DP                    0x01
170530d68baSNigel Croxon typedef struct _ATAPI_DEVICE_PATH {
1711b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
172530d68baSNigel Croxon         UINT8                           PrimarySecondary;
173530d68baSNigel Croxon         UINT8                           SlaveMaster;
174530d68baSNigel Croxon         UINT16                          Lun;
175530d68baSNigel Croxon } ATAPI_DEVICE_PATH;
176530d68baSNigel Croxon 
177530d68baSNigel Croxon #define MSG_SCSI_DP                     0x02
178530d68baSNigel Croxon typedef struct _SCSI_DEVICE_PATH {
1791b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
180530d68baSNigel Croxon         UINT16                          Pun;
181530d68baSNigel Croxon         UINT16                          Lun;
182530d68baSNigel Croxon } SCSI_DEVICE_PATH;
183530d68baSNigel Croxon 
184530d68baSNigel Croxon #define MSG_FIBRECHANNEL_DP             0x03
185530d68baSNigel Croxon typedef struct _FIBRECHANNEL_DEVICE_PATH {
1861b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
187530d68baSNigel Croxon         UINT32                          Reserved;
188530d68baSNigel Croxon         UINT64                          WWN;
189530d68baSNigel Croxon         UINT64                          Lun;
190530d68baSNigel Croxon } FIBRECHANNEL_DEVICE_PATH;
191530d68baSNigel Croxon 
192530d68baSNigel Croxon /**
193530d68baSNigel Croxon  * Fibre Channel Ex SubType.
194530d68baSNigel Croxon  * UEFI 2.0 specification version 2.4 § 9.3.5.6.
195530d68baSNigel Croxon  */
196530d68baSNigel Croxon #define MSG_FIBRECHANNELEX_DP 21
197530d68baSNigel Croxon typedef struct _FIBRECHANNELEX_DEVICE_PATH {
1981b10394eSNigel Croxon     EFI_DEVICE_PATH_PROTOCOL Header ;
199530d68baSNigel Croxon     UINT32 Reserved ;
200530d68baSNigel Croxon     UINT8 WWN[ 8 ] ; /* World Wide Name */
201530d68baSNigel Croxon     UINT8 Lun[ 8 ] ; /* Logical unit, T-10 SCSI Architecture Model 4 specification */
202530d68baSNigel Croxon } FIBRECHANNELEX_DEVICE_PATH ;
203530d68baSNigel Croxon 
204530d68baSNigel Croxon #define MSG_1394_DP                     0x04
205530d68baSNigel Croxon typedef struct _F1394_DEVICE_PATH {
2061b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
207530d68baSNigel Croxon         UINT32                          Reserved;
208530d68baSNigel Croxon         UINT64                          Guid;
209530d68baSNigel Croxon } F1394_DEVICE_PATH;
210530d68baSNigel Croxon 
211530d68baSNigel Croxon #define MSG_USB_DP                      0x05
212530d68baSNigel Croxon typedef struct _USB_DEVICE_PATH {
2131b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
214530d68baSNigel Croxon         UINT8                           Port;
215530d68baSNigel Croxon         UINT8                           Endpoint;
216530d68baSNigel Croxon } USB_DEVICE_PATH;
217530d68baSNigel Croxon 
218530d68baSNigel Croxon /**
219530d68baSNigel Croxon  * SATA Device Path SubType.
220530d68baSNigel Croxon  * UEFI 2.0 specification version 2.4 § 9.3.5.6.
221530d68baSNigel Croxon  */
222530d68baSNigel Croxon #define MSG_SATA_DP 18
223530d68baSNigel Croxon typedef struct _SATA_DEVICE_PATH {
2241b10394eSNigel Croxon     EFI_DEVICE_PATH_PROTOCOL Header ;
225530d68baSNigel Croxon     UINT16 HBAPortNumber ;
226530d68baSNigel Croxon     UINT16 PortMultiplierPortNumber ;
227530d68baSNigel Croxon     UINT16 Lun ; /* Logical Unit Number */
228530d68baSNigel Croxon } SATA_DEVICE_PATH ;
229530d68baSNigel Croxon 
230530d68baSNigel Croxon /**
231530d68baSNigel Croxon  * USB WWID Device Path SubType.
232530d68baSNigel Croxon  * UEFI 2.0 specification version 2.4 § 9.3.5.7.
233530d68baSNigel Croxon  */
234530d68baSNigel Croxon #define MSG_USB_WWID_DP 16
235530d68baSNigel Croxon typedef struct _USB_WWID_DEVICE_PATH {
2361b10394eSNigel Croxon     EFI_DEVICE_PATH_PROTOCOL Header ;
237530d68baSNigel Croxon     UINT16 InterfaceNumber ;
238530d68baSNigel Croxon     UINT16 VendorId ;
239530d68baSNigel Croxon     UINT16 ProductId ;
240530d68baSNigel Croxon     CHAR16 SerialNumber[ 1 ] ; /* UTF-16 characters of the USB serial number */
241530d68baSNigel Croxon } USB_WWID_DEVICE_PATH ;
242530d68baSNigel Croxon 
243530d68baSNigel Croxon /**
244530d68baSNigel Croxon  * Device Logical Unit SubType.
245530d68baSNigel Croxon  * UEFI 2.0 specification version 2.4 § 9.3.5.8.
246530d68baSNigel Croxon  */
247530d68baSNigel Croxon #define MSG_DEVICE_LOGICAL_UNIT_DP 17
248530d68baSNigel Croxon typedef struct _DEVICE_LOGICAL_UNIT_DEVICE_PATH {
2491b10394eSNigel Croxon     EFI_DEVICE_PATH_PROTOCOL Header ;
250530d68baSNigel Croxon     UINT8 Lun ; /* Logical Unit Number */
251530d68baSNigel Croxon } DEVICE_LOGICAL_UNIT_DEVICE_PATH ;
252530d68baSNigel Croxon 
253530d68baSNigel Croxon #define MSG_USB_CLASS_DP                0x0F
254530d68baSNigel Croxon typedef struct _USB_CLASS_DEVICE_PATH {
2551b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
256530d68baSNigel Croxon         UINT16                          VendorId;
257530d68baSNigel Croxon         UINT16                          ProductId;
258530d68baSNigel Croxon         UINT8                           DeviceClass;
259530d68baSNigel Croxon         UINT8                           DeviceSubclass;
260530d68baSNigel Croxon         UINT8                           DeviceProtocol;
261530d68baSNigel Croxon } USB_CLASS_DEVICE_PATH;
262530d68baSNigel Croxon 
263530d68baSNigel Croxon #define MSG_I2O_DP                      0x06
264530d68baSNigel Croxon typedef struct _I2O_DEVICE_PATH {
2651b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
266530d68baSNigel Croxon         UINT32                          Tid;
267530d68baSNigel Croxon } I2O_DEVICE_PATH;
268530d68baSNigel Croxon 
269530d68baSNigel Croxon #define MSG_MAC_ADDR_DP                 0x0b
270530d68baSNigel Croxon typedef struct _MAC_ADDR_DEVICE_PATH {
2711b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
272530d68baSNigel Croxon         EFI_MAC_ADDRESS                 MacAddress;
273530d68baSNigel Croxon         UINT8                           IfType;
274530d68baSNigel Croxon } MAC_ADDR_DEVICE_PATH;
275530d68baSNigel Croxon 
276530d68baSNigel Croxon #define MSG_IPv4_DP                     0x0c
277530d68baSNigel Croxon typedef struct _IPv4_DEVICE_PATH {
2781b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
279530d68baSNigel Croxon         EFI_IPv4_ADDRESS                LocalIpAddress;
280530d68baSNigel Croxon         EFI_IPv4_ADDRESS                RemoteIpAddress;
281530d68baSNigel Croxon         UINT16                          LocalPort;
282530d68baSNigel Croxon         UINT16                          RemotePort;
283530d68baSNigel Croxon         UINT16                          Protocol;
284530d68baSNigel Croxon         BOOLEAN                         StaticIpAddress;
285530d68baSNigel Croxon         /* new from UEFI version 2, code must check Length field in Header */
286530d68baSNigel Croxon         EFI_IPv4_ADDRESS                GatewayIpAddress ;
287530d68baSNigel Croxon         EFI_IPv4_ADDRESS                SubnetMask ;
288530d68baSNigel Croxon } IPv4_DEVICE_PATH;
289530d68baSNigel Croxon 
290530d68baSNigel Croxon #define MSG_IPv6_DP                     0x0d
291530d68baSNigel Croxon typedef struct _IPv6_DEVICE_PATH {
2921b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
293530d68baSNigel Croxon         EFI_IPv6_ADDRESS                LocalIpAddress;
294530d68baSNigel Croxon         EFI_IPv6_ADDRESS                RemoteIpAddress;
295530d68baSNigel Croxon         UINT16                          LocalPort;
296530d68baSNigel Croxon         UINT16                          RemotePort;
297530d68baSNigel Croxon         UINT16                          Protocol;
298530d68baSNigel Croxon         BOOLEAN                         IPAddressOrigin ;
299530d68baSNigel Croxon         /* new from UEFI version 2, code must check Length field in Header */
300530d68baSNigel Croxon         UINT8                           PrefixLength ;
301530d68baSNigel Croxon         EFI_IPv6_ADDRESS                GatewayIpAddress ;
302530d68baSNigel Croxon } IPv6_DEVICE_PATH;
303530d68baSNigel Croxon 
304ad7f0d4bSNigel Croxon 
305ad7f0d4bSNigel Croxon /**
306ad7f0d4bSNigel Croxon  * Uniform Resource Identifiers SubType.
307ad7f0d4bSNigel Croxon  * UEFI 2.0 specification version 2.4C § 9.3.5.23.
308ad7f0d4bSNigel Croxon  */
309ad7f0d4bSNigel Croxon #define MSG_URI_DP                      24
310ad7f0d4bSNigel Croxon typedef struct _URI_DEVICE_PATH {
3111b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
312ad7f0d4bSNigel Croxon         CHAR8                           Uri[1];
313ad7f0d4bSNigel Croxon } URI_DEVICE_PATH;
314ad7f0d4bSNigel Croxon 
315530d68baSNigel Croxon /**
316530d68baSNigel Croxon  * Device Logical Unit SubType.
317530d68baSNigel Croxon  * UEFI 2.0 specification version 2.4 § 9.3.5.8.
318530d68baSNigel Croxon  */
319530d68baSNigel Croxon #define MSG_VLAN_DP 20
320530d68baSNigel Croxon typedef struct _VLAN_DEVICE_PATH {
3211b10394eSNigel Croxon     EFI_DEVICE_PATH_PROTOCOL Header ;
322530d68baSNigel Croxon     UINT16 VlanId ;
323530d68baSNigel Croxon } VLAN_DEVICE_PATH;
324530d68baSNigel Croxon 
325530d68baSNigel Croxon #define MSG_INFINIBAND_DP               0x09
326530d68baSNigel Croxon typedef struct _INFINIBAND_DEVICE_PATH {
3271b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
328530d68baSNigel Croxon         UINT32                          ResourceFlags ;
329530d68baSNigel Croxon         UINT64                          PortGid ;
330530d68baSNigel Croxon         UINT64                          ServiceId ;
331530d68baSNigel Croxon         UINT64                          TargetPortId ;
332530d68baSNigel Croxon         UINT64                          DeviceId ;
333530d68baSNigel Croxon } INFINIBAND_DEVICE_PATH;
334530d68baSNigel Croxon 
335530d68baSNigel Croxon #define MSG_UART_DP                     0x0e
336530d68baSNigel Croxon typedef struct _UART_DEVICE_PATH {
3371b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
338530d68baSNigel Croxon         UINT32                          Reserved;
339530d68baSNigel Croxon         UINT64                          BaudRate;
340530d68baSNigel Croxon         UINT8                           DataBits;
341530d68baSNigel Croxon         UINT8                           Parity;
342530d68baSNigel Croxon         UINT8                           StopBits;
343530d68baSNigel Croxon } UART_DEVICE_PATH;
344530d68baSNigel Croxon 
345530d68baSNigel Croxon #define MSG_VENDOR_DP                   0x0A
346530d68baSNigel Croxon /* Use VENDOR_DEVICE_PATH struct */
347530d68baSNigel Croxon 
348530d68baSNigel Croxon #define DEVICE_PATH_MESSAGING_PC_ANSI \
349530d68baSNigel Croxon     { 0xe0c14753, 0xf9be, 0x11d2,  {0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d}  }
350530d68baSNigel Croxon 
351530d68baSNigel Croxon #define DEVICE_PATH_MESSAGING_VT_100 \
352530d68baSNigel Croxon     { 0xdfa66065, 0xb419, 0x11d3,  {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d}  }
353530d68baSNigel Croxon 
354530d68baSNigel Croxon #define DEVICE_PATH_MESSAGING_VT_100_PLUS \
355530d68baSNigel Croxon     { 0x7baec70b , 0x57e0 , 0x4c76 , { 0x8e , 0x87 , 0x2f , 0x9e , 0x28 , 0x08 , 0x83 , 0x43 } }
356530d68baSNigel Croxon 
357530d68baSNigel Croxon #define DEVICE_PATH_MESSAGING_VT_UTF8 \
358530d68baSNigel Croxon     { 0xad15a0d6 , 0x8bec , 0x4acf , { 0xa0 , 0x73 , 0xd0 , 0x1d , 0xe7 , 0x7e , 0x2d , 0x88 } }
359530d68baSNigel Croxon 
360530d68baSNigel Croxon #define EFI_PC_ANSI_GUID \
361530d68baSNigel Croxon     { 0xe0c14753 , 0xf9be , 0x11d2 , 0x9a , 0x0c , 0x00 , 0x90 , 0x27 , 0x3f , 0xc1 , 0x4d }
362530d68baSNigel Croxon 
363530d68baSNigel Croxon #define EFI_VT_100_GUID \
364530d68baSNigel Croxon     { 0xdfa66065 , 0xb419 , 0x11d3 , 0x9a , 0x2d , 0x00 , 0x90 , 0x27 , 0x3f , 0xc1 , 0x4d }
365530d68baSNigel Croxon 
366530d68baSNigel Croxon #define EFI_VT_100_PLUS_GUID \
367530d68baSNigel Croxon     { 0x7baec70b , 0x57e0 , 0x4c76 , 0x8e , 0x87 , 0x2f , 0x9e , 0x28 , 0x08 , 0x83 , 0x43 }
368530d68baSNigel Croxon 
369530d68baSNigel Croxon #define EFI_VT_UTF8_GUID \
370530d68baSNigel Croxon     { 0xad15a0d6 , 0x8bec , 0x4acf , 0xa0 , 0x73 , 0xd0 , 0x1d , 0xe7 , 0x7e , 0x2d , 0x88 }
371530d68baSNigel Croxon 
372530d68baSNigel Croxon 
373530d68baSNigel Croxon /*
374530d68baSNigel Croxon  * Media Device Path (UEFI 2.4 specification, version 2.4 § 9.3.6.)
375530d68baSNigel Croxon  */
376530d68baSNigel Croxon #define MEDIA_DEVICE_PATH               0x04
377530d68baSNigel Croxon 
378530d68baSNigel Croxon #define MEDIA_HARDDRIVE_DP              0x01
379530d68baSNigel Croxon typedef struct _HARDDRIVE_DEVICE_PATH {
3801b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
381530d68baSNigel Croxon         UINT32                          PartitionNumber;
382530d68baSNigel Croxon         UINT64                          PartitionStart;
383530d68baSNigel Croxon         UINT64                          PartitionSize;
384530d68baSNigel Croxon         UINT8                           Signature[16];
385530d68baSNigel Croxon         UINT8                           MBRType;
386530d68baSNigel Croxon         UINT8                           SignatureType;
387530d68baSNigel Croxon } HARDDRIVE_DEVICE_PATH;
388530d68baSNigel Croxon 
389530d68baSNigel Croxon #define MBR_TYPE_PCAT                       0x01
390530d68baSNigel Croxon #define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02
391530d68baSNigel Croxon 
392530d68baSNigel Croxon #define SIGNATURE_TYPE_MBR                  0x01
393530d68baSNigel Croxon #define SIGNATURE_TYPE_GUID                 0x02
394530d68baSNigel Croxon 
395530d68baSNigel Croxon #define MEDIA_CDROM_DP                  0x02
396530d68baSNigel Croxon typedef struct _CDROM_DEVICE_PATH {
3971b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
398530d68baSNigel Croxon         UINT32                          BootEntry;
399530d68baSNigel Croxon         UINT64                          PartitionStart;
400530d68baSNigel Croxon         UINT64                          PartitionSize;
401530d68baSNigel Croxon } CDROM_DEVICE_PATH;
402530d68baSNigel Croxon 
403530d68baSNigel Croxon #define MEDIA_VENDOR_DP                 0x03
404530d68baSNigel Croxon /* Use VENDOR_DEVICE_PATH struct */
405530d68baSNigel Croxon 
406530d68baSNigel Croxon #define MEDIA_FILEPATH_DP               0x04
407530d68baSNigel Croxon typedef struct _FILEPATH_DEVICE_PATH {
4081b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
409530d68baSNigel Croxon         CHAR16                          PathName[1];
410530d68baSNigel Croxon } FILEPATH_DEVICE_PATH;
411530d68baSNigel Croxon 
412530d68baSNigel Croxon #define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName)
413530d68baSNigel Croxon 
414530d68baSNigel Croxon #define MEDIA_PROTOCOL_DP               0x05
415530d68baSNigel Croxon typedef struct _MEDIA_PROTOCOL_DEVICE_PATH {
4161b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
417530d68baSNigel Croxon         EFI_GUID                        Protocol;
418530d68baSNigel Croxon } MEDIA_PROTOCOL_DEVICE_PATH;
419530d68baSNigel Croxon 
420530d68baSNigel Croxon /**
421530d68baSNigel Croxon  * PIWG Firmware File SubType.
422530d68baSNigel Croxon  * UEFI 2.0 specification version 2.4 § 9.3.6.6.
423530d68baSNigel Croxon  */
424530d68baSNigel Croxon #define MEDIA_PIWG_FW_FILE_DP 6
425530d68baSNigel Croxon typedef struct _MEDIA_FW_VOL_FILEPATH_DEVICE_PATH {
4261b10394eSNigel Croxon     EFI_DEVICE_PATH_PROTOCOL Header ;
427530d68baSNigel Croxon     EFI_GUID FvFileName ;
428530d68baSNigel Croxon } MEDIA_FW_VOL_FILEPATH_DEVICE_PATH ;
429530d68baSNigel Croxon 
430530d68baSNigel Croxon /**
431530d68baSNigel Croxon  * PIWG Firmware Volume Device Path SubType.
432530d68baSNigel Croxon  * UEFI 2.0 specification version 2.4 § 9.3.6.7.
433530d68baSNigel Croxon  */
434530d68baSNigel Croxon #define MEDIA_PIWG_FW_VOL_DP 7
435530d68baSNigel Croxon typedef struct _MEDIA_FW_VOL_DEVICE_PATH {
4361b10394eSNigel Croxon     EFI_DEVICE_PATH_PROTOCOL Header ;
437530d68baSNigel Croxon     EFI_GUID FvName ;
438530d68baSNigel Croxon } MEDIA_FW_VOL_DEVICE_PATH ;
439530d68baSNigel Croxon 
440530d68baSNigel Croxon /**
441530d68baSNigel Croxon  * Media relative offset range device path.
442530d68baSNigel Croxon  * UEFI 2.0 specification version 2.4 § 9.3.6.8.
443530d68baSNigel Croxon  */
444530d68baSNigel Croxon #define MEDIA_RELATIVE_OFFSET_RANGE_DP 8
445530d68baSNigel Croxon typedef struct _MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH {
4461b10394eSNigel Croxon     EFI_DEVICE_PATH_PROTOCOL Header ;
447530d68baSNigel Croxon     UINT32 Reserved ;
448530d68baSNigel Croxon     UINT64 StartingOffset ;
449530d68baSNigel Croxon     UINT64 EndingOffset ;
450530d68baSNigel Croxon } MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH ;
451530d68baSNigel Croxon 
452530d68baSNigel Croxon 
453530d68baSNigel Croxon /*
454530d68baSNigel Croxon  * BIOS Boot Specification Device Path (UEFI 2.4 specification, version 2.4 § 9.3.7.)
455530d68baSNigel Croxon  */
456530d68baSNigel Croxon #define BBS_DEVICE_PATH                 0x05
457530d68baSNigel Croxon 
458530d68baSNigel Croxon #define BBS_BBS_DP                      0x01
459530d68baSNigel Croxon typedef struct _BBS_BBS_DEVICE_PATH {
4601b10394eSNigel Croxon         EFI_DEVICE_PATH_PROTOCOL        Header;
461530d68baSNigel Croxon         UINT16                          DeviceType;
462530d68baSNigel Croxon         UINT16                          StatusFlag;
463530d68baSNigel Croxon         CHAR8                           String[1];
464530d68baSNigel Croxon } BBS_BBS_DEVICE_PATH;
465530d68baSNigel Croxon 
466530d68baSNigel Croxon /* DeviceType definitions - from BBS specification */
467530d68baSNigel Croxon #define BBS_TYPE_FLOPPY                 0x01
468530d68baSNigel Croxon #define BBS_TYPE_HARDDRIVE              0x02
469530d68baSNigel Croxon #define BBS_TYPE_CDROM                  0x03
470530d68baSNigel Croxon #define BBS_TYPE_PCMCIA                 0x04
471530d68baSNigel Croxon #define BBS_TYPE_USB                    0x05
472530d68baSNigel Croxon #define BBS_TYPE_EMBEDDED_NETWORK       0x06
473530d68baSNigel Croxon #define BBS_TYPE_DEV                    0x80
474530d68baSNigel Croxon #define BBS_TYPE_UNKNOWN                0xFF
475530d68baSNigel Croxon 
476530d68baSNigel Croxon typedef union {
4771b10394eSNigel Croxon     EFI_DEVICE_PATH_PROTOCOL             DevPath;
478530d68baSNigel Croxon     PCI_DEVICE_PATH                      Pci;
479530d68baSNigel Croxon     PCCARD_DEVICE_PATH                   PcCard;
480530d68baSNigel Croxon     MEMMAP_DEVICE_PATH                   MemMap;
481530d68baSNigel Croxon     VENDOR_DEVICE_PATH                   Vendor;
482530d68baSNigel Croxon     UNKNOWN_DEVICE_VENDOR_DEVICE_PATH    UnknownVendor;
483530d68baSNigel Croxon     CONTROLLER_DEVICE_PATH               Controller;
484530d68baSNigel Croxon     ACPI_HID_DEVICE_PATH                 Acpi;
485530d68baSNigel Croxon 
486530d68baSNigel Croxon     ATAPI_DEVICE_PATH                    Atapi;
487530d68baSNigel Croxon     SCSI_DEVICE_PATH                     Scsi;
488530d68baSNigel Croxon     FIBRECHANNEL_DEVICE_PATH             FibreChannel;
489530d68baSNigel Croxon 
490530d68baSNigel Croxon     F1394_DEVICE_PATH                    F1394;
491530d68baSNigel Croxon     USB_DEVICE_PATH                      Usb;
492530d68baSNigel Croxon     USB_CLASS_DEVICE_PATH                UsbClass;
493530d68baSNigel Croxon     I2O_DEVICE_PATH                      I2O;
494530d68baSNigel Croxon     MAC_ADDR_DEVICE_PATH                 MacAddr;
495530d68baSNigel Croxon     IPv4_DEVICE_PATH                     Ipv4;
496530d68baSNigel Croxon     IPv6_DEVICE_PATH                     Ipv6;
497fbcdcf56SNigel Croxon     URI_DEVICE_PATH                      Uri;
498530d68baSNigel Croxon     INFINIBAND_DEVICE_PATH               InfiniBand;
499530d68baSNigel Croxon     UART_DEVICE_PATH                     Uart;
500530d68baSNigel Croxon 
501530d68baSNigel Croxon     HARDDRIVE_DEVICE_PATH                HardDrive;
502530d68baSNigel Croxon     CDROM_DEVICE_PATH                    CD;
503530d68baSNigel Croxon 
504530d68baSNigel Croxon     FILEPATH_DEVICE_PATH                 FilePath;
505530d68baSNigel Croxon     MEDIA_PROTOCOL_DEVICE_PATH           MediaProtocol;
506530d68baSNigel Croxon 
507530d68baSNigel Croxon     BBS_BBS_DEVICE_PATH                  Bbs;
508530d68baSNigel Croxon 
509530d68baSNigel Croxon } EFI_DEV_PATH;
510530d68baSNigel Croxon 
511530d68baSNigel Croxon typedef union {
5121b10394eSNigel Croxon     EFI_DEVICE_PATH_PROTOCOL             *DevPath;
513530d68baSNigel Croxon     PCI_DEVICE_PATH                      *Pci;
514530d68baSNigel Croxon     PCCARD_DEVICE_PATH                   *PcCard;
515530d68baSNigel Croxon     MEMMAP_DEVICE_PATH                   *MemMap;
516530d68baSNigel Croxon     VENDOR_DEVICE_PATH                   *Vendor;
517530d68baSNigel Croxon     UNKNOWN_DEVICE_VENDOR_DEVICE_PATH    *UnknownVendor;
518530d68baSNigel Croxon     CONTROLLER_DEVICE_PATH               *Controller;
519530d68baSNigel Croxon     ACPI_HID_DEVICE_PATH                 *Acpi;
520530d68baSNigel Croxon 
521530d68baSNigel Croxon     ATAPI_DEVICE_PATH                    *Atapi;
522530d68baSNigel Croxon     SCSI_DEVICE_PATH                     *Scsi;
523530d68baSNigel Croxon     FIBRECHANNEL_DEVICE_PATH             *FibreChannel;
524530d68baSNigel Croxon 
525530d68baSNigel Croxon     F1394_DEVICE_PATH                    *F1394;
526530d68baSNigel Croxon     USB_DEVICE_PATH                      *Usb;
527530d68baSNigel Croxon     USB_CLASS_DEVICE_PATH                *UsbClass;
528530d68baSNigel Croxon     I2O_DEVICE_PATH                      *I2O;
529530d68baSNigel Croxon     MAC_ADDR_DEVICE_PATH                 *MacAddr;
530530d68baSNigel Croxon     IPv4_DEVICE_PATH                     *Ipv4;
531530d68baSNigel Croxon     IPv6_DEVICE_PATH                     *Ipv6;
532fbcdcf56SNigel Croxon     URI_DEVICE_PATH                      *Uri;
533530d68baSNigel Croxon     INFINIBAND_DEVICE_PATH               *InfiniBand;
534530d68baSNigel Croxon     UART_DEVICE_PATH                     *Uart;
535530d68baSNigel Croxon 
536530d68baSNigel Croxon     HARDDRIVE_DEVICE_PATH                *HardDrive;
537530d68baSNigel Croxon 
538530d68baSNigel Croxon     FILEPATH_DEVICE_PATH                 *FilePath;
539530d68baSNigel Croxon     MEDIA_PROTOCOL_DEVICE_PATH           *MediaProtocol;
540530d68baSNigel Croxon 
541530d68baSNigel Croxon     CDROM_DEVICE_PATH                    *CD;
542530d68baSNigel Croxon     BBS_BBS_DEVICE_PATH                  *Bbs;
543530d68baSNigel Croxon 
544530d68baSNigel Croxon } EFI_DEV_PATH_PTR;
545530d68baSNigel Croxon 
546*7993cbccSNigel Croxon #define EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID \
547*7993cbccSNigel Croxon   { 0x8b843e20, 0x8132, 0x4852, {0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c} }
548*7993cbccSNigel Croxon 
549*7993cbccSNigel Croxon typedef
550*7993cbccSNigel Croxon CHAR16*
551*7993cbccSNigel Croxon (EFIAPI *EFI_DEVICE_PATH_TO_TEXT_NODE) (
552*7993cbccSNigel Croxon     IN CONST EFI_DEVICE_PATH_PROTOCOL    *DeviceNode,
553*7993cbccSNigel Croxon     IN BOOLEAN                           DisplayOnly,
554*7993cbccSNigel Croxon     IN BOOLEAN                           AllowShortcuts
555*7993cbccSNigel Croxon     );
556*7993cbccSNigel Croxon 
557*7993cbccSNigel Croxon typedef
558*7993cbccSNigel Croxon CHAR16*
559*7993cbccSNigel Croxon (EFIAPI *EFI_DEVICE_PATH_TO_TEXT_PATH) (
560*7993cbccSNigel Croxon     IN CONST EFI_DEVICE_PATH_PROTOCOL    *DevicePath,
561*7993cbccSNigel Croxon     IN BOOLEAN                           DisplayOnly,
562*7993cbccSNigel Croxon     IN BOOLEAN                           AllowShortcuts
563*7993cbccSNigel Croxon     );
564*7993cbccSNigel Croxon 
565*7993cbccSNigel Croxon typedef struct _EFI_DEVICE_PATH_TO_TEXT_PROTOCOL {
566*7993cbccSNigel Croxon 	EFI_DEVICE_PATH_TO_TEXT_NODE         ConvertDeviceNodeToText;
567*7993cbccSNigel Croxon 	EFI_DEVICE_PATH_TO_TEXT_PATH         ConvertDevicePathToText;
568*7993cbccSNigel Croxon } EFI_DEVICE_PATH_TO_TEXT_PROTOCOL;
569*7993cbccSNigel Croxon 
570*7993cbccSNigel Croxon #define EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID \
571*7993cbccSNigel Croxon   { 0x5c99a21, 0xc70f, 0x4ad2, {0x8a, 0x5f, 0x35, 0xdf, 0x33, 0x43, 0xf5, 0x1e} }
572*7993cbccSNigel Croxon 
573*7993cbccSNigel Croxon typedef
574*7993cbccSNigel Croxon EFI_DEVICE_PATH_PROTOCOL*
575*7993cbccSNigel Croxon (EFIAPI *EFI_DEVICE_PATH_FROM_TEXT_NODE) (
576*7993cbccSNigel Croxon     IN CONST CHAR16                      *TextDeviceNode
577*7993cbccSNigel Croxon     );
578*7993cbccSNigel Croxon 
579*7993cbccSNigel Croxon typedef
580*7993cbccSNigel Croxon EFI_DEVICE_PATH_PROTOCOL*
581*7993cbccSNigel Croxon (EFIAPI *EFI_DEVICE_PATH_FROM_TEXT_PATH) (
582*7993cbccSNigel Croxon     IN CONST CHAR16                      *TextDevicePath
583*7993cbccSNigel Croxon     );
584*7993cbccSNigel Croxon 
585*7993cbccSNigel Croxon typedef struct {
586*7993cbccSNigel Croxon     EFI_DEVICE_PATH_FROM_TEXT_NODE       ConvertTextToDeviceNode;
587*7993cbccSNigel Croxon     EFI_DEVICE_PATH_FROM_TEXT_PATH       ConvertTextToDevicePath;
588*7993cbccSNigel Croxon } EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL;
589530d68baSNigel Croxon 
590530d68baSNigel Croxon #endif
591