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