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