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