1 /** @file 2 The EFI_SIMPLE_NETWORK_PROTOCOL provides services to initialize a network interface, 3 transmit packets, receive packets, and close a network interface. 4 5 Basic network device abstraction. 6 7 Rx - Received 8 Tx - Transmit 9 MCast - MultiCast 10 ... 11 12 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 13 This program and the accompanying materials are licensed and made available under 14 the terms and conditions of the BSD License that accompanies this distribution. 15 The full text of the license may be found at 16 http://opensource.org/licenses/bsd-license.php. 17 18 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 19 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 20 21 @par Revision Reference: 22 This Protocol is introduced in EFI Specification 1.10. 23 24 **/ 25 26 #ifndef __SIMPLE_NETWORK_H__ 27 #define __SIMPLE_NETWORK_H__ 28 29 #define EFI_SIMPLE_NETWORK_PROTOCOL_GUID \ 30 { \ 31 0xA19832B9, 0xAC25, 0x11D3, {0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D } \ 32 } 33 34 typedef struct _EFI_SIMPLE_NETWORK_PROTOCOL EFI_SIMPLE_NETWORK_PROTOCOL; 35 36 37 /// 38 /// Protocol defined in EFI1.1. 39 /// 40 typedef EFI_SIMPLE_NETWORK_PROTOCOL EFI_SIMPLE_NETWORK; 41 42 /// 43 /// Simple Network Protocol data structures. 44 /// 45 typedef struct { 46 /// 47 /// Total number of frames received. Includes frames with errors and 48 /// dropped frames. 49 /// 50 UINT64 RxTotalFrames; 51 52 /// 53 /// Number of valid frames received and copied into receive buffers. 54 /// 55 UINT64 RxGoodFrames; 56 57 /// 58 /// Number of frames below the minimum length for the media. 59 /// This would be <64 for ethernet. 60 /// 61 UINT64 RxUndersizeFrames; 62 63 /// 64 /// Number of frames longer than the maxminum length for the 65 /// media. This would be >1500 for ethernet. 66 /// 67 UINT64 RxOversizeFrames; 68 69 /// 70 /// Valid frames that were dropped because receive buffers were full. 71 /// 72 UINT64 RxDroppedFrames; 73 74 /// 75 /// Number of valid unicast frames received and not dropped. 76 /// 77 UINT64 RxUnicastFrames; 78 79 /// 80 /// Number of valid broadcast frames received and not dropped. 81 /// 82 UINT64 RxBroadcastFrames; 83 84 /// 85 /// Number of valid mutlicast frames received and not dropped. 86 /// 87 UINT64 RxMulticastFrames; 88 89 /// 90 /// Number of frames w/ CRC or alignment errors. 91 /// 92 UINT64 RxCrcErrorFrames; 93 94 /// 95 /// Total number of bytes received. Includes frames with errors 96 /// and dropped frames. 97 // 98 UINT64 RxTotalBytes; 99 100 /// 101 /// Transmit statistics. 102 /// 103 UINT64 TxTotalFrames; 104 UINT64 TxGoodFrames; 105 UINT64 TxUndersizeFrames; 106 UINT64 TxOversizeFrames; 107 UINT64 TxDroppedFrames; 108 UINT64 TxUnicastFrames; 109 UINT64 TxBroadcastFrames; 110 UINT64 TxMulticastFrames; 111 UINT64 TxCrcErrorFrames; 112 UINT64 TxTotalBytes; 113 114 /// 115 /// Number of collisions detection on this subnet. 116 /// 117 UINT64 Collisions; 118 119 /// 120 /// Number of frames destined for unsupported protocol. 121 /// 122 UINT64 UnsupportedProtocol; 123 124 /// 125 /// Number of valid frames received that were duplicated. 126 /// 127 UINT64 RxDuplicatedFrames; 128 129 /// 130 /// Number of encrypted frames received that failed to decrypt. 131 /// 132 UINT64 RxDecryptErrorFrames; 133 134 /// 135 /// Number of frames that failed to transmit after exceeding the retry limit. 136 /// 137 UINT64 TxErrorFrames; 138 139 /// 140 /// Number of frames transmitted successfully after more than one attempt. 141 /// 142 UINT64 TxRetryFrames; 143 } EFI_NETWORK_STATISTICS; 144 145 /// 146 /// The state of the network interface. 147 /// When an EFI_SIMPLE_NETWORK_PROTOCOL driver initializes a 148 /// network interface, the network interface is left in the EfiSimpleNetworkStopped state. 149 /// 150 typedef enum { 151 EfiSimpleNetworkStopped, 152 EfiSimpleNetworkStarted, 153 EfiSimpleNetworkInitialized, 154 EfiSimpleNetworkMaxState 155 } EFI_SIMPLE_NETWORK_STATE; 156 157 #define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST 0x01 158 #define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST 0x02 159 #define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST 0x04 160 #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08 161 #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10 162 163 #define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT 0x01 164 #define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT 0x02 165 #define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT 0x04 166 #define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT 0x08 167 168 #define MAX_MCAST_FILTER_CNT 16 169 typedef struct { 170 /// 171 /// Reports the current state of the network interface. 172 /// 173 UINT32 State; 174 /// 175 /// The size, in bytes, of the network interface's HW address. 176 /// 177 UINT32 HwAddressSize; 178 /// 179 /// The size, in bytes, of the network interface's media header. 180 /// 181 UINT32 MediaHeaderSize; 182 /// 183 /// The maximum size, in bytes, of the packets supported by the network interface. 184 /// 185 UINT32 MaxPacketSize; 186 /// 187 /// The size, in bytes, of the NVRAM device attached to the network interface. 188 /// 189 UINT32 NvRamSize; 190 /// 191 /// The size that must be used for all NVRAM reads and writes. The 192 /// start address for NVRAM read and write operations and the total 193 /// length of those operations, must be a multiple of this value. The 194 /// legal values for this field are 0, 1, 2, 4, and 8. 195 /// 196 UINT32 NvRamAccessSize; 197 /// 198 /// The multicast receive filter settings supported by the network interface. 199 /// 200 UINT32 ReceiveFilterMask; 201 /// 202 /// The current multicast receive filter settings. 203 /// 204 UINT32 ReceiveFilterSetting; 205 /// 206 /// The maximum number of multicast address receive filters supported by the driver. 207 /// 208 UINT32 MaxMCastFilterCount; 209 /// 210 /// The current number of multicast address receive filters. 211 /// 212 UINT32 MCastFilterCount; 213 /// 214 /// Array containing the addresses of the current multicast address receive filters. 215 /// 216 EFI_MAC_ADDRESS MCastFilter[MAX_MCAST_FILTER_CNT]; 217 /// 218 /// The current HW MAC address for the network interface. 219 /// 220 EFI_MAC_ADDRESS CurrentAddress; 221 /// 222 /// The current HW MAC address for broadcast packets. 223 /// 224 EFI_MAC_ADDRESS BroadcastAddress; 225 /// 226 /// The permanent HW MAC address for the network interface. 227 /// 228 EFI_MAC_ADDRESS PermanentAddress; 229 /// 230 /// The interface type of the network interface. 231 /// 232 UINT8 IfType; 233 /// 234 /// TRUE if the HW MAC address can be changed. 235 /// 236 BOOLEAN MacAddressChangeable; 237 /// 238 /// TRUE if the network interface can transmit more than one packet at a time. 239 /// 240 BOOLEAN MultipleTxSupported; 241 /// 242 /// TRUE if the presence of media can be determined; otherwise FALSE. 243 /// 244 BOOLEAN MediaPresentSupported; 245 /// 246 /// TRUE if media are connected to the network interface; otherwise FALSE. 247 /// 248 BOOLEAN MediaPresent; 249 } EFI_SIMPLE_NETWORK_MODE; 250 251 // 252 // Protocol Member Functions 253 // 254 /** 255 Changes the state of a network interface from "stopped" to "started". 256 257 @param This Protocol instance pointer. 258 259 @retval EFI_SUCCESS The network interface was started. 260 @retval EFI_ALREADY_STARTED The network interface is already in the started state. 261 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 262 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 263 @retval EFI_UNSUPPORTED This function is not supported by the network interface. 264 265 **/ 266 typedef 267 EFI_STATUS 268 (EFIAPI *EFI_SIMPLE_NETWORK_START)( 269 IN EFI_SIMPLE_NETWORK_PROTOCOL *This 270 ); 271 272 /** 273 Changes the state of a network interface from "started" to "stopped". 274 275 @param This Protocol instance pointer. 276 277 @retval EFI_SUCCESS The network interface was stopped. 278 @retval EFI_ALREADY_STARTED The network interface is already in the stopped state. 279 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 280 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 281 @retval EFI_UNSUPPORTED This function is not supported by the network interface. 282 283 **/ 284 typedef 285 EFI_STATUS 286 (EFIAPI *EFI_SIMPLE_NETWORK_STOP)( 287 IN EFI_SIMPLE_NETWORK_PROTOCOL *This 288 ); 289 290 /** 291 Resets a network adapter and allocates the transmit and receive buffers 292 required by the network interface; optionally, also requests allocation 293 of additional transmit and receive buffers. 294 295 @param This The protocol instance pointer. 296 @param ExtraRxBufferSize The size, in bytes, of the extra receive buffer space 297 that the driver should allocate for the network interface. 298 Some network interfaces will not be able to use the extra 299 buffer, and the caller will not know if it is actually 300 being used. 301 @param ExtraTxBufferSize The size, in bytes, of the extra transmit buffer space 302 that the driver should allocate for the network interface. 303 Some network interfaces will not be able to use the extra 304 buffer, and the caller will not know if it is actually 305 being used. 306 307 @retval EFI_SUCCESS The network interface was initialized. 308 @retval EFI_NOT_STARTED The network interface has not been started. 309 @retval EFI_OUT_OF_RESOURCES There was not enough memory for the transmit and 310 receive buffers. 311 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 312 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 313 @retval EFI_UNSUPPORTED This function is not supported by the network interface. 314 315 **/ 316 typedef 317 EFI_STATUS 318 (EFIAPI *EFI_SIMPLE_NETWORK_INITIALIZE)( 319 IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 320 IN UINTN ExtraRxBufferSize OPTIONAL, 321 IN UINTN ExtraTxBufferSize OPTIONAL 322 ); 323 324 /** 325 Resets a network adapter and re-initializes it with the parameters that were 326 provided in the previous call to Initialize(). 327 328 @param This The protocol instance pointer. 329 @param ExtendedVerification Indicates that the driver may perform a more 330 exhaustive verification operation of the device 331 during reset. 332 333 @retval EFI_SUCCESS The network interface was reset. 334 @retval EFI_NOT_STARTED The network interface has not been started. 335 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 336 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 337 @retval EFI_UNSUPPORTED This function is not supported by the network interface. 338 339 **/ 340 typedef 341 EFI_STATUS 342 (EFIAPI *EFI_SIMPLE_NETWORK_RESET)( 343 IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 344 IN BOOLEAN ExtendedVerification 345 ); 346 347 /** 348 Resets a network adapter and leaves it in a state that is safe for 349 another driver to initialize. 350 351 @param This Protocol instance pointer. 352 353 @retval EFI_SUCCESS The network interface was shutdown. 354 @retval EFI_NOT_STARTED The network interface has not been started. 355 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 356 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 357 @retval EFI_UNSUPPORTED This function is not supported by the network interface. 358 359 **/ 360 typedef 361 EFI_STATUS 362 (EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN)( 363 IN EFI_SIMPLE_NETWORK_PROTOCOL *This 364 ); 365 366 /** 367 Manages the multicast receive filters of a network interface. 368 369 @param This The protocol instance pointer. 370 @param Enable A bit mask of receive filters to enable on the network interface. 371 @param Disable A bit mask of receive filters to disable on the network interface. 372 @param ResetMCastFilter Set to TRUE to reset the contents of the multicast receive 373 filters on the network interface to their default values. 374 @param McastFilterCnt Number of multicast HW MAC addresses in the new 375 MCastFilter list. This value must be less than or equal to 376 the MCastFilterCnt field of EFI_SIMPLE_NETWORK_MODE. This 377 field is optional if ResetMCastFilter is TRUE. 378 @param MCastFilter A pointer to a list of new multicast receive filter HW MAC 379 addresses. This list will replace any existing multicast 380 HW MAC address list. This field is optional if 381 ResetMCastFilter is TRUE. 382 383 @retval EFI_SUCCESS The multicast receive filter list was updated. 384 @retval EFI_NOT_STARTED The network interface has not been started. 385 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 386 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 387 @retval EFI_UNSUPPORTED This function is not supported by the network interface. 388 389 **/ 390 typedef 391 EFI_STATUS 392 (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE_FILTERS)( 393 IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 394 IN UINT32 Enable, 395 IN UINT32 Disable, 396 IN BOOLEAN ResetMCastFilter, 397 IN UINTN MCastFilterCnt OPTIONAL, 398 IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL 399 ); 400 401 /** 402 Modifies or resets the current station address, if supported. 403 404 @param This The protocol instance pointer. 405 @param Reset Flag used to reset the station address to the network interfaces 406 permanent address. 407 @param New The new station address to be used for the network interface. 408 409 @retval EFI_SUCCESS The network interfaces station address was updated. 410 @retval EFI_NOT_STARTED The network interface has not been started. 411 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 412 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 413 @retval EFI_UNSUPPORTED This function is not supported by the network interface. 414 415 **/ 416 typedef 417 EFI_STATUS 418 (EFIAPI *EFI_SIMPLE_NETWORK_STATION_ADDRESS)( 419 IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 420 IN BOOLEAN Reset, 421 IN EFI_MAC_ADDRESS *New OPTIONAL 422 ); 423 424 /** 425 Resets or collects the statistics on a network interface. 426 427 @param This Protocol instance pointer. 428 @param Reset Set to TRUE to reset the statistics for the network interface. 429 @param StatisticsSize On input the size, in bytes, of StatisticsTable. On 430 output the size, in bytes, of the resulting table of 431 statistics. 432 @param StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that 433 contains the statistics. 434 435 @retval EFI_SUCCESS The statistics were collected from the network interface. 436 @retval EFI_NOT_STARTED The network interface has not been started. 437 @retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer 438 size needed to hold the statistics is returned in 439 StatisticsSize. 440 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 441 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 442 @retval EFI_UNSUPPORTED This function is not supported by the network interface. 443 444 **/ 445 typedef 446 EFI_STATUS 447 (EFIAPI *EFI_SIMPLE_NETWORK_STATISTICS)( 448 IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 449 IN BOOLEAN Reset, 450 IN OUT UINTN *StatisticsSize OPTIONAL, 451 OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL 452 ); 453 454 /** 455 Converts a multicast IP address to a multicast HW MAC address. 456 457 @param This The protocol instance pointer. 458 @param IPv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460]. Set 459 to FALSE if the multicast IP address is IPv4 [RFC 791]. 460 @param IP The multicast IP address that is to be converted to a multicast 461 HW MAC address. 462 @param MAC The multicast HW MAC address that is to be generated from IP. 463 464 @retval EFI_SUCCESS The multicast IP address was mapped to the multicast 465 HW MAC address. 466 @retval EFI_NOT_STARTED The network interface has not been started. 467 @retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer 468 size needed to hold the statistics is returned in 469 StatisticsSize. 470 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 471 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 472 @retval EFI_UNSUPPORTED This function is not supported by the network interface. 473 474 **/ 475 typedef 476 EFI_STATUS 477 (EFIAPI *EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC)( 478 IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 479 IN BOOLEAN IPv6, 480 IN EFI_IP_ADDRESS *IP, 481 OUT EFI_MAC_ADDRESS *MAC 482 ); 483 484 /** 485 Performs read and write operations on the NVRAM device attached to a 486 network interface. 487 488 @param This The protocol instance pointer. 489 @param ReadWrite TRUE for read operations, FALSE for write operations. 490 @param Offset Byte offset in the NVRAM device at which to start the read or 491 write operation. This must be a multiple of NvRamAccessSize and 492 less than NvRamSize. 493 @param BufferSize The number of bytes to read or write from the NVRAM device. 494 This must also be a multiple of NvramAccessSize. 495 @param Buffer A pointer to the data buffer. 496 497 @retval EFI_SUCCESS The NVRAM access was performed. 498 @retval EFI_NOT_STARTED The network interface has not been started. 499 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 500 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 501 @retval EFI_UNSUPPORTED This function is not supported by the network interface. 502 503 **/ 504 typedef 505 EFI_STATUS 506 (EFIAPI *EFI_SIMPLE_NETWORK_NVDATA)( 507 IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 508 IN BOOLEAN ReadWrite, 509 IN UINTN Offset, 510 IN UINTN BufferSize, 511 IN OUT VOID *Buffer 512 ); 513 514 /** 515 Reads the current interrupt status and recycled transmit buffer status from 516 a network interface. 517 518 @param This The protocol instance pointer. 519 @param InterruptStatus A pointer to the bit mask of the currently active interrupts 520 If this is NULL, the interrupt status will not be read from 521 the device. If this is not NULL, the interrupt status will 522 be read from the device. When the interrupt status is read, 523 it will also be cleared. Clearing the transmit interrupt 524 does not empty the recycled transmit buffer array. 525 @param TxBuf Recycled transmit buffer address. The network interface will 526 not transmit if its internal recycled transmit buffer array 527 is full. Reading the transmit buffer does not clear the 528 transmit interrupt. If this is NULL, then the transmit buffer 529 status will not be read. If there are no transmit buffers to 530 recycle and TxBuf is not NULL, * TxBuf will be set to NULL. 531 532 @retval EFI_SUCCESS The status of the network interface was retrieved. 533 @retval EFI_NOT_STARTED The network interface has not been started. 534 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 535 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 536 @retval EFI_UNSUPPORTED This function is not supported by the network interface. 537 538 **/ 539 typedef 540 EFI_STATUS 541 (EFIAPI *EFI_SIMPLE_NETWORK_GET_STATUS)( 542 IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 543 OUT UINT32 *InterruptStatus OPTIONAL, 544 OUT VOID **TxBuf OPTIONAL 545 ); 546 547 /** 548 Places a packet in the transmit queue of a network interface. 549 550 @param This The protocol instance pointer. 551 @param HeaderSize The size, in bytes, of the media header to be filled in by 552 the Transmit() function. If HeaderSize is non-zero, then it 553 must be equal to This->Mode->MediaHeaderSize and the DestAddr 554 and Protocol parameters must not be NULL. 555 @param BufferSize The size, in bytes, of the entire packet (media header and 556 data) to be transmitted through the network interface. 557 @param Buffer A pointer to the packet (media header followed by data) to be 558 transmitted. This parameter cannot be NULL. If HeaderSize is zero, 559 then the media header in Buffer must already be filled in by the 560 caller. If HeaderSize is non-zero, then the media header will be 561 filled in by the Transmit() function. 562 @param SrcAddr The source HW MAC address. If HeaderSize is zero, then this parameter 563 is ignored. If HeaderSize is non-zero and SrcAddr is NULL, then 564 This->Mode->CurrentAddress is used for the source HW MAC address. 565 @param DestAddr The destination HW MAC address. If HeaderSize is zero, then this 566 parameter is ignored. 567 @param Protocol The type of header to build. If HeaderSize is zero, then this 568 parameter is ignored. See RFC 1700, section "Ether Types", for 569 examples. 570 571 @retval EFI_SUCCESS The packet was placed on the transmit queue. 572 @retval EFI_NOT_STARTED The network interface has not been started. 573 @retval EFI_NOT_READY The network interface is too busy to accept this transmit request. 574 @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small. 575 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 576 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 577 @retval EFI_UNSUPPORTED This function is not supported by the network interface. 578 579 **/ 580 typedef 581 EFI_STATUS 582 (EFIAPI *EFI_SIMPLE_NETWORK_TRANSMIT)( 583 IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 584 IN UINTN HeaderSize, 585 IN UINTN BufferSize, 586 IN VOID *Buffer, 587 IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL, 588 IN EFI_MAC_ADDRESS *DestAddr OPTIONAL, 589 IN UINT16 *Protocol OPTIONAL 590 ); 591 592 /** 593 Receives a packet from a network interface. 594 595 @param This The protocol instance pointer. 596 @param HeaderSize The size, in bytes, of the media header received on the network 597 interface. If this parameter is NULL, then the media header size 598 will not be returned. 599 @param BufferSize On entry, the size, in bytes, of Buffer. On exit, the size, in 600 bytes, of the packet that was received on the network interface. 601 @param Buffer A pointer to the data buffer to receive both the media header and 602 the data. 603 @param SrcAddr The source HW MAC address. If this parameter is NULL, the 604 HW MAC source address will not be extracted from the media 605 header. 606 @param DestAddr The destination HW MAC address. If this parameter is NULL, 607 the HW MAC destination address will not be extracted from the 608 media header. 609 @param Protocol The media header type. If this parameter is NULL, then the 610 protocol will not be extracted from the media header. See 611 RFC 1700 section "Ether Types" for examples. 612 613 @retval EFI_SUCCESS The received data was stored in Buffer, and BufferSize has 614 been updated to the number of bytes received. 615 @retval EFI_NOT_STARTED The network interface has not been started. 616 @retval EFI_NOT_READY The network interface is too busy to accept this transmit 617 request. 618 @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small. 619 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value. 620 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface. 621 @retval EFI_UNSUPPORTED This function is not supported by the network interface. 622 623 **/ 624 typedef 625 EFI_STATUS 626 (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE)( 627 IN EFI_SIMPLE_NETWORK_PROTOCOL *This, 628 OUT UINTN *HeaderSize OPTIONAL, 629 IN OUT UINTN *BufferSize, 630 OUT VOID *Buffer, 631 OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL, 632 OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL, 633 OUT UINT16 *Protocol OPTIONAL 634 ); 635 636 #define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION 0x00010000 637 638 // 639 // Revision defined in EFI1.1 640 // 641 #define EFI_SIMPLE_NETWORK_INTERFACE_REVISION EFI_SIMPLE_NETWORK_PROTOCOL_REVISION 642 643 /// 644 /// The EFI_SIMPLE_NETWORK_PROTOCOL protocol is used to initialize access 645 /// to a network adapter. Once the network adapter initializes, 646 /// the EFI_SIMPLE_NETWORK_PROTOCOL protocol provides services that 647 /// allow packets to be transmitted and received. 648 /// 649 struct _EFI_SIMPLE_NETWORK_PROTOCOL { 650 /// 651 /// Revision of the EFI_SIMPLE_NETWORK_PROTOCOL. All future revisions must 652 /// be backwards compatible. If a future version is not backwards compatible 653 /// it is not the same GUID. 654 /// 655 UINT64 Revision; 656 EFI_SIMPLE_NETWORK_START Start; 657 EFI_SIMPLE_NETWORK_STOP Stop; 658 EFI_SIMPLE_NETWORK_INITIALIZE Initialize; 659 EFI_SIMPLE_NETWORK_RESET Reset; 660 EFI_SIMPLE_NETWORK_SHUTDOWN Shutdown; 661 EFI_SIMPLE_NETWORK_RECEIVE_FILTERS ReceiveFilters; 662 EFI_SIMPLE_NETWORK_STATION_ADDRESS StationAddress; 663 EFI_SIMPLE_NETWORK_STATISTICS Statistics; 664 EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC MCastIpToMac; 665 EFI_SIMPLE_NETWORK_NVDATA NvData; 666 EFI_SIMPLE_NETWORK_GET_STATUS GetStatus; 667 EFI_SIMPLE_NETWORK_TRANSMIT Transmit; 668 EFI_SIMPLE_NETWORK_RECEIVE Receive; 669 /// 670 /// Event used with WaitForEvent() to wait for a packet to be received. 671 /// 672 EFI_EVENT WaitForPacket; 673 /// 674 /// Pointer to the EFI_SIMPLE_NETWORK_MODE data for the device. 675 /// 676 EFI_SIMPLE_NETWORK_MODE *Mode; 677 }; 678 679 extern EFI_GUID gEfiSimpleNetworkProtocolGuid; 680 681 #endif 682