1 /* $FreeBSD$ */ 2 #ifndef _DEVPATH_H 3 #define _DEVPATH_H 4 5 /*++ 6 7 Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved 8 This software and associated documentation (if any) is furnished 9 under a license and may only be used or copied in accordance 10 with the terms of the license. Except as permitted by such 11 license, no part of this software or documentation may be 12 reproduced, stored in a retrieval system, or transmitted in any 13 form or by any means without the express written consent of 14 Intel Corporation. 15 16 Module Name: 17 18 devpath.h 19 20 Abstract: 21 22 Defines for parsing the EFI Device Path structures 23 24 25 26 Revision History 27 28 --*/ 29 30 // 31 // Device Path structures - Section C 32 // 33 34 #pragma pack(1) 35 36 typedef struct _EFI_DEVICE_PATH { 37 UINT8 Type; 38 UINT8 SubType; 39 UINT8 Length[2]; 40 } EFI_DEVICE_PATH; 41 42 #define EFI_DP_TYPE_MASK 0x7F 43 #define EFI_DP_TYPE_UNPACKED 0x80 44 45 #define END_DEVICE_PATH_TYPE 0x7f 46 47 #define END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff 48 #define END_INSTANCE_DEVICE_PATH_SUBTYPE 0x01 49 #define END_DEVICE_PATH_LENGTH (sizeof(EFI_DEVICE_PATH)) 50 51 52 #define DP_IS_END_TYPE(a) 53 #define DP_IS_END_SUBTYPE(a) ( ((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE ) 54 55 #define DevicePathType(a) ( ((a)->Type) & EFI_DP_TYPE_MASK ) 56 #define DevicePathSubType(a) ( (a)->SubType ) 57 #define DevicePathNodeLength(a) ((size_t)(((a)->Length[0]) | ((a)->Length[1] << 8))) 58 #define NextDevicePathNode(a) ( (EFI_DEVICE_PATH *) ( ((UINT8 *) (a)) + DevicePathNodeLength(a))) 59 #define IsDevicePathType(a, t) ( DevicePathType(a) == t ) 60 #define IsDevicePathEndType(a) IsDevicePathType(a, END_DEVICE_PATH_TYPE) 61 #define IsDevicePathEndSubType(a) ( (a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE ) 62 #define IsDevicePathEnd(a) ( IsDevicePathEndType(a) && IsDevicePathEndSubType(a) ) 63 #define IsDevicePathUnpacked(a) ( (a)->Type & EFI_DP_TYPE_UNPACKED ) 64 65 66 #define SetDevicePathNodeLength(a,l) { \ 67 (a)->Length[0] = (UINT8) (l); \ 68 (a)->Length[1] = (UINT8) ((l) >> 8); \ 69 } 70 71 #define SetDevicePathEndNode(a) { \ 72 (a)->Type = END_DEVICE_PATH_TYPE; \ 73 (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \ 74 (a)->Length[0] = sizeof(EFI_DEVICE_PATH); \ 75 (a)->Length[1] = 0; \ 76 } 77 78 /* 79 * 80 */ 81 #define HARDWARE_DEVICE_PATH 0x01 82 83 #define HW_PCI_DP 0x01 84 typedef struct _PCI_DEVICE_PATH { 85 EFI_DEVICE_PATH Header; 86 UINT8 Function; 87 UINT8 Device; 88 } PCI_DEVICE_PATH; 89 90 #define HW_PCCARD_DP 0x02 91 typedef struct _PCCARD_DEVICE_PATH { 92 EFI_DEVICE_PATH Header; 93 UINT8 FunctionNumber; 94 } PCCARD_DEVICE_PATH; 95 96 #define HW_MEMMAP_DP 0x03 97 typedef struct _MEMMAP_DEVICE_PATH { 98 EFI_DEVICE_PATH Header; 99 UINT32 MemoryType; 100 EFI_PHYSICAL_ADDRESS StartingAddress; 101 EFI_PHYSICAL_ADDRESS EndingAddress; 102 } MEMMAP_DEVICE_PATH; 103 104 #define HW_VENDOR_DP 0x04 105 typedef struct _VENDOR_DEVICE_PATH { 106 EFI_DEVICE_PATH Header; 107 EFI_GUID Guid; 108 } VENDOR_DEVICE_PATH; 109 110 #define UNKNOWN_DEVICE_GUID \ 111 { 0xcf31fac5, 0xc24e, 0x11d2, {0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b} } 112 113 typedef struct _UKNOWN_DEVICE_VENDOR_DP { 114 VENDOR_DEVICE_PATH DevicePath; 115 UINT8 LegacyDriveLetter; 116 } UNKNOWN_DEVICE_VENDOR_DEVICE_PATH; 117 118 #define HW_CONTROLLER_DP 0x05 119 typedef struct _CONTROLLER_DEVICE_PATH { 120 EFI_DEVICE_PATH Header; 121 UINT32 Controller; 122 } CONTROLLER_DEVICE_PATH; 123 124 /* 125 * 126 */ 127 #define ACPI_DEVICE_PATH 0x02 128 129 #define ACPI_DP 0x01 130 typedef struct _ACPI_HID_DEVICE_PATH { 131 EFI_DEVICE_PATH Header; 132 UINT32 HID; 133 UINT32 UID; 134 } ACPI_HID_DEVICE_PATH; 135 136 #define ACPI_EXTENDED_DP 0x02 137 typedef struct _ACPI_EXTENDED_HID_DEVICE_PATH { 138 EFI_DEVICE_PATH Header; 139 UINT32 HID; 140 UINT32 UID; 141 UINT32 CID; 142 } ACPI_EXTENDED_HID_DEVICE_PATH; 143 144 #define ACPI_ADR_DP 0x03 145 /* ACPI_ADR_DEVICE_PATH not defined */ 146 147 // 148 // EISA ID Macro 149 // EISA ID Definition 32-bits 150 // bits[15:0] - three character compressed ASCII EISA ID. 151 // bits[31:16] - binary number 152 // Compressed ASCII is 5 bits per character 0b00001 = 'A' 0b11010 = 'Z' 153 // 154 #define PNP_EISA_ID_CONST 0x41d0 155 #define EISA_ID(_Name, _Num) ((UINT32) ((_Name) | (_Num) << 16)) 156 #define EISA_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId))) 157 #define EFI_PNP_ID(_PNPId) (EISA_ID(PNP_EISA_ID_CONST, (_PNPId))) 158 159 #define PNP_EISA_ID_MASK 0xffff 160 #define EISA_ID_TO_NUM(_Id) ((_Id) >> 16) 161 /* 162 * 163 */ 164 #define MESSAGING_DEVICE_PATH 0x03 165 166 #define MSG_ATAPI_DP 0x01 167 typedef struct _ATAPI_DEVICE_PATH { 168 EFI_DEVICE_PATH Header; 169 UINT8 PrimarySecondary; 170 UINT8 SlaveMaster; 171 UINT16 Lun; 172 } ATAPI_DEVICE_PATH; 173 174 #define MSG_SCSI_DP 0x02 175 typedef struct _SCSI_DEVICE_PATH { 176 EFI_DEVICE_PATH Header; 177 UINT16 Pun; 178 UINT16 Lun; 179 } SCSI_DEVICE_PATH; 180 181 #define MSG_FIBRECHANNEL_DP 0x03 182 typedef struct _FIBRECHANNEL_DEVICE_PATH { 183 EFI_DEVICE_PATH Header; 184 UINT32 Reserved; 185 UINT64 WWN; 186 UINT64 Lun; 187 } FIBRECHANNEL_DEVICE_PATH; 188 189 #define MSG_1394_DP 0x04 190 typedef struct _F1394_DEVICE_PATH { 191 EFI_DEVICE_PATH Header; 192 UINT32 Reserved; 193 UINT64 Guid; 194 } F1394_DEVICE_PATH; 195 196 #define MSG_USB_DP 0x05 197 typedef struct _USB_DEVICE_PATH { 198 EFI_DEVICE_PATH Header; 199 UINT8 ParentPortNumber; 200 UINT8 InterfaceNumber; 201 } USB_DEVICE_PATH; 202 203 #define MSG_USB_CLASS_DP 0x0F 204 typedef struct _USB_CLASS_DEVICE_PATH { 205 EFI_DEVICE_PATH Header; 206 UINT16 VendorId; 207 UINT16 ProductId; 208 UINT8 DeviceClass; 209 UINT8 DeviceSubClass; 210 UINT8 DeviceProtocol; 211 } USB_CLASS_DEVICE_PATH; 212 213 #define MSG_I2O_DP 0x06 214 typedef struct _I2O_DEVICE_PATH { 215 EFI_DEVICE_PATH Header; 216 UINT32 Tid; 217 } I2O_DEVICE_PATH; 218 219 #define MSG_MAC_ADDR_DP 0x0b 220 typedef struct _MAC_ADDR_DEVICE_PATH { 221 EFI_DEVICE_PATH Header; 222 EFI_MAC_ADDRESS MacAddress; 223 UINT8 IfType; 224 } MAC_ADDR_DEVICE_PATH; 225 226 #define MSG_IPv4_DP 0x0c 227 typedef struct _IPv4_DEVICE_PATH { 228 EFI_DEVICE_PATH Header; 229 EFI_IPv4_ADDRESS LocalIpAddress; 230 EFI_IPv4_ADDRESS RemoteIpAddress; 231 UINT16 LocalPort; 232 UINT16 RemotePort; 233 UINT16 Protocol; 234 BOOLEAN StaticIpAddress; 235 } IPv4_DEVICE_PATH; 236 237 #define MSG_IPv6_DP 0x0d 238 typedef struct _IPv6_DEVICE_PATH { 239 EFI_DEVICE_PATH Header; 240 EFI_IPv6_ADDRESS LocalIpAddress; 241 EFI_IPv6_ADDRESS RemoteIpAddress; 242 UINT16 LocalPort; 243 UINT16 RemotePort; 244 UINT16 Protocol; 245 BOOLEAN StaticIpAddress; 246 } IPv6_DEVICE_PATH; 247 248 #define MSG_INFINIBAND_DP 0x09 249 typedef struct _INFINIBAND_DEVICE_PATH { 250 EFI_DEVICE_PATH Header; 251 UINT32 ResourceFlags; 252 UINT8 PortGid[16]; 253 UINT64 ServiceId; 254 UINT64 TargetPortId; 255 UINT64 DeviceId; 256 } INFINIBAND_DEVICE_PATH; 257 258 #define INFINIBAND_RESOURCE_FLAG_IOC_SERVICE 0x01 259 #define INFINIBAND_RESOURCE_FLAG_EXTENDED_BOOT_ENVIRONMENT 0x02 260 #define INFINIBAND_RESOURCE_FLAG_CONSOLE_PROTOCOL 0x04 261 #define INFINIBAND_RESOURCE_FLAG_STORAGE_PROTOCOL 0x08 262 #define INFINIBAND_RESOURCE_FLAG_NETWORK_PROTOCOL 0x10 263 264 #define MSG_UART_DP 0x0e 265 typedef struct _UART_DEVICE_PATH { 266 EFI_DEVICE_PATH Header; 267 UINT32 Reserved; 268 UINT64 BaudRate; 269 UINT8 DataBits; 270 UINT8 Parity; 271 UINT8 StopBits; 272 } UART_DEVICE_PATH; 273 274 #define MSG_VENDOR_DP 0x0A 275 /* Use VENDOR_DEVICE_PATH struct */ 276 277 #define DEVICE_PATH_MESSAGING_PC_ANSI \ 278 { 0xe0c14753, 0xf9be, 0x11d2, {0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } 279 280 #define DEVICE_PATH_MESSAGING_VT_100 \ 281 { 0xdfa66065, 0xb419, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } 282 283 #define DEVICE_PATH_MESSAGING_VT_100_PLUS \ 284 { 0x7baec70b, 0x57e0, 0x4c76, {0x8e, 0x87, 0x2f, 0x9e, 0x28, 0x08, 0x83, 0x43} } 285 286 #define DEVICE_PATH_MESSAGING_VT_UTF8 \ 287 { 0xad15a0d6, 0x8bec, 0x4acf, {0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88} } 288 289 #define MSG_SATA_DP 0x12 290 typedef struct _SATA_DEVICE_PATH { 291 EFI_DEVICE_PATH Header; 292 UINT16 HBAPortNumber; 293 UINT16 PortMultiplierPortNumber; 294 UINT16 Lun; 295 } SATA_DEVICE_PATH; 296 297 #define MEDIA_DEVICE_PATH 0x04 298 299 #define MEDIA_HARDDRIVE_DP 0x01 300 typedef struct _HARDDRIVE_DEVICE_PATH { 301 EFI_DEVICE_PATH Header; 302 UINT32 PartitionNumber; 303 UINT64 PartitionStart; 304 UINT64 PartitionSize; 305 UINT8 Signature[16]; 306 UINT8 MBRType; 307 UINT8 SignatureType; 308 } HARDDRIVE_DEVICE_PATH; 309 310 #define MBR_TYPE_PCAT 0x01 311 #define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02 312 313 #define SIGNATURE_TYPE_MBR 0x01 314 #define SIGNATURE_TYPE_GUID 0x02 315 316 #define MEDIA_CDROM_DP 0x02 317 typedef struct _CDROM_DEVICE_PATH { 318 EFI_DEVICE_PATH Header; 319 UINT32 BootEntry; 320 UINT64 PartitionStart; 321 UINT64 PartitionSize; 322 } CDROM_DEVICE_PATH; 323 324 #define MEDIA_VENDOR_DP 0x03 325 /* Use VENDOR_DEVICE_PATH struct */ 326 327 #define MEDIA_FILEPATH_DP 0x04 328 typedef struct _FILEPATH_DEVICE_PATH { 329 EFI_DEVICE_PATH Header; 330 CHAR16 PathName[1]; 331 } FILEPATH_DEVICE_PATH; 332 333 #define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName) 334 335 #define MEDIA_PROTOCOL_DP 0x05 336 typedef struct _MEDIA_PROTOCOL_DEVICE_PATH { 337 EFI_DEVICE_PATH Header; 338 EFI_GUID Protocol; 339 } MEDIA_PROTOCOL_DEVICE_PATH; 340 341 342 #define BBS_DEVICE_PATH 0x05 343 #define BBS_BBS_DP 0x01 344 typedef struct _BBS_BBS_DEVICE_PATH { 345 EFI_DEVICE_PATH Header; 346 UINT16 DeviceType; 347 UINT16 StatusFlag; 348 CHAR8 String[1]; 349 } BBS_BBS_DEVICE_PATH; 350 351 /* DeviceType definitions - from BBS specification */ 352 #define BBS_TYPE_FLOPPY 0x01 353 #define BBS_TYPE_HARDDRIVE 0x02 354 #define BBS_TYPE_CDROM 0x03 355 #define BBS_TYPE_PCMCIA 0x04 356 #define BBS_TYPE_USB 0x05 357 #define BBS_TYPE_EMBEDDED_NETWORK 0x06 358 #define BBS_TYPE_DEV 0x80 359 #define BBS_TYPE_UNKNOWN 0xFF 360 361 typedef union { 362 EFI_DEVICE_PATH DevPath; 363 PCI_DEVICE_PATH Pci; 364 PCCARD_DEVICE_PATH PcCard; 365 MEMMAP_DEVICE_PATH MemMap; 366 VENDOR_DEVICE_PATH Vendor; 367 UNKNOWN_DEVICE_VENDOR_DEVICE_PATH UnknownVendor; 368 CONTROLLER_DEVICE_PATH Controller; 369 ACPI_HID_DEVICE_PATH Acpi; 370 371 ATAPI_DEVICE_PATH Atapi; 372 SCSI_DEVICE_PATH Scsi; 373 FIBRECHANNEL_DEVICE_PATH FibreChannel; 374 375 F1394_DEVICE_PATH F1394; 376 USB_DEVICE_PATH Usb; 377 USB_CLASS_DEVICE_PATH UsbClass; 378 I2O_DEVICE_PATH I2O; 379 MAC_ADDR_DEVICE_PATH MacAddr; 380 IPv4_DEVICE_PATH Ipv4; 381 IPv6_DEVICE_PATH Ipv6; 382 INFINIBAND_DEVICE_PATH InfiniBand; 383 UART_DEVICE_PATH Uart; 384 385 HARDDRIVE_DEVICE_PATH HardDrive; 386 CDROM_DEVICE_PATH CD; 387 388 FILEPATH_DEVICE_PATH FilePath; 389 MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol; 390 391 BBS_BBS_DEVICE_PATH Bbs; 392 393 } EFI_DEV_PATH; 394 395 typedef union { 396 EFI_DEVICE_PATH *DevPath; 397 PCI_DEVICE_PATH *Pci; 398 PCCARD_DEVICE_PATH *PcCard; 399 MEMMAP_DEVICE_PATH *MemMap; 400 VENDOR_DEVICE_PATH *Vendor; 401 UNKNOWN_DEVICE_VENDOR_DEVICE_PATH *UnknownVendor; 402 CONTROLLER_DEVICE_PATH *Controller; 403 ACPI_HID_DEVICE_PATH *Acpi; 404 ACPI_EXTENDED_HID_DEVICE_PATH *ExtendedAcpi; 405 406 ATAPI_DEVICE_PATH *Atapi; 407 SCSI_DEVICE_PATH *Scsi; 408 FIBRECHANNEL_DEVICE_PATH *FibreChannel; 409 410 F1394_DEVICE_PATH *F1394; 411 USB_DEVICE_PATH *Usb; 412 USB_CLASS_DEVICE_PATH *UsbClass; 413 I2O_DEVICE_PATH *I2O; 414 MAC_ADDR_DEVICE_PATH *MacAddr; 415 IPv4_DEVICE_PATH *Ipv4; 416 IPv6_DEVICE_PATH *Ipv6; 417 INFINIBAND_DEVICE_PATH *InfiniBand; 418 UART_DEVICE_PATH *Uart; 419 420 HARDDRIVE_DEVICE_PATH *HardDrive; 421 422 FILEPATH_DEVICE_PATH *FilePath; 423 MEDIA_PROTOCOL_DEVICE_PATH *MediaProtocol; 424 425 CDROM_DEVICE_PATH *CD; 426 BBS_BBS_DEVICE_PATH *Bbs; 427 428 } EFI_DEV_PATH_PTR; 429 430 #define EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID \ 431 { 0xbc62157e, 0x3e33, 0x4fec, { 0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf } } 432 433 #define EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID \ 434 { 0x8b843e20, 0x8132, 0x4852, { 0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c } } 435 436 INTERFACE_DECL(_EFI_DEVICE_PATH_PROTOCOL); 437 438 typedef 439 CHAR16* 440 (EFIAPI *EFI_DEVICE_PATH_TO_TEXT_NODE) ( 441 IN struct _EFI_DEVICE_PATH *This, 442 IN BOOLEAN DisplayOnly, 443 IN BOOLEAN AllowShortCuts 444 ); 445 446 typedef 447 CHAR16* 448 (EFIAPI *EFI_DEVICE_PATH_TO_TEXT_PATH) ( 449 IN struct _EFI_DEVICE_PATH *This, 450 IN BOOLEAN DisplayOnly, 451 IN BOOLEAN AllowShortCuts 452 ); 453 454 typedef struct _EFI_DEVICE_PATH_TO_TEXT_PROTOCOL { 455 EFI_DEVICE_PATH_TO_TEXT_NODE ConvertDeviceNodeToText; 456 EFI_DEVICE_PATH_TO_TEXT_PATH ConvertDevicePathToText; 457 } EFI_DEVICE_PATH_TO_TEXT_PROTOCOL; 458 459 #pragma pack() 460 461 #endif 462