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