6 Copyright (c) 1998 Intel Corporation
14 Defines for parsing the EFI Device Path structures
23 // Device Path structures - Section C
26 typedef struct _EFI_DEVICE_PATH
{
32 #define EFI_DP_TYPE_MASK 0x7F
33 #define EFI_DP_TYPE_UNPACKED 0x80
35 //#define END_DEVICE_PATH_TYPE 0xff
36 #define END_DEVICE_PATH_TYPE 0x7f
37 //#define END_DEVICE_PATH_TYPE_UNPACKED 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_UNPACKED )
52 #define IsDevicePathEndType(a) ( DevicePathType(a) == END_DEVICE_PATH_TYPE )
53 #define IsDevicePathEndSubType(a) ( (a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE )
54 #define IsDevicePathEnd(a) ( IsDevicePathEndType(a) && IsDevicePathEndSubType(a) )
55 #define IsDevicePathUnpacked(a) ( (a)->Type & EFI_DP_TYPE_UNPACKED )
58 #define SetDevicePathNodeLength(a,l) { \
59 (a)->Length[0] = (UINT8) (l); \
60 (a)->Length[1] = (UINT8) ((l) >> 8); \
63 #define SetDevicePathEndNode(a) { \
64 (a)->Type = END_DEVICE_PATH_TYPE; \
65 (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \
66 (a)->Length[0] = sizeof(EFI_DEVICE_PATH); \
75 #define HARDWARE_DEVICE_PATH 0x01
77 #define HW_PCI_DP 0x01
78 typedef struct _PCI_DEVICE_PATH
{
79 EFI_DEVICE_PATH Header
;
84 #define HW_PCCARD_DP 0x02
85 typedef struct _PCCARD_DEVICE_PATH
{
86 EFI_DEVICE_PATH Header
;
90 #define HW_MEMMAP_DP 0x03
91 typedef struct _MEMMAP_DEVICE_PATH
{
92 EFI_DEVICE_PATH Header
;
94 EFI_PHYSICAL_ADDRESS StartingAddress
;
95 EFI_PHYSICAL_ADDRESS EndingAddress
;
98 #define HW_VENDOR_DP 0x04
99 typedef struct _VENDOR_DEVICE_PATH
{
100 EFI_DEVICE_PATH Header
;
102 } VENDOR_DEVICE_PATH
;
104 #define UNKNOWN_DEVICE_GUID \
105 { 0xcf31fac5, 0xc24e, 0x11d2, {0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b} }
107 typedef struct _UKNOWN_DEVICE_VENDOR_DP
{
108 VENDOR_DEVICE_PATH DevicePath
;
109 UINT8 LegacyDriveLetter
;
110 } UNKNOWN_DEVICE_VENDOR_DEVICE_PATH
;
112 #define HW_CONTROLLER_DP 0x05
113 typedef struct _CONTROLLER_DEVICE_PATH
{
114 EFI_DEVICE_PATH Header
;
116 } CONTROLLER_DEVICE_PATH
;
121 #define ACPI_DEVICE_PATH 0x02
124 typedef struct _ACPI_HID_DEVICE_PATH
{
125 EFI_DEVICE_PATH Header
;
128 } ACPI_HID_DEVICE_PATH
;
130 #define EXPANDED_ACPI_DP 0x02
131 typedef struct _EXPANDED_ACPI_HID_DEVICE_PATH
{
132 EFI_DEVICE_PATH Header
;
137 } EXPANDED_ACPI_HID_DEVICE_PATH
;
141 // EISA ID Definition 32-bits
142 // bits[15:0] - three character compressed ASCII EISA ID.
143 // bits[31:16] - binary number
144 // Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z'
146 #define PNP_EISA_ID_CONST 0x41d0
147 #define EISA_ID(_Name, _Num) ((UINT32) ((_Name) | (_Num) << 16))
148 #define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId)))
150 #define PNP_EISA_ID_MASK 0xffff
151 #define EISA_ID_TO_NUM(_Id) ((_Id) >> 16)
155 #define MESSAGING_DEVICE_PATH 0x03
157 #define MSG_ATAPI_DP 0x01
158 typedef struct _ATAPI_DEVICE_PATH
{
159 EFI_DEVICE_PATH Header
;
160 UINT8 PrimarySecondary
;
165 #define MSG_SCSI_DP 0x02
166 typedef struct _SCSI_DEVICE_PATH
{
167 EFI_DEVICE_PATH Header
;
172 #define MSG_FIBRECHANNEL_DP 0x03
173 typedef struct _FIBRECHANNEL_DEVICE_PATH
{
174 EFI_DEVICE_PATH Header
;
178 } FIBRECHANNEL_DEVICE_PATH
;
180 #define MSG_1394_DP 0x04
181 typedef struct _F1394_DEVICE_PATH
{
182 EFI_DEVICE_PATH Header
;
187 #define MSG_USB_DP 0x05
188 typedef struct _USB_DEVICE_PATH
{
189 EFI_DEVICE_PATH Header
;
194 #define MSG_USB_CLASS_DP 0x0F
195 typedef struct _USB_CLASS_DEVICE_PATH
{
196 EFI_DEVICE_PATH Header
;
200 UINT8 DeviceSubclass
;
201 UINT8 DeviceProtocol
;
202 } USB_CLASS_DEVICE_PATH
;
204 #define MSG_I2O_DP 0x06
205 typedef struct _I2O_DEVICE_PATH
{
206 EFI_DEVICE_PATH Header
;
210 #define MSG_MAC_ADDR_DP 0x0b
211 typedef struct _MAC_ADDR_DEVICE_PATH
{
212 EFI_DEVICE_PATH Header
;
213 EFI_MAC_ADDRESS MacAddress
;
215 } MAC_ADDR_DEVICE_PATH
;
217 #define MSG_IPv4_DP 0x0c
218 typedef struct _IPv4_DEVICE_PATH
{
219 EFI_DEVICE_PATH Header
;
220 EFI_IPv4_ADDRESS LocalIpAddress
;
221 EFI_IPv4_ADDRESS RemoteIpAddress
;
225 BOOLEAN StaticIpAddress
;
228 #define MSG_IPv6_DP 0x0d
229 typedef struct _IPv6_DEVICE_PATH
{
230 EFI_DEVICE_PATH Header
;
231 EFI_IPv6_ADDRESS LocalIpAddress
;
232 EFI_IPv6_ADDRESS RemoteIpAddress
;
236 BOOLEAN StaticIpAddress
;
239 #define MSG_INFINIBAND_DP 0x09
240 typedef struct _INFINIBAND_DEVICE_PATH
{
241 EFI_DEVICE_PATH Header
;
246 } INFINIBAND_DEVICE_PATH
;
248 #define MSG_UART_DP 0x0e
249 typedef struct _UART_DEVICE_PATH
{
250 EFI_DEVICE_PATH Header
;
258 #define MSG_VENDOR_DP 0x0A
259 /* Use VENDOR_DEVICE_PATH struct */
261 #define DEVICE_PATH_MESSAGING_PC_ANSI \
262 { 0xe0c14753, 0xf9be, 0x11d2, {0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
264 #define DEVICE_PATH_MESSAGING_VT_100 \
265 { 0xdfa66065, 0xb419, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
269 #define MEDIA_DEVICE_PATH 0x04
271 #define MEDIA_HARDDRIVE_DP 0x01
272 typedef struct _HARDDRIVE_DEVICE_PATH
{
273 EFI_DEVICE_PATH Header
;
274 UINT32 PartitionNumber
;
275 UINT64 PartitionStart
;
276 UINT64 PartitionSize
;
280 } HARDDRIVE_DEVICE_PATH
;
282 #define MBR_TYPE_PCAT 0x01
283 #define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02
285 #define SIGNATURE_TYPE_MBR 0x01
286 #define SIGNATURE_TYPE_GUID 0x02
288 #define MEDIA_CDROM_DP 0x02
289 typedef struct _CDROM_DEVICE_PATH
{
290 EFI_DEVICE_PATH Header
;
292 UINT64 PartitionStart
;
293 UINT64 PartitionSize
;
296 #define MEDIA_VENDOR_DP 0x03
297 /* Use VENDOR_DEVICE_PATH struct */
299 #define MEDIA_FILEPATH_DP 0x04
300 typedef struct _FILEPATH_DEVICE_PATH
{
301 EFI_DEVICE_PATH Header
;
303 } FILEPATH_DEVICE_PATH
;
305 #define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName)
307 #define MEDIA_PROTOCOL_DP 0x05
308 typedef struct _MEDIA_PROTOCOL_DEVICE_PATH
{
309 EFI_DEVICE_PATH Header
;
311 } MEDIA_PROTOCOL_DEVICE_PATH
;
314 #define BBS_DEVICE_PATH 0x05
315 #define BBS_BBS_DP 0x01
316 typedef struct _BBS_BBS_DEVICE_PATH
{
317 EFI_DEVICE_PATH Header
;
321 } BBS_BBS_DEVICE_PATH
;
323 /* DeviceType definitions - from BBS specification */
324 #define BBS_TYPE_FLOPPY 0x01
325 #define BBS_TYPE_HARDDRIVE 0x02
326 #define BBS_TYPE_CDROM 0x03
327 #define BBS_TYPE_PCMCIA 0x04
328 #define BBS_TYPE_USB 0x05
329 #define BBS_TYPE_EMBEDDED_NETWORK 0x06
330 #define BBS_TYPE_DEV 0x80
331 #define BBS_TYPE_UNKNOWN 0xFF
334 EFI_DEVICE_PATH DevPath
;
336 PCCARD_DEVICE_PATH PcCard
;
337 MEMMAP_DEVICE_PATH MemMap
;
338 VENDOR_DEVICE_PATH Vendor
;
339 UNKNOWN_DEVICE_VENDOR_DEVICE_PATH UnknownVendor
;
340 CONTROLLER_DEVICE_PATH Controller
;
341 ACPI_HID_DEVICE_PATH Acpi
;
343 ATAPI_DEVICE_PATH Atapi
;
344 SCSI_DEVICE_PATH Scsi
;
345 FIBRECHANNEL_DEVICE_PATH FibreChannel
;
347 F1394_DEVICE_PATH F1394
;
349 USB_CLASS_DEVICE_PATH UsbClass
;
351 MAC_ADDR_DEVICE_PATH MacAddr
;
352 IPv4_DEVICE_PATH Ipv4
;
353 IPv6_DEVICE_PATH Ipv6
;
354 INFINIBAND_DEVICE_PATH InfiniBand
;
355 UART_DEVICE_PATH Uart
;
357 HARDDRIVE_DEVICE_PATH HardDrive
;
358 CDROM_DEVICE_PATH CD
;
360 FILEPATH_DEVICE_PATH FilePath
;
361 MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol
;
363 BBS_BBS_DEVICE_PATH Bbs
;
368 EFI_DEVICE_PATH
*DevPath
;
369 PCI_DEVICE_PATH
*Pci
;
370 PCCARD_DEVICE_PATH
*PcCard
;
371 MEMMAP_DEVICE_PATH
*MemMap
;
372 VENDOR_DEVICE_PATH
*Vendor
;
373 UNKNOWN_DEVICE_VENDOR_DEVICE_PATH
*UnknownVendor
;
374 CONTROLLER_DEVICE_PATH
*Controller
;
375 ACPI_HID_DEVICE_PATH
*Acpi
;
377 ATAPI_DEVICE_PATH
*Atapi
;
378 SCSI_DEVICE_PATH
*Scsi
;
379 FIBRECHANNEL_DEVICE_PATH
*FibreChannel
;
381 F1394_DEVICE_PATH
*F1394
;
382 USB_DEVICE_PATH
*Usb
;
383 USB_CLASS_DEVICE_PATH
*UsbClass
;
384 I2O_DEVICE_PATH
*I2O
;
385 MAC_ADDR_DEVICE_PATH
*MacAddr
;
386 IPv4_DEVICE_PATH
*Ipv4
;
387 IPv6_DEVICE_PATH
*Ipv6
;
388 INFINIBAND_DEVICE_PATH
*InfiniBand
;
389 UART_DEVICE_PATH
*Uart
;
391 HARDDRIVE_DEVICE_PATH
*HardDrive
;
393 FILEPATH_DEVICE_PATH
*FilePath
;
394 MEDIA_PROTOCOL_DEVICE_PATH
*MediaProtocol
;
396 CDROM_DEVICE_PATH
*CD
;
397 BBS_BBS_DEVICE_PATH
*Bbs
;