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 - 2010, 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 } EFI_NETWORK_STATISTICS;
125 
126 ///
127 /// The state of the network interface.
128 /// When an EFI_SIMPLE_NETWORK_PROTOCOL driver initializes a
129 /// network interface, the network interface is left in the EfiSimpleNetworkStopped state.
130 ///
131 typedef enum {
132   EfiSimpleNetworkStopped,
133   EfiSimpleNetworkStarted,
134   EfiSimpleNetworkInitialized,
135   EfiSimpleNetworkMaxState
136 } EFI_SIMPLE_NETWORK_STATE;
137 
138 #define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST                0x01
139 #define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST              0x02
140 #define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST              0x04
141 #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS            0x08
142 #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST  0x10
143 
144 #define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT              0x01
145 #define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT             0x02
146 #define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT              0x04
147 #define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT             0x08
148 
149 #define MAX_MCAST_FILTER_CNT                              16
150 typedef struct {
151   ///
152   /// Reports the current state of the network interface.
153   ///
154   UINT32          State;
155   ///
156   /// The size, in bytes, of the network interface's HW address.
157   ///
158   UINT32          HwAddressSize;
159   ///
160   /// The size, in bytes, of the network interface's media header.
161   ///
162   UINT32          MediaHeaderSize;
163   ///
164   /// The maximum size, in bytes, of the packets supported by the network interface.
165   ///
166   UINT32          MaxPacketSize;
167   ///
168   /// The size, in bytes, of the NVRAM device attached to the network interface.
169   ///
170   UINT32          NvRamSize;
171   ///
172   /// The size that must be used for all NVRAM reads and writes. The
173   /// start address for NVRAM read and write operations and the total
174   /// length of those operations, must be a multiple of this value. The
175   /// legal values for this field are 0, 1, 2, 4, and 8.
176   ///
177   UINT32          NvRamAccessSize;
178   ///
179   /// The multicast receive filter settings supported by the network interface.
180   ///
181   UINT32          ReceiveFilterMask;
182   ///
183   /// The current multicast receive filter settings.
184   ///
185   UINT32          ReceiveFilterSetting;
186   ///
187   /// The maximum number of multicast address receive filters supported by the driver.
188   ///
189   UINT32          MaxMCastFilterCount;
190   ///
191   /// The current number of multicast address receive filters.
192   ///
193   UINT32          MCastFilterCount;
194   ///
195   /// Array containing the addresses of the current multicast address receive filters.
196   ///
197   EFI_MAC_ADDRESS MCastFilter[MAX_MCAST_FILTER_CNT];
198   ///
199   /// The current HW MAC address for the network interface.
200   ///
201   EFI_MAC_ADDRESS CurrentAddress;
202   ///
203   /// The current HW MAC address for broadcast packets.
204   ///
205   EFI_MAC_ADDRESS BroadcastAddress;
206   ///
207   /// The permanent HW MAC address for the network interface.
208   ///
209   EFI_MAC_ADDRESS PermanentAddress;
210   ///
211   /// The interface type of the network interface.
212   ///
213   UINT8           IfType;
214   ///
215   /// TRUE if the HW MAC address can be changed.
216   ///
217   BOOLEAN         MacAddressChangeable;
218   ///
219   /// TRUE if the network interface can transmit more than one packet at a time.
220   ///
221   BOOLEAN         MultipleTxSupported;
222   ///
223   /// TRUE if the presence of media can be determined; otherwise FALSE.
224   ///
225   BOOLEAN         MediaPresentSupported;
226   ///
227   /// TRUE if media are connected to the network interface; otherwise FALSE.
228   ///
229   BOOLEAN         MediaPresent;
230 } EFI_SIMPLE_NETWORK_MODE;
231 
232 //
233 // Protocol Member Functions
234 //
235 /**
236   Changes the state of a network interface from "stopped" to "started".
237 
238   @param  This Protocol instance pointer.
239 
240   @retval EFI_SUCCESS           The network interface was started.
241   @retval EFI_ALREADY_STARTED   The network interface is already in the started state.
242   @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
243   @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.
244   @retval EFI_UNSUPPORTED       This function is not supported by the network interface.
245 
246 **/
247 typedef
248 EFI_STATUS
249 (EFIAPI *EFI_SIMPLE_NETWORK_START)(
250   IN EFI_SIMPLE_NETWORK_PROTOCOL  *This
251   );
252 
253 /**
254   Changes the state of a network interface from "started" to "stopped".
255 
256   @param  This Protocol instance pointer.
257 
258   @retval EFI_SUCCESS           The network interface was stopped.
259   @retval EFI_ALREADY_STARTED   The network interface is already in the stopped state.
260   @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
261   @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.
262   @retval EFI_UNSUPPORTED       This function is not supported by the network interface.
263 
264 **/
265 typedef
266 EFI_STATUS
267 (EFIAPI *EFI_SIMPLE_NETWORK_STOP)(
268   IN EFI_SIMPLE_NETWORK_PROTOCOL  *This
269   );
270 
271 /**
272   Resets a network adapter and allocates the transmit and receive buffers
273   required by the network interface; optionally, also requests allocation
274   of additional transmit and receive buffers.
275 
276   @param  This              The protocol instance pointer.
277   @param  ExtraRxBufferSize The size, in bytes, of the extra receive buffer space
278                             that the driver should allocate for the network interface.
279                             Some network interfaces will not be able to use the extra
280                             buffer, and the caller will not know if it is actually
281                             being used.
282   @param  ExtraTxBufferSize The size, in bytes, of the extra transmit buffer space
283                             that the driver should allocate for the network interface.
284                             Some network interfaces will not be able to use the extra
285                             buffer, and the caller will not know if it is actually
286                             being used.
287 
288   @retval EFI_SUCCESS           The network interface was initialized.
289   @retval EFI_NOT_STARTED       The network interface has not been started.
290   @retval EFI_OUT_OF_RESOURCES  There was not enough memory for the transmit and
291                                 receive buffers.
292   @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
293   @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.
294   @retval EFI_UNSUPPORTED       This function is not supported by the network interface.
295 
296 **/
297 typedef
298 EFI_STATUS
299 (EFIAPI *EFI_SIMPLE_NETWORK_INITIALIZE)(
300   IN EFI_SIMPLE_NETWORK_PROTOCOL                    *This,
301   IN UINTN                                          ExtraRxBufferSize  OPTIONAL,
302   IN UINTN                                          ExtraTxBufferSize  OPTIONAL
303   );
304 
305 /**
306   Resets a network adapter and re-initializes it with the parameters that were
307   provided in the previous call to Initialize().
308 
309   @param  This                 The protocol instance pointer.
310   @param  ExtendedVerification Indicates that the driver may perform a more
311                                exhaustive verification operation of the device
312                                during reset.
313 
314   @retval EFI_SUCCESS           The network interface was reset.
315   @retval EFI_NOT_STARTED       The network interface has not been started.
316   @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
317   @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.
318   @retval EFI_UNSUPPORTED       This function is not supported by the network interface.
319 
320 **/
321 typedef
322 EFI_STATUS
323 (EFIAPI *EFI_SIMPLE_NETWORK_RESET)(
324   IN EFI_SIMPLE_NETWORK_PROTOCOL   *This,
325   IN BOOLEAN                       ExtendedVerification
326   );
327 
328 /**
329   Resets a network adapter and leaves it in a state that is safe for
330   another driver to initialize.
331 
332   @param  This Protocol instance pointer.
333 
334   @retval EFI_SUCCESS           The network interface was shutdown.
335   @retval EFI_NOT_STARTED       The network interface has not been started.
336   @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
337   @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.
338   @retval EFI_UNSUPPORTED       This function is not supported by the network interface.
339 
340 **/
341 typedef
342 EFI_STATUS
343 (EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN)(
344   IN EFI_SIMPLE_NETWORK_PROTOCOL  *This
345   );
346 
347 /**
348   Manages the multicast receive filters of a network interface.
349 
350   @param  This             The protocol instance pointer.
351   @param  Enable           A bit mask of receive filters to enable on the network interface.
352   @param  Disable          A bit mask of receive filters to disable on the network interface.
353   @param  ResetMCastFilter Set to TRUE to reset the contents of the multicast receive
354                            filters on the network interface to their default values.
355   @param  McastFilterCnt   Number of multicast HW MAC addresses in the new
356                            MCastFilter list. This value must be less than or equal to
357                            the MCastFilterCnt field of EFI_SIMPLE_NETWORK_MODE. This
358                            field is optional if ResetMCastFilter is TRUE.
359   @param  MCastFilter      A pointer to a list of new multicast receive filter HW MAC
360                            addresses. This list will replace any existing multicast
361                            HW MAC address list. This field is optional if
362                            ResetMCastFilter is TRUE.
363 
364   @retval EFI_SUCCESS           The multicast receive filter list was updated.
365   @retval EFI_NOT_STARTED       The network interface has not been started.
366   @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
367   @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.
368   @retval EFI_UNSUPPORTED       This function is not supported by the network interface.
369 
370 **/
371 typedef
372 EFI_STATUS
373 (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE_FILTERS)(
374   IN EFI_SIMPLE_NETWORK_PROTOCOL                             *This,
375   IN UINT32                                                  Enable,
376   IN UINT32                                                  Disable,
377   IN BOOLEAN                                                 ResetMCastFilter,
378   IN UINTN                                                   MCastFilterCnt     OPTIONAL,
379   IN EFI_MAC_ADDRESS                                         *MCastFilter OPTIONAL
380   );
381 
382 /**
383   Modifies or resets the current station address, if supported.
384 
385   @param  This  The protocol instance pointer.
386   @param  Reset Flag used to reset the station address to the network interfaces
387                 permanent address.
388   @param  New   The new station address to be used for the network interface.
389 
390   @retval EFI_SUCCESS           The network interfaces station address was updated.
391   @retval EFI_NOT_STARTED       The network interface has not been started.
392   @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
393   @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.
394   @retval EFI_UNSUPPORTED       This function is not supported by the network interface.
395 
396 **/
397 typedef
398 EFI_STATUS
399 (EFIAPI *EFI_SIMPLE_NETWORK_STATION_ADDRESS)(
400   IN EFI_SIMPLE_NETWORK_PROTOCOL            *This,
401   IN BOOLEAN                                Reset,
402   IN EFI_MAC_ADDRESS                        *New OPTIONAL
403   );
404 
405 /**
406   Resets or collects the statistics on a network interface.
407 
408   @param  This            Protocol instance pointer.
409   @param  Reset           Set to TRUE to reset the statistics for the network interface.
410   @param  StatisticsSize  On input the size, in bytes, of StatisticsTable. On
411                           output the size, in bytes, of the resulting table of
412                           statistics.
413   @param  StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that
414                           contains the statistics.
415 
416   @retval EFI_SUCCESS           The statistics were collected from the network interface.
417   @retval EFI_NOT_STARTED       The network interface has not been started.
418   @retval EFI_BUFFER_TOO_SMALL  The Statistics buffer was too small. The current buffer
419                                 size needed to hold the statistics is returned in
420                                 StatisticsSize.
421   @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
422   @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.
423   @retval EFI_UNSUPPORTED       This function is not supported by the network interface.
424 
425 **/
426 typedef
427 EFI_STATUS
428 (EFIAPI *EFI_SIMPLE_NETWORK_STATISTICS)(
429   IN EFI_SIMPLE_NETWORK_PROTOCOL          *This,
430   IN BOOLEAN                              Reset,
431   IN OUT UINTN                            *StatisticsSize   OPTIONAL,
432   OUT EFI_NETWORK_STATISTICS              *StatisticsTable  OPTIONAL
433   );
434 
435 /**
436   Converts a multicast IP address to a multicast HW MAC address.
437 
438   @param  This The protocol instance pointer.
439   @param  IPv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460]. Set
440                to FALSE if the multicast IP address is IPv4 [RFC 791].
441   @param  IP   The multicast IP address that is to be converted to a multicast
442                HW MAC address.
443   @param  MAC  The multicast HW MAC address that is to be generated from IP.
444 
445   @retval EFI_SUCCESS           The multicast IP address was mapped to the multicast
446                                 HW MAC address.
447   @retval EFI_NOT_STARTED       The network interface has not been started.
448   @retval EFI_BUFFER_TOO_SMALL  The Statistics buffer was too small. The current buffer
449                                 size needed to hold the statistics is returned in
450                                 StatisticsSize.
451   @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
452   @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.
453   @retval EFI_UNSUPPORTED       This function is not supported by the network interface.
454 
455 **/
456 typedef
457 EFI_STATUS
458 (EFIAPI *EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC)(
459   IN EFI_SIMPLE_NETWORK_PROTOCOL          *This,
460   IN BOOLEAN                              IPv6,
461   IN EFI_IP_ADDRESS                       *IP,
462   OUT EFI_MAC_ADDRESS                     *MAC
463   );
464 
465 /**
466   Performs read and write operations on the NVRAM device attached to a
467   network interface.
468 
469   @param  This       The protocol instance pointer.
470   @param  ReadWrite  TRUE for read operations, FALSE for write operations.
471   @param  Offset     Byte offset in the NVRAM device at which to start the read or
472                      write operation. This must be a multiple of NvRamAccessSize and
473                      less than NvRamSize.
474   @param  BufferSize The number of bytes to read or write from the NVRAM device.
475                      This must also be a multiple of NvramAccessSize.
476   @param  Buffer     A pointer to the data buffer.
477 
478   @retval EFI_SUCCESS           The NVRAM access was performed.
479   @retval EFI_NOT_STARTED       The network interface has not been started.
480   @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
481   @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.
482   @retval EFI_UNSUPPORTED       This function is not supported by the network interface.
483 
484 **/
485 typedef
486 EFI_STATUS
487 (EFIAPI *EFI_SIMPLE_NETWORK_NVDATA)(
488   IN EFI_SIMPLE_NETWORK_PROTOCOL          *This,
489   IN BOOLEAN                              ReadWrite,
490   IN UINTN                                Offset,
491   IN UINTN                                BufferSize,
492   IN OUT VOID                             *Buffer
493   );
494 
495 /**
496   Reads the current interrupt status and recycled transmit buffer status from
497   a network interface.
498 
499   @param  This            The protocol instance pointer.
500   @param  InterruptStatus A pointer to the bit mask of the currently active interrupts
501                           If this is NULL, the interrupt status will not be read from
502                           the device. If this is not NULL, the interrupt status will
503                           be read from the device. When the  interrupt status is read,
504                           it will also be cleared. Clearing the transmit  interrupt
505                           does not empty the recycled transmit buffer array.
506   @param  TxBuf           Recycled transmit buffer address. The network interface will
507                           not transmit if its internal recycled transmit buffer array
508                           is full. Reading the transmit buffer does not clear the
509                           transmit interrupt. If this is NULL, then the transmit buffer
510                           status will not be read. If there are no transmit buffers to
511                           recycle and TxBuf is not NULL, * TxBuf will be set to NULL.
512 
513   @retval EFI_SUCCESS           The status of the network interface was retrieved.
514   @retval EFI_NOT_STARTED       The network interface has not been started.
515   @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
516   @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.
517   @retval EFI_UNSUPPORTED       This function is not supported by the network interface.
518 
519 **/
520 typedef
521 EFI_STATUS
522 (EFIAPI *EFI_SIMPLE_NETWORK_GET_STATUS)(
523   IN EFI_SIMPLE_NETWORK_PROTOCOL          *This,
524   OUT UINT32                              *InterruptStatus OPTIONAL,
525   OUT VOID                                **TxBuf OPTIONAL
526   );
527 
528 /**
529   Places a packet in the transmit queue of a network interface.
530 
531   @param  This       The protocol instance pointer.
532   @param  HeaderSize The size, in bytes, of the media header to be filled in by
533                      the Transmit() function. If HeaderSize is non-zero, then it
534                      must be equal to This->Mode->MediaHeaderSize and the DestAddr
535                      and Protocol parameters must not be NULL.
536   @param  BufferSize The size, in bytes, of the entire packet (media header and
537                      data) to be transmitted through the network interface.
538   @param  Buffer     A pointer to the packet (media header followed by data) to be
539                      transmitted. This parameter cannot be NULL. If HeaderSize is zero,
540                      then the media header in Buffer must already be filled in by the
541                      caller. If HeaderSize is non-zero, then the media header will be
542                      filled in by the Transmit() function.
543   @param  SrcAddr    The source HW MAC address. If HeaderSize is zero, then this parameter
544                      is ignored. If HeaderSize is non-zero and SrcAddr is NULL, then
545                      This->Mode->CurrentAddress is used for the source HW MAC address.
546   @param  DestAddr   The destination HW MAC address. If HeaderSize is zero, then this
547                      parameter is ignored.
548   @param  Protocol   The type of header to build. If HeaderSize is zero, then this
549                      parameter is ignored. See RFC 1700, section "Ether Types", for
550                      examples.
551 
552   @retval EFI_SUCCESS           The packet was placed on the transmit queue.
553   @retval EFI_NOT_STARTED       The network interface has not been started.
554   @retval EFI_NOT_READY         The network interface is too busy to accept this transmit request.
555   @retval EFI_BUFFER_TOO_SMALL  The BufferSize parameter is too small.
556   @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
557   @retval EFI_DEVICE_ERROR      The command could not be sent to the network interface.
558   @retval EFI_UNSUPPORTED       This function is not supported by the network interface.
559 
560 **/
561 typedef
562 EFI_STATUS
563 (EFIAPI *EFI_SIMPLE_NETWORK_TRANSMIT)(
564   IN EFI_SIMPLE_NETWORK_PROTOCOL          *This,
565   IN UINTN                                HeaderSize,
566   IN UINTN                                BufferSize,
567   IN VOID                                 *Buffer,
568   IN EFI_MAC_ADDRESS                      *SrcAddr  OPTIONAL,
569   IN EFI_MAC_ADDRESS                      *DestAddr OPTIONAL,
570   IN UINT16                               *Protocol OPTIONAL
571   );
572 
573 /**
574   Receives a packet from a network interface.
575 
576   @param  This       The protocol instance pointer.
577   @param  HeaderSize The size, in bytes, of the media header received on the network
578                      interface. If this parameter is NULL, then the media header size
579                      will not be returned.
580   @param  BufferSize On entry, the size, in bytes, of Buffer. On exit, the size, in
581                      bytes, of the packet that was received on the network interface.
582   @param  Buffer     A pointer to the data buffer to receive both the media header and
583                      the data.
584   @param  SrcAddr    The source HW MAC address. If this parameter is NULL, the
585                      HW MAC source address will not be extracted from the media
586                      header.
587   @param  DestAddr   The destination HW MAC address. If this parameter is NULL,
588                      the HW MAC destination address will not be extracted from the
589                      media header.
590   @param  Protocol   The media header type. If this parameter is NULL, then the
591                      protocol will not be extracted from the media header. See
592                      RFC 1700 section "Ether Types" for examples.
593 
594   @retval  EFI_SUCCESS           The received data was stored in Buffer, and BufferSize has
595                                  been updated to the number of bytes received.
596   @retval  EFI_NOT_STARTED       The network interface has not been started.
597   @retval  EFI_NOT_READY         The network interface is too busy to accept this transmit
598                                  request.
599   @retval  EFI_BUFFER_TOO_SMALL  The BufferSize parameter is too small.
600   @retval  EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
601   @retval  EFI_DEVICE_ERROR      The command could not be sent to the network interface.
602   @retval  EFI_UNSUPPORTED       This function is not supported by the network interface.
603 
604 **/
605 typedef
606 EFI_STATUS
607 (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE)(
608   IN EFI_SIMPLE_NETWORK_PROTOCOL          *This,
609   OUT UINTN                               *HeaderSize OPTIONAL,
610   IN OUT UINTN                            *BufferSize,
611   OUT VOID                                *Buffer,
612   OUT EFI_MAC_ADDRESS                     *SrcAddr    OPTIONAL,
613   OUT EFI_MAC_ADDRESS                     *DestAddr   OPTIONAL,
614   OUT UINT16                              *Protocol   OPTIONAL
615   );
616 
617 #define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION  0x00010000
618 
619 //
620 // Revision defined in EFI1.1
621 //
622 #define EFI_SIMPLE_NETWORK_INTERFACE_REVISION   EFI_SIMPLE_NETWORK_PROTOCOL_REVISION
623 
624 ///
625 /// The EFI_SIMPLE_NETWORK_PROTOCOL protocol is used to initialize access
626 /// to a network adapter. Once the network adapter initializes,
627 /// the EFI_SIMPLE_NETWORK_PROTOCOL protocol provides services that
628 /// allow packets to be transmitted and received.
629 ///
630 struct _EFI_SIMPLE_NETWORK_PROTOCOL {
631   ///
632   /// Revision of the EFI_SIMPLE_NETWORK_PROTOCOL. All future revisions must
633   /// be backwards compatible. If a future version is not backwards compatible
634   /// it is not the same GUID.
635   ///
636   UINT64                              Revision;
637   EFI_SIMPLE_NETWORK_START            Start;
638   EFI_SIMPLE_NETWORK_STOP             Stop;
639   EFI_SIMPLE_NETWORK_INITIALIZE       Initialize;
640   EFI_SIMPLE_NETWORK_RESET            Reset;
641   EFI_SIMPLE_NETWORK_SHUTDOWN         Shutdown;
642   EFI_SIMPLE_NETWORK_RECEIVE_FILTERS  ReceiveFilters;
643   EFI_SIMPLE_NETWORK_STATION_ADDRESS  StationAddress;
644   EFI_SIMPLE_NETWORK_STATISTICS       Statistics;
645   EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC  MCastIpToMac;
646   EFI_SIMPLE_NETWORK_NVDATA           NvData;
647   EFI_SIMPLE_NETWORK_GET_STATUS       GetStatus;
648   EFI_SIMPLE_NETWORK_TRANSMIT         Transmit;
649   EFI_SIMPLE_NETWORK_RECEIVE          Receive;
650   ///
651   /// Event used with WaitForEvent() to wait for a packet to be received.
652   ///
653   EFI_EVENT                           WaitForPacket;
654   ///
655   /// Pointer to the EFI_SIMPLE_NETWORK_MODE data for the device.
656   ///
657   EFI_SIMPLE_NETWORK_MODE             *Mode;
658 };
659 
660 extern EFI_GUID gEfiSimpleNetworkProtocolGuid;
661 
662 #endif
663