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