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