1 #ifndef _EFIPXEBC_H 2 #define _EFIPXEBC_H 3 4 /*++ 5 6 Copyright (c) 1998 Intel Corporation 7 8 Module Name: 9 10 efipxebc.h 11 12 Abstract: 13 14 EFI PXE Base Code Protocol 15 16 17 18 Revision History 19 20 --*/ 21 22 // 23 // PXE Base Code protocol 24 // 25 26 #define EFI_PXE_BASE_CODE_PROTOCOL_GUID \ 27 { 0x03c4e603, 0xac28, 0x11d3, {0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } 28 29 INTERFACE_DECL(_EFI_PXE_BASE_CODE_PROTOCOL); 30 31 #define DEFAULT_TTL 4 32 #define DEFAULT_ToS 0 33 // 34 // Address definitions 35 // 36 37 typedef union { 38 UINT32 Addr[4]; 39 EFI_IPv4_ADDRESS v4; 40 EFI_IPv6_ADDRESS v6; 41 } EFI_IP_ADDRESS; 42 43 typedef UINT16 EFI_PXE_BASE_CODE_UDP_PORT; 44 45 // 46 // Packet definitions 47 // 48 49 typedef struct { 50 UINT8 BootpOpcode; 51 UINT8 BootpHwType; 52 UINT8 BootpHwAddrLen; 53 UINT8 BootpGateHops; 54 UINT32 BootpIdent; 55 UINT16 BootpSeconds; 56 UINT16 BootpFlags; 57 UINT8 BootpCiAddr[4]; 58 UINT8 BootpYiAddr[4]; 59 UINT8 BootpSiAddr[4]; 60 UINT8 BootpGiAddr[4]; 61 UINT8 BootpHwAddr[16]; 62 UINT8 BootpSrvName[64]; 63 UINT8 BootpBootFile[128]; 64 UINT32 DhcpMagik; 65 UINT8 DhcpOptions[56]; 66 } EFI_PXE_BASE_CODE_DHCPV4_PACKET; 67 68 typedef struct { 69 UINT32 MessageType:8; 70 UINT32 TransactionId:24; 71 UINT8 DhcpOptions[1024]; 72 } EFI_PXE_BASE_CODE_DHCPV6_PACKET; 73 74 typedef union { 75 UINT8 Raw[1472]; 76 EFI_PXE_BASE_CODE_DHCPV4_PACKET Dhcpv4; 77 EFI_PXE_BASE_CODE_DHCPV6_PACKET Dhcpv6; 78 } EFI_PXE_BASE_CODE_PACKET; 79 80 typedef struct { 81 UINT8 Type; 82 UINT8 Code; 83 UINT16 Checksum; 84 union { 85 UINT32 reserved; 86 UINT32 Mtu; 87 UINT32 Pointer; 88 struct { 89 UINT16 Identifier; 90 UINT16 Sequence; 91 } Echo; 92 } u; 93 UINT8 Data[494]; 94 } EFI_PXE_BASE_CODE_ICMP_ERROR; 95 96 typedef struct { 97 UINT8 ErrorCode; 98 CHAR8 ErrorString[127]; 99 } EFI_PXE_BASE_CODE_TFTP_ERROR; 100 101 // 102 // IP Receive Filter definitions 103 // 104 #define EFI_PXE_BASE_CODE_MAX_IPCNT 8 105 typedef struct { 106 UINT8 Filters; 107 UINT8 IpCnt; 108 UINT16 reserved; 109 EFI_IP_ADDRESS IpList[EFI_PXE_BASE_CODE_MAX_IPCNT]; 110 } EFI_PXE_BASE_CODE_IP_FILTER; 111 112 #define EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP 0x0001 113 #define EFI_PXE_BASE_CODE_IP_FILTER_BROADCAST 0x0002 114 #define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS 0x0004 115 #define EFI_PXE_BASE_CODE_IP_FILTER_PROMISCUOUS_MULTICAST 0x0008 116 117 // 118 // ARP Cache definitions 119 // 120 121 typedef struct { 122 EFI_IP_ADDRESS IpAddr; 123 EFI_MAC_ADDRESS MacAddr; 124 } EFI_PXE_BASE_CODE_ARP_ENTRY; 125 126 typedef struct { 127 EFI_IP_ADDRESS IpAddr; 128 EFI_IP_ADDRESS SubnetMask; 129 EFI_IP_ADDRESS GwAddr; 130 } EFI_PXE_BASE_CODE_ROUTE_ENTRY; 131 132 // 133 // UDP definitions 134 // 135 136 #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_IP 0x0001 137 #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_SRC_PORT 0x0002 138 #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_IP 0x0004 139 #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT 0x0008 140 #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_USE_FILTER 0x0010 141 #define EFI_PXE_BASE_CODE_UDP_OPFLAGS_MAY_FRAGMENT 0x0020 142 143 // 144 // Discover() definitions 145 // 146 147 #define EFI_PXE_BASE_CODE_BOOT_TYPE_BOOTSTRAP 0 148 #define EFI_PXE_BASE_CODE_BOOT_TYPE_MS_WINNT_RIS 1 149 #define EFI_PXE_BASE_CODE_BOOT_TYPE_INTEL_LCM 2 150 #define EFI_PXE_BASE_CODE_BOOT_TYPE_DOSUNDI 3 151 #define EFI_PXE_BASE_CODE_BOOT_TYPE_NEC_ESMPRO 4 152 #define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_WSoD 5 153 #define EFI_PXE_BASE_CODE_BOOT_TYPE_IBM_LCCM 6 154 #define EFI_PXE_BASE_CODE_BOOT_TYPE_CA_UNICENTER_TNG 7 155 #define EFI_PXE_BASE_CODE_BOOT_TYPE_HP_OPENVIEW 8 156 #define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_9 9 157 #define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_10 10 158 #define EFI_PXE_BASE_CODE_BOOT_TYPE_ALTIRIS_11 11 159 #define EFI_PXE_BASE_CODE_BOOT_TYPE_NOT_USED_12 12 160 #define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_INSTALL 13 161 #define EFI_PXE_BASE_CODE_BOOT_TYPE_REDHAT_BOOT 14 162 #define EFI_PXE_BASE_CODE_BOOT_TYPE_REMBO 15 163 #define EFI_PXE_BASE_CODE_BOOT_TYPE_BEOBOOT 16 164 // 165 // 17 through 32767 are reserved 166 // 32768 through 65279 are for vendor use 167 // 65280 through 65534 are reserved 168 // 169 #define EFI_PXE_BASE_CODE_BOOT_TYPE_PXETEST 65535 170 171 #define EFI_PXE_BASE_CODE_BOOT_LAYER_MASK 0x7FFF 172 #define EFI_PXE_BASE_CODE_BOOT_LAYER_INITIAL 0x0000 173 174 175 typedef struct { 176 UINT16 Type; 177 BOOLEAN AcceptAnyResponse; 178 UINT8 Reserved; 179 EFI_IP_ADDRESS IpAddr; 180 } EFI_PXE_BASE_CODE_SRVLIST; 181 182 typedef struct { 183 BOOLEAN UseMCast; 184 BOOLEAN UseBCast; 185 BOOLEAN UseUCast; 186 BOOLEAN MustUseList; 187 EFI_IP_ADDRESS ServerMCastIp; 188 UINT16 IpCnt; 189 EFI_PXE_BASE_CODE_SRVLIST SrvList[1]; 190 } EFI_PXE_BASE_CODE_DISCOVER_INFO; 191 192 // 193 // Mtftp() definitions 194 // 195 196 typedef enum { 197 EFI_PXE_BASE_CODE_TFTP_FIRST, 198 EFI_PXE_BASE_CODE_TFTP_GET_FILE_SIZE, 199 EFI_PXE_BASE_CODE_TFTP_READ_FILE, 200 EFI_PXE_BASE_CODE_TFTP_WRITE_FILE, 201 EFI_PXE_BASE_CODE_TFTP_READ_DIRECTORY, 202 EFI_PXE_BASE_CODE_MTFTP_GET_FILE_SIZE, 203 EFI_PXE_BASE_CODE_MTFTP_READ_FILE, 204 EFI_PXE_BASE_CODE_MTFTP_READ_DIRECTORY, 205 EFI_PXE_BASE_CODE_MTFTP_LAST 206 } EFI_PXE_BASE_CODE_TFTP_OPCODE; 207 208 typedef struct { 209 EFI_IP_ADDRESS MCastIp; 210 EFI_PXE_BASE_CODE_UDP_PORT CPort; 211 EFI_PXE_BASE_CODE_UDP_PORT SPort; 212 UINT16 ListenTimeout; 213 UINT16 TransmitTimeout; 214 } EFI_PXE_BASE_CODE_MTFTP_INFO; 215 216 // 217 // PXE Base Code Mode structure 218 // 219 220 #define EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES 8 221 #define EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES 8 222 223 typedef struct { 224 BOOLEAN Started; 225 BOOLEAN Ipv6Available; 226 BOOLEAN Ipv6Supported; 227 BOOLEAN UsingIpv6; 228 BOOLEAN BisSupported; 229 BOOLEAN BisDetected; 230 BOOLEAN AutoArp; 231 BOOLEAN SendGUID; 232 BOOLEAN DhcpDiscoverValid; 233 BOOLEAN DhcpAckReceived; 234 BOOLEAN ProxyOfferReceived; 235 BOOLEAN PxeDiscoverValid; 236 BOOLEAN PxeReplyReceived; 237 BOOLEAN PxeBisReplyReceived; 238 BOOLEAN IcmpErrorReceived; 239 BOOLEAN TftpErrorReceived; 240 BOOLEAN MakeCallbacks; 241 UINT8 TTL; 242 UINT8 ToS; 243 EFI_IP_ADDRESS StationIp; 244 EFI_IP_ADDRESS SubnetMask; 245 EFI_PXE_BASE_CODE_PACKET DhcpDiscover; 246 EFI_PXE_BASE_CODE_PACKET DhcpAck; 247 EFI_PXE_BASE_CODE_PACKET ProxyOffer; 248 EFI_PXE_BASE_CODE_PACKET PxeDiscover; 249 EFI_PXE_BASE_CODE_PACKET PxeReply; 250 EFI_PXE_BASE_CODE_PACKET PxeBisReply; 251 EFI_PXE_BASE_CODE_IP_FILTER IpFilter; 252 UINT32 ArpCacheEntries; 253 EFI_PXE_BASE_CODE_ARP_ENTRY ArpCache[EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES]; 254 UINT32 RouteTableEntries; 255 EFI_PXE_BASE_CODE_ROUTE_ENTRY RouteTable[EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES]; 256 EFI_PXE_BASE_CODE_ICMP_ERROR IcmpError; 257 EFI_PXE_BASE_CODE_TFTP_ERROR TftpError; 258 } EFI_PXE_BASE_CODE_MODE; 259 260 // 261 // PXE Base Code Interface Function definitions 262 // 263 264 typedef 265 EFI_STATUS 266 (EFIAPI *EFI_PXE_BASE_CODE_START) ( 267 IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This, 268 IN BOOLEAN UseIpv6 269 ); 270 271 typedef 272 EFI_STATUS 273 (EFIAPI *EFI_PXE_BASE_CODE_STOP) ( 274 IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This 275 ); 276 277 typedef 278 EFI_STATUS 279 (EFIAPI *EFI_PXE_BASE_CODE_DHCP) ( 280 IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This, 281 IN BOOLEAN SortOffers 282 ); 283 284 typedef 285 EFI_STATUS 286 (EFIAPI *EFI_PXE_BASE_CODE_DISCOVER) ( 287 IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This, 288 IN UINT16 Type, 289 IN UINT16 *Layer, 290 IN BOOLEAN UseBis, 291 IN OUT EFI_PXE_BASE_CODE_DISCOVER_INFO *Info OPTIONAL 292 ); 293 294 typedef 295 EFI_STATUS 296 (EFIAPI *EFI_PXE_BASE_CODE_MTFTP) ( 297 IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This, 298 IN EFI_PXE_BASE_CODE_TFTP_OPCODE Operation, 299 IN OUT VOID *BufferPtr OPTIONAL, 300 IN BOOLEAN Overwrite, 301 IN OUT UINT64 *BufferSize, 302 IN UINTN *BlockSize OPTIONAL, 303 IN EFI_IP_ADDRESS *ServerIp, 304 IN UINT8 *Filename, 305 IN EFI_PXE_BASE_CODE_MTFTP_INFO *Info OPTIONAL, 306 IN BOOLEAN DontUseBuffer 307 ); 308 309 typedef 310 EFI_STATUS 311 (EFIAPI *EFI_PXE_BASE_CODE_UDP_WRITE) ( 312 IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This, 313 IN UINT16 OpFlags, 314 IN EFI_IP_ADDRESS *DestIp, 315 IN EFI_PXE_BASE_CODE_UDP_PORT *DestPort, 316 IN EFI_IP_ADDRESS *GatewayIp, OPTIONAL 317 IN EFI_IP_ADDRESS *SrcIp, OPTIONAL 318 IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL 319 IN UINTN *HeaderSize, OPTIONAL 320 IN VOID *HeaderPtr, OPTIONAL 321 IN UINTN *BufferSize, 322 IN VOID *BufferPtr 323 ); 324 325 typedef 326 EFI_STATUS 327 (EFIAPI *EFI_PXE_BASE_CODE_UDP_READ) ( 328 IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This, 329 IN UINT16 OpFlags, 330 IN OUT EFI_IP_ADDRESS *DestIp, OPTIONAL 331 IN OUT EFI_PXE_BASE_CODE_UDP_PORT *DestPort, OPTIONAL 332 IN OUT EFI_IP_ADDRESS *SrcIp, OPTIONAL 333 IN OUT EFI_PXE_BASE_CODE_UDP_PORT *SrcPort, OPTIONAL 334 IN UINTN *HeaderSize, OPTIONAL 335 IN VOID *HeaderPtr, OPTIONAL 336 IN OUT UINTN *BufferSize, 337 IN VOID *BufferPtr 338 ); 339 340 typedef 341 EFI_STATUS 342 (EFIAPI *EFI_PXE_BASE_CODE_SET_IP_FILTER) ( 343 IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This, 344 IN EFI_PXE_BASE_CODE_IP_FILTER *NewFilter 345 ); 346 347 typedef 348 EFI_STATUS 349 (EFIAPI *EFI_PXE_BASE_CODE_ARP) ( 350 IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This, 351 IN EFI_IP_ADDRESS *IpAddr, 352 IN EFI_MAC_ADDRESS *MacAddr OPTIONAL 353 ); 354 355 typedef 356 EFI_STATUS 357 (EFIAPI *EFI_PXE_BASE_CODE_SET_PARAMETERS) ( 358 IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This, 359 IN BOOLEAN *NewAutoArp, OPTIONAL 360 IN BOOLEAN *NewSendGUID, OPTIONAL 361 IN UINT8 *NewTTL, OPTIONAL 362 IN UINT8 *NewToS, OPTIONAL 363 IN BOOLEAN *NewMakeCallback OPTIONAL 364 ); 365 366 typedef 367 EFI_STATUS 368 (EFIAPI *EFI_PXE_BASE_CODE_SET_STATION_IP) ( 369 IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This, 370 IN EFI_IP_ADDRESS *NewStationIp, OPTIONAL 371 IN EFI_IP_ADDRESS *NewSubnetMask OPTIONAL 372 ); 373 374 typedef 375 EFI_STATUS 376 (EFIAPI *EFI_PXE_BASE_CODE_SET_PACKETS) ( 377 IN struct _EFI_PXE_BASE_CODE_PROTOCOL *This, 378 BOOLEAN *NewDhcpDiscoverValid, OPTIONAL 379 BOOLEAN *NewDhcpAckReceived, OPTIONAL 380 BOOLEAN *NewProxyOfferReceived, OPTIONAL 381 BOOLEAN *NewPxeDiscoverValid, OPTIONAL 382 BOOLEAN *NewPxeReplyReceived, OPTIONAL 383 BOOLEAN *NewPxeBisReplyReceived,OPTIONAL 384 IN EFI_PXE_BASE_CODE_PACKET *NewDhcpDiscover, OPTIONAL 385 IN EFI_PXE_BASE_CODE_PACKET *NewDhcpAck, OPTIONAL 386 IN EFI_PXE_BASE_CODE_PACKET *NewProxyOffer, OPTIONAL 387 IN EFI_PXE_BASE_CODE_PACKET *NewPxeDiscover, OPTIONAL 388 IN EFI_PXE_BASE_CODE_PACKET *NewPxeReply, OPTIONAL 389 IN EFI_PXE_BASE_CODE_PACKET *NewPxeBisReply OPTIONAL 390 ); 391 392 // 393 // PXE Base Code Protocol structure 394 // 395 396 #define EFI_PXE_BASE_CODE_PROTOCOL_REVISION 0x00010000 397 #define EFI_PXE_BASE_CODE_INTERFACE_REVISION EFI_PXE_BASE_CODE_PROTOCOL_REVISION 398 399 typedef struct _EFI_PXE_BASE_CODE_PROTOCOL { 400 UINT64 Revision; 401 EFI_PXE_BASE_CODE_START Start; 402 EFI_PXE_BASE_CODE_STOP Stop; 403 EFI_PXE_BASE_CODE_DHCP Dhcp; 404 EFI_PXE_BASE_CODE_DISCOVER Discover; 405 EFI_PXE_BASE_CODE_MTFTP Mtftp; 406 EFI_PXE_BASE_CODE_UDP_WRITE UdpWrite; 407 EFI_PXE_BASE_CODE_UDP_READ UdpRead; 408 EFI_PXE_BASE_CODE_SET_IP_FILTER SetIpFilter; 409 EFI_PXE_BASE_CODE_ARP Arp; 410 EFI_PXE_BASE_CODE_SET_PARAMETERS SetParameters; 411 EFI_PXE_BASE_CODE_SET_STATION_IP SetStationIp; 412 EFI_PXE_BASE_CODE_SET_PACKETS SetPackets; 413 EFI_PXE_BASE_CODE_MODE *Mode; 414 } EFI_PXE_BASE_CODE_PROTOCOL; 415 416 // Note: Because it conflicted with the EDK2 struct name, the 417 // 'EFI_PXE_BASE_CODE_PROTOCOL' GUID definition, from older 418 // versions of gnu-efi, is now obsoleted. 419 // Use 'EFI_PXE_BASE_CODE_PROTOCOL_GUID' instead. 420 421 typedef struct _EFI_PXE_BASE_CODE_PROTOCOL _EFI_PXE_BASE_CODE; 422 typedef struct EFI_PXE_BASE_CODE_PROTOCOL EFI_PXE_BASE_CODE; 423 424 // 425 // Call Back Definitions 426 // 427 428 #define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_GUID \ 429 { 0x245dca21, 0xfb7b, 0x11d3, {0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} } 430 431 // 432 // Revision Number 433 // 434 435 #define EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_REVISION 0x00010000 436 #define EFI_PXE_BASE_CODE_CALLBACK_INTERFACE_REVISION EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_REVISION 437 438 INTERFACE_DECL(_EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL); 439 440 typedef enum { 441 EFI_PXE_BASE_CODE_FUNCTION_FIRST, 442 EFI_PXE_BASE_CODE_FUNCTION_DHCP, 443 EFI_PXE_BASE_CODE_FUNCTION_DISCOVER, 444 EFI_PXE_BASE_CODE_FUNCTION_MTFTP, 445 EFI_PXE_BASE_CODE_FUNCTION_UDP_WRITE, 446 EFI_PXE_BASE_CODE_FUNCTION_UDP_READ, 447 EFI_PXE_BASE_CODE_FUNCTION_ARP, 448 EFI_PXE_BASE_CODE_FUNCTION_IGMP, 449 EFI_PXE_BASE_CODE_PXE_FUNCTION_LAST 450 } EFI_PXE_BASE_CODE_FUNCTION; 451 452 typedef enum { 453 EFI_PXE_BASE_CODE_CALLBACK_STATUS_FIRST, 454 EFI_PXE_BASE_CODE_CALLBACK_STATUS_CONTINUE, 455 EFI_PXE_BASE_CODE_CALLBACK_STATUS_ABORT, 456 EFI_PXE_BASE_CODE_CALLBACK_STATUS_LAST 457 } EFI_PXE_BASE_CODE_CALLBACK_STATUS; 458 459 typedef 460 EFI_PXE_BASE_CODE_CALLBACK_STATUS 461 (EFIAPI *EFI_PXE_CALLBACK) ( 462 IN struct _EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL *This, 463 IN EFI_PXE_BASE_CODE_FUNCTION Function, 464 IN BOOLEAN Received, 465 IN UINT32 PacketLen, 466 IN EFI_PXE_BASE_CODE_PACKET *Packet OPTIONAL 467 ); 468 469 typedef struct _EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL { 470 UINT64 Revision; 471 EFI_PXE_CALLBACK Callback; 472 } EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL; 473 474 // Note: Because it conflicted with the EDK2 struct name, the 475 // 'EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL' GUID definition, from 476 // older versions of gnu-efi, is now obsoleted. 477 // Use 'EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_GUID' instead. 478 479 typedef struct _EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL _EFI_PXE_BASE_CODE_CALLBACK; 480 typedef EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL EFI_PXE_BASE_CODE_CALLBACK; 481 482 #endif /* _EFIPXEBC_H */ 483