1 /* $NetBSD: efidevp.h,v 1.1 2006/04/07 14:21:29 cherry Exp $ */
2 /* $FreeBSD: src/sys/boot/efi/include/efidevp.h,v 1.2 2002/05/19 03:17:20 marcel Exp $ */
8 Copyright (c) 1998 Intel Corporation
16 Defines for parsing the EFI Device Path structures
25 * Device Path structures - Section C
28 typedef struct _EFI_DEVICE_PATH
{
34 #define EFI_DP_TYPE_MASK 0x7F
35 #define EFI_DP_TYPE_UNPACKED 0x80
37 #define END_DEVICE_PATH_TYPE 0x7f
39 #define END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff
40 #define END_INSTANCE_DEVICE_PATH_SUBTYPE 0x01
41 #define END_DEVICE_PATH_LENGTH (sizeof(EFI_DEVICE_PATH))
44 #define DP_IS_END_TYPE(a)
45 #define DP_IS_END_SUBTYPE(a) ( ((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE )
47 #define DevicePathType(a) ( ((a)->Type) & EFI_DP_TYPE_MASK )
48 #define DevicePathSubType(a) ( (a)->SubType )
49 #define DevicePathNodeLength(a) ( ((a)->Length[0]) | ((a)->Length[1] << 8) )
50 #define NextDevicePathNode(a) ( (EFI_DEVICE_PATH *) ( ((UINT8 *) (a)) + DevicePathNodeLength(a)))
51 #define IsDevicePathEndType(a) ( DevicePathType(a) == END_DEVICE_PATH_TYPE )
52 #define IsDevicePathEndSubType(a) ( (a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE )
53 #define IsDevicePathEnd(a) ( IsDevicePathEndType(a) && IsDevicePathEndSubType(a) )
54 #define IsDevicePathUnpacked(a) ( (a)->Type & EFI_DP_TYPE_UNPACKED )
57 #define SetDevicePathNodeLength(a,l) { \
58 (a)->Length[0] = (UINT8) (l); \
59 (a)->Length[1] = (UINT8) ((l) >> 8); \
62 #define SetDevicePathEndNode(a) { \
63 (a)->Type = END_DEVICE_PATH_TYPE; \
64 (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \
65 (a)->Length[0] = sizeof(EFI_DEVICE_PATH); \
74 #define HARDWARE_DEVICE_PATH 0x01
76 #define HW_PCI_DP 0x01
77 typedef struct _PCI_DEVICE_PATH
{
78 EFI_DEVICE_PATH Header
;
83 #define HW_PCCARD_DP 0x02
84 typedef struct _PCCARD_DEVICE_PATH
{
85 EFI_DEVICE_PATH Header
;
89 #define HW_MEMMAP_DP 0x03
90 typedef struct _MEMMAP_DEVICE_PATH
{
91 EFI_DEVICE_PATH Header
;
93 EFI_PHYSICAL_ADDRESS StartingAddress
;
94 EFI_PHYSICAL_ADDRESS EndingAddress
;
97 #define HW_VENDOR_DP 0x04
98 typedef struct _VENDOR_DEVICE_PATH
{
99 EFI_DEVICE_PATH Header
;
101 } VENDOR_DEVICE_PATH
;
103 #define UNKNOWN_DEVICE_GUID \
104 { 0xcf31fac5, 0xc24e, 0x11d2, 0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b }
106 typedef struct _UKNOWN_DEVICE_VENDOR_DP
{
107 VENDOR_DEVICE_PATH DevicePath
;
108 UINT8 LegacyDriveLetter
;
109 } UNKNOWN_DEVICE_VENDOR_DEVICE_PATH
;
111 #define HW_CONTROLLER_DP 0x05
112 typedef struct _CONTROLLER_DEVICE_PATH
{
113 EFI_DEVICE_PATH Header
;
115 } CONTROLLER_DEVICE_PATH
;
120 #define ACPI_DEVICE_PATH 0x02
123 typedef struct _ACPI_HID_DEVICE_PATH
{
124 EFI_DEVICE_PATH Header
;
127 } ACPI_HID_DEVICE_PATH
;
131 * EISA ID Definition 32-bits
132 * bits[15:0] - three character compressed ASCII EISA ID.
133 * bits[31:16] - binary number
134 * Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z'
136 #define PNP_EISA_ID_CONST 0x41d0
137 #define EISA_ID(_Name, _Num) ((UINT32) ((_Name) | (_Num) << 16))
138 #define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
140 #define PNP_EISA_ID_MASK 0xffff
141 #define EISA_ID_TO_NUM(_Id) ((_Id) >> 16)
145 #define MESSAGING_DEVICE_PATH 0x03
147 #define MSG_ATAPI_DP 0x01
148 typedef struct _ATAPI_DEVICE_PATH
{
149 EFI_DEVICE_PATH Header
;
150 UINT8 PrimarySecondary
;
155 #define MSG_SCSI_DP 0x02
156 typedef struct _SCSI_DEVICE_PATH
{
157 EFI_DEVICE_PATH Header
;
162 #define MSG_FIBRECHANNEL_DP 0x03
163 typedef struct _FIBRECHANNEL_DEVICE_PATH
{
164 EFI_DEVICE_PATH Header
;
168 } FIBRECHANNEL_DEVICE_PATH
;
170 #define MSG_1394_DP 0x04
171 typedef struct _F1394_DEVICE_PATH
{
172 EFI_DEVICE_PATH Header
;
177 #define MSG_USB_DP 0x05
178 typedef struct _USB_DEVICE_PATH
{
179 EFI_DEVICE_PATH Header
;
184 #define MSG_USB_CLASS_DP 0x0F
185 typedef struct _USB_CLASS_DEVICE_PATH
{
186 EFI_DEVICE_PATH Header
;
190 UINT8 DeviceSubclass
;
191 UINT8 DeviceProtocol
;
192 } USB_CLASS_DEVICE_PATH
;
194 #define MSG_I2O_DP 0x06
195 typedef struct _I2O_DEVICE_PATH
{
196 EFI_DEVICE_PATH Header
;
200 #define MSG_MAC_ADDR_DP 0x0b
201 typedef struct _MAC_ADDR_DEVICE_PATH
{
202 EFI_DEVICE_PATH Header
;
203 EFI_MAC_ADDRESS MacAddress
;
205 } MAC_ADDR_DEVICE_PATH
;
207 #define MSG_IPv4_DP 0x0c
208 typedef struct _IPv4_DEVICE_PATH
{
209 EFI_DEVICE_PATH Header
;
210 EFI_IPv4_ADDRESS LocalIpAddress
;
211 EFI_IPv4_ADDRESS RemoteIpAddress
;
215 BOOLEAN StaticIpAddress
;
218 #define MSG_IPv6_DP 0x0d
219 typedef struct _IPv6_DEVICE_PATH
{
220 EFI_DEVICE_PATH Header
;
221 EFI_IPv6_ADDRESS LocalIpAddress
;
222 EFI_IPv6_ADDRESS RemoteIpAddress
;
226 BOOLEAN StaticIpAddress
;
229 #define MSG_INFINIBAND_DP 0x09
230 typedef struct _INFINIBAND_DEVICE_PATH
{
231 EFI_DEVICE_PATH Header
;
236 } INFINIBAND_DEVICE_PATH
;
238 #define MSG_UART_DP 0x0e
239 typedef struct _UART_DEVICE_PATH
{
240 EFI_DEVICE_PATH Header
;
248 #define MSG_VENDOR_DP 0x0A
249 /* Use VENDOR_DEVICE_PATH struct */
251 #define DEVICE_PATH_MESSAGING_PC_ANSI \
252 { 0xe0c14753, 0xf9be, 0x11d2, 0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
254 #define DEVICE_PATH_MESSAGING_VT_100 \
255 { 0xdfa66065, 0xb419, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
259 #define MEDIA_DEVICE_PATH 0x04
261 #define MEDIA_HARDDRIVE_DP 0x01
262 typedef struct _HARDDRIVE_DEVICE_PATH
{
263 EFI_DEVICE_PATH Header
;
264 UINT32 PartitionNumber
;
265 UINT64 PartitionStart
;
266 UINT64 PartitionSize
;
270 } HARDDRIVE_DEVICE_PATH
;
272 #define MBR_TYPE_PCAT 0x01
273 #define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02
275 #define SIGNATURE_TYPE_MBR 0x01
276 #define SIGNATURE_TYPE_GUID 0x02
278 #define MEDIA_CDROM_DP 0x02
279 typedef struct _CDROM_DEVICE_PATH
{
280 EFI_DEVICE_PATH Header
;
282 UINT64 PartitionStart
;
283 UINT64 PartitionSize
;
286 #define MEDIA_VENDOR_DP 0x03
287 /* Use VENDOR_DEVICE_PATH struct */
289 #define MEDIA_FILEPATH_DP 0x04
290 typedef struct _FILEPATH_DEVICE_PATH
{
291 EFI_DEVICE_PATH Header
;
293 } FILEPATH_DEVICE_PATH
;
295 #define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName)
297 #define MEDIA_PROTOCOL_DP 0x05
298 typedef struct _MEDIA_PROTOCOL_DEVICE_PATH
{
299 EFI_DEVICE_PATH Header
;
301 } MEDIA_PROTOCOL_DEVICE_PATH
;
304 #define BBS_DEVICE_PATH 0x05
305 #define BBS_BBS_DP 0x01
306 typedef struct _BBS_BBS_DEVICE_PATH
{
307 EFI_DEVICE_PATH Header
;
311 } BBS_BBS_DEVICE_PATH
;
313 /* DeviceType definitions - from BBS specification */
314 #define BBS_TYPE_FLOPPY 0x01
315 #define BBS_TYPE_HARDDRIVE 0x02
316 #define BBS_TYPE_CDROM 0x03
317 #define BBS_TYPE_PCMCIA 0x04
318 #define BBS_TYPE_USB 0x05
319 #define BBS_TYPE_EMBEDDED_NETWORK 0x06
320 #define BBS_TYPE_DEV 0x80
321 #define BBS_TYPE_UNKNOWN 0xFF
324 EFI_DEVICE_PATH DevPath
;
326 PCCARD_DEVICE_PATH PcCard
;
327 MEMMAP_DEVICE_PATH MemMap
;
328 VENDOR_DEVICE_PATH Vendor
;
329 UNKNOWN_DEVICE_VENDOR_DEVICE_PATH UnknownVendor
;
330 CONTROLLER_DEVICE_PATH Controller
;
331 ACPI_HID_DEVICE_PATH Acpi
;
333 ATAPI_DEVICE_PATH Atapi
;
334 SCSI_DEVICE_PATH Scsi
;
335 FIBRECHANNEL_DEVICE_PATH FibreChannel
;
337 F1394_DEVICE_PATH F1394
;
339 USB_CLASS_DEVICE_PATH UsbClass
;
341 MAC_ADDR_DEVICE_PATH MacAddr
;
342 IPv4_DEVICE_PATH Ipv4
;
343 IPv6_DEVICE_PATH Ipv6
;
344 INFINIBAND_DEVICE_PATH InfiniBand
;
345 UART_DEVICE_PATH Uart
;
347 HARDDRIVE_DEVICE_PATH HardDrive
;
348 CDROM_DEVICE_PATH CD
;
350 FILEPATH_DEVICE_PATH FilePath
;
351 MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol
;
353 BBS_BBS_DEVICE_PATH Bbs
;
358 EFI_DEVICE_PATH
*DevPath
;
359 PCI_DEVICE_PATH
*Pci
;
360 PCCARD_DEVICE_PATH
*PcCard
;
361 MEMMAP_DEVICE_PATH
*MemMap
;
362 VENDOR_DEVICE_PATH
*Vendor
;
363 UNKNOWN_DEVICE_VENDOR_DEVICE_PATH
*UnknownVendor
;
364 CONTROLLER_DEVICE_PATH
*Controller
;
365 ACPI_HID_DEVICE_PATH
*Acpi
;
367 ATAPI_DEVICE_PATH
*Atapi
;
368 SCSI_DEVICE_PATH
*Scsi
;
369 FIBRECHANNEL_DEVICE_PATH
*FibreChannel
;
371 F1394_DEVICE_PATH
*F1394
;
372 USB_DEVICE_PATH
*Usb
;
373 USB_CLASS_DEVICE_PATH
*UsbClass
;
374 I2O_DEVICE_PATH
*I2O
;
375 MAC_ADDR_DEVICE_PATH
*MacAddr
;
376 IPv4_DEVICE_PATH
*Ipv4
;
377 IPv6_DEVICE_PATH
*Ipv6
;
378 INFINIBAND_DEVICE_PATH
*InfiniBand
;
379 UART_DEVICE_PATH
*Uart
;
381 HARDDRIVE_DEVICE_PATH
*HardDrive
;
383 FILEPATH_DEVICE_PATH
*FilePath
;
384 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProtocol
;
386 CDROM_DEVICE_PATH
*CD
;
387 BBS_BBS_DEVICE_PATH
*Bbs
;