1 #ifndef _DEVPATH_H 2 #define _DEVPATH_H 3 4 /*++ 5 6 Copyright (c) 1998 Intel Corporation 7 8 Module Name: 9 10 devpath.h 11 12 Abstract: 13 14 Defines for parsing the EFI Device Path structures 15 16 17 18 Revision History 19 20 --*/ 21 22 // 23 // Device Path structures - Section C 24 // 25 26 typedef struct _EFI_DEVICE_PATH { 27 UINT8 Type; 28 UINT8 SubType; 29 UINT8 Length[2]; 30 } EFI_DEVICE_PATH; 31 32 #define EFI_DP_TYPE_MASK 0x7F 33 #define EFI_DP_TYPE_UNPACKED 0x80 34 35 //#define END_DEVICE_PATH_TYPE 0xff 36 #define END_DEVICE_PATH_TYPE 0x7f 37 //#define END_DEVICE_PATH_TYPE_UNPACKED 0x7f 38 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)) 42 43 44 #define DP_IS_END_TYPE(a) 45 #define DP_IS_END_SUBTYPE(a) ( ((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE ) 46 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 ) 56 57 58 #define SetDevicePathNodeLength(a,l) { \ 59 (a)->Length[0] = (UINT8) (l); \ 60 (a)->Length[1] = (UINT8) ((l) >> 8); \ 61 } 62 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); \ 67 (a)->Length[1] = 0; \ 68 } 69 70 71 72 /* 73 * 74 */ 75 #define HARDWARE_DEVICE_PATH 0x01 76 77 #define HW_PCI_DP 0x01 78 typedef struct _PCI_DEVICE_PATH { 79 EFI_DEVICE_PATH Header; 80 UINT8 Function; 81 UINT8 Device; 82 } PCI_DEVICE_PATH; 83 84 #define HW_PCCARD_DP 0x02 85 typedef struct _PCCARD_DEVICE_PATH { 86 EFI_DEVICE_PATH Header; 87 UINT8 SocketNumber; 88 } PCCARD_DEVICE_PATH; 89 90 #define HW_MEMMAP_DP 0x03 91 typedef struct _MEMMAP_DEVICE_PATH { 92 EFI_DEVICE_PATH Header; 93 UINT32 MemoryType; 94 EFI_PHYSICAL_ADDRESS StartingAddress; 95 EFI_PHYSICAL_ADDRESS EndingAddress; 96 } MEMMAP_DEVICE_PATH; 97 98 #define HW_VENDOR_DP 0x04 99 typedef struct _VENDOR_DEVICE_PATH { 100 EFI_DEVICE_PATH Header; 101 EFI_GUID Guid; 102 } VENDOR_DEVICE_PATH; 103 104 #define UNKNOWN_DEVICE_GUID \ 105 { 0xcf31fac5, 0xc24e, 0x11d2, {0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b} } 106 107 typedef struct _UKNOWN_DEVICE_VENDOR_DP { 108 VENDOR_DEVICE_PATH DevicePath; 109 UINT8 LegacyDriveLetter; 110 } UNKNOWN_DEVICE_VENDOR_DEVICE_PATH; 111 112 #define HW_CONTROLLER_DP 0x05 113 typedef struct _CONTROLLER_DEVICE_PATH { 114 EFI_DEVICE_PATH Header; 115 UINT32 Controller; 116 } CONTROLLER_DEVICE_PATH; 117 118 /* 119 * 120 */ 121 #define ACPI_DEVICE_PATH 0x02 122 123 #define ACPI_DP 0x01 124 typedef struct _ACPI_HID_DEVICE_PATH { 125 EFI_DEVICE_PATH Header; 126 UINT32 HID; 127 UINT32 UID; 128 } ACPI_HID_DEVICE_PATH; 129 130 #define EXPANDED_ACPI_DP 0x02 131 typedef struct _EXPANDED_ACPI_HID_DEVICE_PATH { 132 EFI_DEVICE_PATH Header; 133 UINT32 HID; 134 UINT32 UID; 135 UINT32 CID; 136 UINT8 HidStr[1]; 137 } EXPANDED_ACPI_HID_DEVICE_PATH; 138 139 // 140 // EISA ID Macro 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' 145 // 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))) 149 150 #define PNP_EISA_ID_MASK 0xffff 151 #define EISA_ID_TO_NUM(_Id) ((_Id) >> 16) 152 /* 153 * 154 */ 155 #define MESSAGING_DEVICE_PATH 0x03 156 157 #define MSG_ATAPI_DP 0x01 158 typedef struct _ATAPI_DEVICE_PATH { 159 EFI_DEVICE_PATH Header; 160 UINT8 PrimarySecondary; 161 UINT8 SlaveMaster; 162 UINT16 Lun; 163 } ATAPI_DEVICE_PATH; 164 165 #define MSG_SCSI_DP 0x02 166 typedef struct _SCSI_DEVICE_PATH { 167 EFI_DEVICE_PATH Header; 168 UINT16 Pun; 169 UINT16 Lun; 170 } SCSI_DEVICE_PATH; 171 172 #define MSG_FIBRECHANNEL_DP 0x03 173 typedef struct _FIBRECHANNEL_DEVICE_PATH { 174 EFI_DEVICE_PATH Header; 175 UINT32 Reserved; 176 UINT64 WWN; 177 UINT64 Lun; 178 } FIBRECHANNEL_DEVICE_PATH; 179 180 #define MSG_1394_DP 0x04 181 typedef struct _F1394_DEVICE_PATH { 182 EFI_DEVICE_PATH Header; 183 UINT32 Reserved; 184 UINT64 Guid; 185 } F1394_DEVICE_PATH; 186 187 #define MSG_USB_DP 0x05 188 typedef struct _USB_DEVICE_PATH { 189 EFI_DEVICE_PATH Header; 190 UINT8 Port; 191 UINT8 Endpoint; 192 } USB_DEVICE_PATH; 193 194 #define MSG_USB_CLASS_DP 0x0F 195 typedef struct _USB_CLASS_DEVICE_PATH { 196 EFI_DEVICE_PATH Header; 197 UINT16 VendorId; 198 UINT16 ProductId; 199 UINT8 DeviceClass; 200 UINT8 DeviceSubclass; 201 UINT8 DeviceProtocol; 202 } USB_CLASS_DEVICE_PATH; 203 204 #define MSG_I2O_DP 0x06 205 typedef struct _I2O_DEVICE_PATH { 206 EFI_DEVICE_PATH Header; 207 UINT32 Tid; 208 } I2O_DEVICE_PATH; 209 210 #define MSG_MAC_ADDR_DP 0x0b 211 typedef struct _MAC_ADDR_DEVICE_PATH { 212 EFI_DEVICE_PATH Header; 213 EFI_MAC_ADDRESS MacAddress; 214 UINT8 IfType; 215 } MAC_ADDR_DEVICE_PATH; 216 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; 222 UINT16 LocalPort; 223 UINT16 RemotePort; 224 UINT16 Protocol; 225 BOOLEAN StaticIpAddress; 226 } IPv4_DEVICE_PATH; 227 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; 233 UINT16 LocalPort; 234 UINT16 RemotePort; 235 UINT16 Protocol; 236 BOOLEAN StaticIpAddress; 237 } IPv6_DEVICE_PATH; 238 239 #define MSG_INFINIBAND_DP 0x09 240 typedef struct _INFINIBAND_DEVICE_PATH { 241 EFI_DEVICE_PATH Header; 242 UINT32 Reserved; 243 UINT64 NodeGuid; 244 UINT64 IocGuid; 245 UINT64 DeviceId; 246 } INFINIBAND_DEVICE_PATH; 247 248 #define MSG_UART_DP 0x0e 249 typedef struct _UART_DEVICE_PATH { 250 EFI_DEVICE_PATH Header; 251 UINT32 Reserved; 252 UINT64 BaudRate; 253 UINT8 DataBits; 254 UINT8 Parity; 255 UINT8 StopBits; 256 } UART_DEVICE_PATH; 257 258 #define MSG_VENDOR_DP 0x0A 259 /* Use VENDOR_DEVICE_PATH struct */ 260 261 #define DEVICE_PATH_MESSAGING_PC_ANSI \ 262 { 0xe0c14753, 0xf9be, 0x11d2, {0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } 263 264 #define DEVICE_PATH_MESSAGING_VT_100 \ 265 { 0xdfa66065, 0xb419, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } 266 267 268 269 #define MEDIA_DEVICE_PATH 0x04 270 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; 277 UINT8 Signature[16]; 278 UINT8 MBRType; 279 UINT8 SignatureType; 280 } HARDDRIVE_DEVICE_PATH; 281 282 #define MBR_TYPE_PCAT 0x01 283 #define MBR_TYPE_EFI_PARTITION_TABLE_HEADER 0x02 284 285 #define SIGNATURE_TYPE_MBR 0x01 286 #define SIGNATURE_TYPE_GUID 0x02 287 288 #define MEDIA_CDROM_DP 0x02 289 typedef struct _CDROM_DEVICE_PATH { 290 EFI_DEVICE_PATH Header; 291 UINT32 BootEntry; 292 UINT64 PartitionStart; 293 UINT64 PartitionSize; 294 } CDROM_DEVICE_PATH; 295 296 #define MEDIA_VENDOR_DP 0x03 297 /* Use VENDOR_DEVICE_PATH struct */ 298 299 #define MEDIA_FILEPATH_DP 0x04 300 typedef struct _FILEPATH_DEVICE_PATH { 301 EFI_DEVICE_PATH Header; 302 CHAR16 PathName[1]; 303 } FILEPATH_DEVICE_PATH; 304 305 #define SIZE_OF_FILEPATH_DEVICE_PATH EFI_FIELD_OFFSET(FILEPATH_DEVICE_PATH,PathName) 306 307 #define MEDIA_PROTOCOL_DP 0x05 308 typedef struct _MEDIA_PROTOCOL_DEVICE_PATH { 309 EFI_DEVICE_PATH Header; 310 EFI_GUID Protocol; 311 } MEDIA_PROTOCOL_DEVICE_PATH; 312 313 314 #define BBS_DEVICE_PATH 0x05 315 #define BBS_BBS_DP 0x01 316 typedef struct _BBS_BBS_DEVICE_PATH { 317 EFI_DEVICE_PATH Header; 318 UINT16 DeviceType; 319 UINT16 StatusFlag; 320 CHAR8 String[1]; 321 } BBS_BBS_DEVICE_PATH; 322 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 332 333 typedef union { 334 EFI_DEVICE_PATH DevPath; 335 PCI_DEVICE_PATH Pci; 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; 342 343 ATAPI_DEVICE_PATH Atapi; 344 SCSI_DEVICE_PATH Scsi; 345 FIBRECHANNEL_DEVICE_PATH FibreChannel; 346 347 F1394_DEVICE_PATH F1394; 348 USB_DEVICE_PATH Usb; 349 USB_CLASS_DEVICE_PATH UsbClass; 350 I2O_DEVICE_PATH I2O; 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; 356 357 HARDDRIVE_DEVICE_PATH HardDrive; 358 CDROM_DEVICE_PATH CD; 359 360 FILEPATH_DEVICE_PATH FilePath; 361 MEDIA_PROTOCOL_DEVICE_PATH MediaProtocol; 362 363 BBS_BBS_DEVICE_PATH Bbs; 364 365 } EFI_DEV_PATH; 366 367 typedef union { 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; 376 377 ATAPI_DEVICE_PATH *Atapi; 378 SCSI_DEVICE_PATH *Scsi; 379 FIBRECHANNEL_DEVICE_PATH *FibreChannel; 380 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; 390 391 HARDDRIVE_DEVICE_PATH *HardDrive; 392 393 FILEPATH_DEVICE_PATH *FilePath; 394 MEDIA_PROTOCOL_DEVICE_PATH *MediaProtocol; 395 396 CDROM_DEVICE_PATH *CD; 397 BBS_BBS_DEVICE_PATH *Bbs; 398 399 } EFI_DEV_PATH_PTR; 400 401 402 #endif 403