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 $
10 Copyright (c) 1998 Intel Corporation
18 Defines for parsing the EFI Device Path structures
27 * Device Path structures - Section C
30 typedef struct _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); \
76 #define HARDWARE_DEVICE_PATH 0x01
78 #define HW_PCI_DP 0x01
79 typedef struct _PCI_DEVICE_PATH
{
80 EFI_DEVICE_PATH Header
;
85 #define HW_PCCARD_DP 0x02
86 typedef struct _PCCARD_DEVICE_PATH
{
87 EFI_DEVICE_PATH Header
;
91 #define HW_MEMMAP_DP 0x03
92 typedef struct _MEMMAP_DEVICE_PATH
{
93 EFI_DEVICE_PATH Header
;
95 EFI_PHYSICAL_ADDRESS StartingAddress
;
96 EFI_PHYSICAL_ADDRESS EndingAddress
;
99 #define HW_VENDOR_DP 0x04
100 typedef struct _VENDOR_DEVICE_PATH
{
101 EFI_DEVICE_PATH Header
;
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
;
117 } CONTROLLER_DEVICE_PATH
;
122 #define ACPI_DEVICE_PATH 0x02
125 typedef struct _ACPI_HID_DEVICE_PATH
{
126 EFI_DEVICE_PATH Header
;
129 } ACPI_HID_DEVICE_PATH
;
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
;
157 #define MSG_SCSI_DP 0x02
158 typedef struct _SCSI_DEVICE_PATH
{
159 EFI_DEVICE_PATH Header
;
164 #define MSG_FIBRECHANNEL_DP 0x03
165 typedef struct _FIBRECHANNEL_DEVICE_PATH
{
166 EFI_DEVICE_PATH Header
;
170 } FIBRECHANNEL_DEVICE_PATH
;
172 #define MSG_1394_DP 0x04
173 typedef struct _F1394_DEVICE_PATH
{
174 EFI_DEVICE_PATH Header
;
179 #define MSG_USB_DP 0x05
180 typedef struct _USB_DEVICE_PATH
{
181 EFI_DEVICE_PATH Header
;
186 #define MSG_USB_CLASS_DP 0x0F
187 typedef struct _USB_CLASS_DEVICE_PATH
{
188 EFI_DEVICE_PATH Header
;
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
;
202 #define MSG_MAC_ADDR_DP 0x0b
203 typedef struct _MAC_ADDR_DEVICE_PATH
{
204 EFI_DEVICE_PATH Header
;
205 EFI_MAC_ADDRESS MacAddress
;
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
;
217 BOOLEAN StaticIpAddress
;
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
;
228 BOOLEAN StaticIpAddress
;
231 #define MSG_INFINIBAND_DP 0x09
232 typedef struct _INFINIBAND_DEVICE_PATH
{
233 EFI_DEVICE_PATH Header
;
238 } INFINIBAND_DEVICE_PATH
;
240 #define MSG_UART_DP 0x0e
241 typedef struct _UART_DEVICE_PATH
{
242 EFI_DEVICE_PATH Header
;
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
;
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
;
284 UINT64 PartitionStart
;
285 UINT64 PartitionSize
;
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
;
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
;
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
;
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
326 EFI_DEVICE_PATH DevPath
;
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
;
341 USB_CLASS_DEVICE_PATH UsbClass
;
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
;
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
;