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