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