added -y/--side-by-side option
[dfdiff.git] / sys / boot / efi / include / efidevp.h
blob464a51d0f55d9df6504f1e734e6a31fff7da883c
1 /*
2 * $FreeBSD: src/sys/boot/efi/include/efidevp.h,v 1.2 2002/05/19 03:17:20 marcel Exp $
3 * $DragonFly: src/sys/boot/efi/include/efidevp.h,v 1.1 2003/11/10 06:08:32 dillon Exp $
4 */
5 #ifndef _DEVPATH_H
6 #define _DEVPATH_H
8 /*++
10 Copyright (c) 1998 Intel Corporation
12 Module Name:
14 devpath.h
16 Abstract:
18 Defines for parsing the EFI Device Path structures
22 Revision History
24 --*/
27 * Device Path structures - Section C
30 typedef struct _EFI_DEVICE_PATH {
31 UINT8 Type;
32 UINT8 SubType;
33 UINT8 Length[2];
34 } EFI_DEVICE_PATH;
36 #define EFI_DP_TYPE_MASK 0x7F
37 #define EFI_DP_TYPE_UNPACKED 0x80
39 #define END_DEVICE_PATH_TYPE 0x7f
41 #define END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff
42 #define END_INSTANCE_DEVICE_PATH_SUBTYPE 0x01
43 #define END_DEVICE_PATH_LENGTH (sizeof(EFI_DEVICE_PATH))
46 #define DP_IS_END_TYPE(a)
47 #define DP_IS_END_SUBTYPE(a) ( ((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE )
49 #define DevicePathType(a) ( ((a)->Type) & EFI_DP_TYPE_MASK )
50 #define DevicePathSubType(a) ( (a)->SubType )
51 #define DevicePathNodeLength(a) ( ((a)->Length[0]) | ((a)->Length[1] << 8) )
52 #define NextDevicePathNode(a) ( (EFI_DEVICE_PATH *) ( ((UINT8 *) (a)) + DevicePathNodeLength(a)))
53 #define IsDevicePathEndType(a) ( DevicePathType(a) == END_DEVICE_PATH_TYPE )
54 #define IsDevicePathEndSubType(a) ( (a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE )
55 #define IsDevicePathEnd(a) ( IsDevicePathEndType(a) && IsDevicePathEndSubType(a) )
56 #define IsDevicePathUnpacked(a) ( (a)->Type & EFI_DP_TYPE_UNPACKED )
59 #define SetDevicePathNodeLength(a,l) { \
60 (a)->Length[0] = (UINT8) (l); \
61 (a)->Length[1] = (UINT8) ((l) >> 8); \
64 #define SetDevicePathEndNode(a) { \
65 (a)->Type = END_DEVICE_PATH_TYPE; \
66 (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \
67 (a)->Length[0] = sizeof(EFI_DEVICE_PATH); \
68 (a)->Length[1] = 0; \
76 #define HARDWARE_DEVICE_PATH 0x01
78 #define HW_PCI_DP 0x01
79 typedef struct _PCI_DEVICE_PATH {
80 EFI_DEVICE_PATH Header;
81 UINT8 Function;
82 UINT8 Device;
83 } PCI_DEVICE_PATH;
85 #define HW_PCCARD_DP 0x02
86 typedef struct _PCCARD_DEVICE_PATH {
87 EFI_DEVICE_PATH Header;
88 UINT8 SocketNumber;
89 } PCCARD_DEVICE_PATH;
91 #define HW_MEMMAP_DP 0x03
92 typedef struct _MEMMAP_DEVICE_PATH {
93 EFI_DEVICE_PATH Header;
94 UINT32 MemoryType;
95 EFI_PHYSICAL_ADDRESS StartingAddress;
96 EFI_PHYSICAL_ADDRESS EndingAddress;
97 } MEMMAP_DEVICE_PATH;
99 #define HW_VENDOR_DP 0x04
100 typedef struct _VENDOR_DEVICE_PATH {
101 EFI_DEVICE_PATH Header;
102 EFI_GUID Guid;
103 } VENDOR_DEVICE_PATH;
105 #define UNKNOWN_DEVICE_GUID \
106 { 0xcf31fac5, 0xc24e, 0x11d2, 0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b }
108 typedef struct _UKNOWN_DEVICE_VENDOR_DP {
109 VENDOR_DEVICE_PATH DevicePath;
110 UINT8 LegacyDriveLetter;
111 } UNKNOWN_DEVICE_VENDOR_DEVICE_PATH;
113 #define HW_CONTROLLER_DP 0x05
114 typedef struct _CONTROLLER_DEVICE_PATH {
115 EFI_DEVICE_PATH Header;
116 UINT32 Controller;
117 } CONTROLLER_DEVICE_PATH;
122 #define ACPI_DEVICE_PATH 0x02
124 #define ACPI_DP 0x01
125 typedef struct _ACPI_HID_DEVICE_PATH {
126 EFI_DEVICE_PATH Header;
127 UINT32 HID;
128 UINT32 UID;
129 } ACPI_HID_DEVICE_PATH;
132 * EISA ID Macro
133 * EISA ID Definition 32-bits
134 * bits[15:0] - three character compressed ASCII EISA ID.
135 * bits[31:16] - binary number
136 * Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z'
138 #define PNP_EISA_ID_CONST 0x41d0
139 #define EISA_ID(_Name, _Num) ((UINT32) ((_Name) | (_Num) << 16))
140 #define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
142 #define PNP_EISA_ID_MASK 0xffff
143 #define EISA_ID_TO_NUM(_Id) ((_Id) >> 16)
147 #define MESSAGING_DEVICE_PATH 0x03
149 #define MSG_ATAPI_DP 0x01
150 typedef struct _ATAPI_DEVICE_PATH {
151 EFI_DEVICE_PATH Header;
152 UINT8 PrimarySecondary;
153 UINT8 SlaveMaster;
154 UINT16 Lun;
155 } ATAPI_DEVICE_PATH;
157 #define MSG_SCSI_DP 0x02
158 typedef struct _SCSI_DEVICE_PATH {
159 EFI_DEVICE_PATH Header;
160 UINT16 Pun;
161 UINT16 Lun;
162 } SCSI_DEVICE_PATH;
164 #define MSG_FIBRECHANNEL_DP 0x03
165 typedef struct _FIBRECHANNEL_DEVICE_PATH {
166 EFI_DEVICE_PATH Header;
167 UINT32 Reserved;
168 UINT64 WWN;
169 UINT64 Lun;
170 } FIBRECHANNEL_DEVICE_PATH;
172 #define MSG_1394_DP 0x04
173 typedef struct _F1394_DEVICE_PATH {
174 EFI_DEVICE_PATH Header;
175 UINT32 Reserved;
176 UINT64 Guid;
177 } F1394_DEVICE_PATH;
179 #define MSG_USB_DP 0x05
180 typedef struct _USB_DEVICE_PATH {
181 EFI_DEVICE_PATH Header;
182 UINT8 Port;
183 UINT8 Endpoint;
184 } USB_DEVICE_PATH;
186 #define MSG_USB_CLASS_DP 0x0F
187 typedef struct _USB_CLASS_DEVICE_PATH {
188 EFI_DEVICE_PATH Header;
189 UINT16 VendorId;
190 UINT16 ProductId;
191 UINT8 DeviceClass;
192 UINT8 DeviceSubclass;
193 UINT8 DeviceProtocol;
194 } USB_CLASS_DEVICE_PATH;
196 #define MSG_I2O_DP 0x06
197 typedef struct _I2O_DEVICE_PATH {
198 EFI_DEVICE_PATH Header;
199 UINT32 Tid;
200 } I2O_DEVICE_PATH;
202 #define MSG_MAC_ADDR_DP 0x0b
203 typedef struct _MAC_ADDR_DEVICE_PATH {
204 EFI_DEVICE_PATH Header;
205 EFI_MAC_ADDRESS MacAddress;
206 UINT8 IfType;
207 } MAC_ADDR_DEVICE_PATH;
209 #define MSG_IPv4_DP 0x0c
210 typedef struct _IPv4_DEVICE_PATH {
211 EFI_DEVICE_PATH Header;
212 EFI_IPv4_ADDRESS LocalIpAddress;
213 EFI_IPv4_ADDRESS RemoteIpAddress;
214 UINT16 LocalPort;
215 UINT16 RemotePort;
216 UINT16 Protocol;
217 BOOLEAN StaticIpAddress;
218 } IPv4_DEVICE_PATH;
220 #define MSG_IPv6_DP 0x0d
221 typedef struct _IPv6_DEVICE_PATH {
222 EFI_DEVICE_PATH Header;
223 EFI_IPv6_ADDRESS LocalIpAddress;
224 EFI_IPv6_ADDRESS RemoteIpAddress;
225 UINT16 LocalPort;
226 UINT16 RemotePort;
227 UINT16 Protocol;
228 BOOLEAN StaticIpAddress;
229 } IPv6_DEVICE_PATH;
231 #define MSG_INFINIBAND_DP 0x09
232 typedef struct _INFINIBAND_DEVICE_PATH {
233 EFI_DEVICE_PATH Header;
234 UINT32 Reserved;
235 UINT64 NodeGuid;
236 UINT64 IocGuid;
237 UINT64 DeviceId;
238 } INFINIBAND_DEVICE_PATH;
240 #define MSG_UART_DP 0x0e
241 typedef struct _UART_DEVICE_PATH {
242 EFI_DEVICE_PATH Header;
243 UINT32 Reserved;
244 UINT64 BaudRate;
245 UINT8 DataBits;
246 UINT8 Parity;
247 UINT8 StopBits;
248 } UART_DEVICE_PATH;
250 #define MSG_VENDOR_DP 0x0A
251 /* Use VENDOR_DEVICE_PATH struct */
253 #define DEVICE_PATH_MESSAGING_PC_ANSI \
254 { 0xe0c14753, 0xf9be, 0x11d2, 0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
256 #define DEVICE_PATH_MESSAGING_VT_100 \
257 { 0xdfa66065, 0xb419, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
261 #define MEDIA_DEVICE_PATH 0x04
263 #define MEDIA_HARDDRIVE_DP 0x01
264 typedef struct _HARDDRIVE_DEVICE_PATH {
265 EFI_DEVICE_PATH Header;
266 UINT32 PartitionNumber;
267 UINT64 PartitionStart;
268 UINT64 PartitionSize;
269 UINT8 Signature[16];
270 UINT8 MBRType;
271 UINT8 SignatureType;
272 } HARDDRIVE_DEVICE_PATH;
274 #define MBR_TYPE_PCAT 0x01
275 #define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02
277 #define SIGNATURE_TYPE_MBR 0x01
278 #define SIGNATURE_TYPE_GUID 0x02
280 #define MEDIA_CDROM_DP 0x02
281 typedef struct _CDROM_DEVICE_PATH {
282 EFI_DEVICE_PATH Header;
283 UINT32 BootEntry;
284 UINT64 PartitionStart;
285 UINT64 PartitionSize;
286 } CDROM_DEVICE_PATH;
288 #define MEDIA_VENDOR_DP 0x03
289 /* Use VENDOR_DEVICE_PATH struct */
291 #define MEDIA_FILEPATH_DP 0x04
292 typedef struct _FILEPATH_DEVICE_PATH {
293 EFI_DEVICE_PATH Header;
294 CHAR16 PathName[1];
295 } FILEPATH_DEVICE_PATH;
297 #define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName)
299 #define MEDIA_PROTOCOL_DP 0x05
300 typedef struct _MEDIA_PROTOCOL_DEVICE_PATH {
301 EFI_DEVICE_PATH Header;
302 EFI_GUID Protocol;
303 } MEDIA_PROTOCOL_DEVICE_PATH;
306 #define BBS_DEVICE_PATH 0x05
307 #define BBS_BBS_DP 0x01
308 typedef struct _BBS_BBS_DEVICE_PATH {
309 EFI_DEVICE_PATH Header;
310 UINT16 DeviceType;
311 UINT16 StatusFlag;
312 CHAR8 String[1];
313 } BBS_BBS_DEVICE_PATH;
315 /* DeviceType definitions - from BBS specification */
316 #define BBS_TYPE_FLOPPY 0x01
317 #define BBS_TYPE_HARDDRIVE 0x02
318 #define BBS_TYPE_CDROM 0x03
319 #define BBS_TYPE_PCMCIA 0x04
320 #define BBS_TYPE_USB 0x05
321 #define BBS_TYPE_EMBEDDED_NETWORK 0x06
322 #define BBS_TYPE_DEV 0x80
323 #define BBS_TYPE_UNKNOWN 0xFF
325 typedef union {
326 EFI_DEVICE_PATH DevPath;
327 PCI_DEVICE_PATH Pci;
328 PCCARD_DEVICE_PATH PcCard;
329 MEMMAP_DEVICE_PATH MemMap;
330 VENDOR_DEVICE_PATH Vendor;
331 UNKNOWN_DEVICE_VENDOR_DEVICE_PATH UnknownVendor;
332 CONTROLLER_DEVICE_PATH Controller;
333 ACPI_HID_DEVICE_PATH Acpi;
335 ATAPI_DEVICE_PATH Atapi;
336 SCSI_DEVICE_PATH Scsi;
337 FIBRECHANNEL_DEVICE_PATH FibreChannel;
339 F1394_DEVICE_PATH F1394;
340 USB_DEVICE_PATH Usb;
341 USB_CLASS_DEVICE_PATH UsbClass;
342 I2O_DEVICE_PATH I2O;
343 MAC_ADDR_DEVICE_PATH MacAddr;
344 IPv4_DEVICE_PATH Ipv4;
345 IPv6_DEVICE_PATH Ipv6;
346 INFINIBAND_DEVICE_PATH InfiniBand;
347 UART_DEVICE_PATH Uart;
349 HARDDRIVE_DEVICE_PATH HardDrive;
350 CDROM_DEVICE_PATH CD;
352 FILEPATH_DEVICE_PATH FilePath;
353 MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol;
355 BBS_BBS_DEVICE_PATH Bbs;
357 } EFI_DEV_PATH;
359 typedef union {
360 EFI_DEVICE_PATH *DevPath;
361 PCI_DEVICE_PATH *Pci;
362 PCCARD_DEVICE_PATH *PcCard;
363 MEMMAP_DEVICE_PATH *MemMap;
364 VENDOR_DEVICE_PATH *Vendor;
365 UNKNOWN_DEVICE_VENDOR_DEVICE_PATH *UnknownVendor;
366 CONTROLLER_DEVICE_PATH *Controller;
367 ACPI_HID_DEVICE_PATH *Acpi;
369 ATAPI_DEVICE_PATH *Atapi;
370 SCSI_DEVICE_PATH *Scsi;
371 FIBRECHANNEL_DEVICE_PATH *FibreChannel;
373 F1394_DEVICE_PATH *F1394;
374 USB_DEVICE_PATH *Usb;
375 USB_CLASS_DEVICE_PATH *UsbClass;
376 I2O_DEVICE_PATH *I2O;
377 MAC_ADDR_DEVICE_PATH *MacAddr;
378 IPv4_DEVICE_PATH *Ipv4;
379 IPv6_DEVICE_PATH *Ipv6;
380 INFINIBAND_DEVICE_PATH *InfiniBand;
381 UART_DEVICE_PATH *Uart;
383 HARDDRIVE_DEVICE_PATH *HardDrive;
385 FILEPATH_DEVICE_PATH *FilePath;
386 MEDIA_PROTOCOL_DEVICE_PATH *MediaProtocol;
388 CDROM_DEVICE_PATH *CD;
389 BBS_BBS_DEVICE_PATH *Bbs;
391 } EFI_DEV_PATH_PTR;
394 #endif