xref: /DragonStub/inc/efinet.h (revision 751cbce3f640c79fbb4660cb59a372b79a7f4d11)
1530d68baSNigel Croxon #ifndef _EFINET_H
2530d68baSNigel Croxon #define _EFINET_H
3530d68baSNigel Croxon 
4530d68baSNigel Croxon 
5530d68baSNigel Croxon /*++
6530d68baSNigel Croxon Copyright (c) 1999  Intel Corporation
7530d68baSNigel Croxon 
8530d68baSNigel Croxon Module Name:
9530d68baSNigel Croxon     efinet.h
10530d68baSNigel Croxon 
11530d68baSNigel Croxon Abstract:
12530d68baSNigel Croxon     EFI Simple Network protocol
13530d68baSNigel Croxon 
14530d68baSNigel Croxon Revision History
15530d68baSNigel Croxon --*/
16530d68baSNigel Croxon 
17530d68baSNigel Croxon 
18530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
19530d68baSNigel Croxon //
20530d68baSNigel Croxon //      Simple Network Protocol
21530d68baSNigel Croxon //
22530d68baSNigel Croxon 
23*751cbce3SNigel Croxon #define EFI_SIMPLE_NETWORK_PROTOCOL_GUID \
24530d68baSNigel Croxon     { 0xA19832B9, 0xAC25, 0x11D3, {0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
25530d68baSNigel Croxon 
26*751cbce3SNigel Croxon INTERFACE_DECL(_EFI_SIMPLE_NETWORK_PROTOCOL);
27530d68baSNigel Croxon 
28530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
29530d68baSNigel Croxon //
30530d68baSNigel Croxon 
31530d68baSNigel Croxon typedef struct {
32530d68baSNigel Croxon     //
33530d68baSNigel Croxon     // Total number of frames received.  Includes frames with errors and
34530d68baSNigel Croxon     // dropped frames.
35530d68baSNigel Croxon     //
36530d68baSNigel Croxon     UINT64  RxTotalFrames;
37530d68baSNigel Croxon 
38530d68baSNigel Croxon     //
39530d68baSNigel Croxon     // Number of valid frames received and copied into receive buffers.
40530d68baSNigel Croxon     //
41530d68baSNigel Croxon     UINT64  RxGoodFrames;
42530d68baSNigel Croxon 
43530d68baSNigel Croxon     //
44530d68baSNigel Croxon     // Number of frames below the minimum length for the media.
45530d68baSNigel Croxon     // This would be <64 for ethernet.
46530d68baSNigel Croxon     //
47530d68baSNigel Croxon     UINT64  RxUndersizeFrames;
48530d68baSNigel Croxon 
49530d68baSNigel Croxon     //
50530d68baSNigel Croxon     // Number of frames longer than the maxminum length for the
51530d68baSNigel Croxon     // media.  This would be >1500 for ethernet.
52530d68baSNigel Croxon     //
53530d68baSNigel Croxon     UINT64  RxOversizeFrames;
54530d68baSNigel Croxon 
55530d68baSNigel Croxon     //
56530d68baSNigel Croxon     // Valid frames that were dropped because receive buffers were full.
57530d68baSNigel Croxon     //
58530d68baSNigel Croxon     UINT64  RxDroppedFrames;
59530d68baSNigel Croxon 
60530d68baSNigel Croxon     //
61530d68baSNigel Croxon     // Number of valid unicast frames received and not dropped.
62530d68baSNigel Croxon     //
63530d68baSNigel Croxon     UINT64  RxUnicastFrames;
64530d68baSNigel Croxon 
65530d68baSNigel Croxon     //
66530d68baSNigel Croxon     // Number of valid broadcast frames received and not dropped.
67530d68baSNigel Croxon     //
68530d68baSNigel Croxon     UINT64  RxBroadcastFrames;
69530d68baSNigel Croxon 
70530d68baSNigel Croxon     //
71530d68baSNigel Croxon     // Number of valid mutlicast frames received and not dropped.
72530d68baSNigel Croxon     //
73530d68baSNigel Croxon     UINT64  RxMulticastFrames;
74530d68baSNigel Croxon 
75530d68baSNigel Croxon     //
76530d68baSNigel Croxon     // Number of frames w/ CRC or alignment errors.
77530d68baSNigel Croxon     //
78530d68baSNigel Croxon     UINT64  RxCrcErrorFrames;
79530d68baSNigel Croxon 
80530d68baSNigel Croxon     //
81530d68baSNigel Croxon     // Total number of bytes received.  Includes frames with errors
82530d68baSNigel Croxon     // and dropped frames.
83530d68baSNigel Croxon     //
84530d68baSNigel Croxon     UINT64  RxTotalBytes;
85530d68baSNigel Croxon 
86530d68baSNigel Croxon     //
87530d68baSNigel Croxon     // Transmit statistics.
88530d68baSNigel Croxon     //
89530d68baSNigel Croxon     UINT64  TxTotalFrames;
90530d68baSNigel Croxon     UINT64  TxGoodFrames;
91530d68baSNigel Croxon     UINT64  TxUndersizeFrames;
92530d68baSNigel Croxon     UINT64  TxOversizeFrames;
93530d68baSNigel Croxon     UINT64  TxDroppedFrames;
94530d68baSNigel Croxon     UINT64  TxUnicastFrames;
95530d68baSNigel Croxon     UINT64  TxBroadcastFrames;
96530d68baSNigel Croxon     UINT64  TxMulticastFrames;
97530d68baSNigel Croxon     UINT64  TxCrcErrorFrames;
98530d68baSNigel Croxon     UINT64  TxTotalBytes;
99530d68baSNigel Croxon 
100530d68baSNigel Croxon     //
101530d68baSNigel Croxon     // Number of collisions detection on this subnet.
102530d68baSNigel Croxon     //
103530d68baSNigel Croxon     UINT64  Collisions;
104530d68baSNigel Croxon 
105530d68baSNigel Croxon     //
106530d68baSNigel Croxon     // Number of frames destined for unsupported protocol.
107530d68baSNigel Croxon     //
108530d68baSNigel Croxon     UINT64  UnsupportedProtocol;
109530d68baSNigel Croxon 
110530d68baSNigel Croxon } EFI_NETWORK_STATISTICS;
111530d68baSNigel Croxon 
112530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
113530d68baSNigel Croxon //
114530d68baSNigel Croxon 
115530d68baSNigel Croxon typedef enum {
116530d68baSNigel Croxon     EfiSimpleNetworkStopped,
117530d68baSNigel Croxon     EfiSimpleNetworkStarted,
118530d68baSNigel Croxon     EfiSimpleNetworkInitialized,
119530d68baSNigel Croxon     EfiSimpleNetworkMaxState
120530d68baSNigel Croxon } EFI_SIMPLE_NETWORK_STATE;
121530d68baSNigel Croxon 
122530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
123530d68baSNigel Croxon //
124530d68baSNigel Croxon 
125530d68baSNigel Croxon #define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST               0x01
126530d68baSNigel Croxon #define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST             0x02
127530d68baSNigel Croxon #define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST             0x04
128530d68baSNigel Croxon #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS           0x08
129530d68baSNigel Croxon #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10
130530d68baSNigel Croxon 
131530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
132530d68baSNigel Croxon //
133530d68baSNigel Croxon 
134530d68baSNigel Croxon #define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT        0x01
135530d68baSNigel Croxon #define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT       0x02
136530d68baSNigel Croxon #define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT        0x04
137530d68baSNigel Croxon #define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT       0x08
138530d68baSNigel Croxon 
139530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
140530d68baSNigel Croxon //
141530d68baSNigel Croxon #define MAX_MCAST_FILTER_CNT    16
142530d68baSNigel Croxon typedef struct {
143530d68baSNigel Croxon     UINT32                      State;
144530d68baSNigel Croxon     UINT32                      HwAddressSize;
145530d68baSNigel Croxon     UINT32                      MediaHeaderSize;
146530d68baSNigel Croxon     UINT32                      MaxPacketSize;
147530d68baSNigel Croxon     UINT32                      NvRamSize;
148530d68baSNigel Croxon     UINT32                      NvRamAccessSize;
149530d68baSNigel Croxon     UINT32                      ReceiveFilterMask;
150530d68baSNigel Croxon     UINT32                      ReceiveFilterSetting;
151530d68baSNigel Croxon     UINT32                      MaxMCastFilterCount;
152530d68baSNigel Croxon     UINT32                      MCastFilterCount;
153530d68baSNigel Croxon     EFI_MAC_ADDRESS             MCastFilter[MAX_MCAST_FILTER_CNT];
154530d68baSNigel Croxon     EFI_MAC_ADDRESS             CurrentAddress;
155530d68baSNigel Croxon     EFI_MAC_ADDRESS             BroadcastAddress;
156530d68baSNigel Croxon     EFI_MAC_ADDRESS             PermanentAddress;
157530d68baSNigel Croxon     UINT8                       IfType;
158530d68baSNigel Croxon     BOOLEAN                     MacAddressChangeable;
159530d68baSNigel Croxon     BOOLEAN                     MultipleTxSupported;
160530d68baSNigel Croxon     BOOLEAN                     MediaPresentSupported;
161530d68baSNigel Croxon     BOOLEAN                     MediaPresent;
162530d68baSNigel Croxon } EFI_SIMPLE_NETWORK_MODE;
163530d68baSNigel Croxon 
164530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
165530d68baSNigel Croxon //
166530d68baSNigel Croxon 
167530d68baSNigel Croxon typedef
168530d68baSNigel Croxon EFI_STATUS
169530d68baSNigel Croxon (EFIAPI *EFI_SIMPLE_NETWORK_START) (
170*751cbce3SNigel Croxon     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This
171530d68baSNigel Croxon );
172530d68baSNigel Croxon 
173530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
174530d68baSNigel Croxon //
175530d68baSNigel Croxon 
176530d68baSNigel Croxon typedef
177530d68baSNigel Croxon EFI_STATUS
178530d68baSNigel Croxon (EFIAPI *EFI_SIMPLE_NETWORK_STOP) (
179*751cbce3SNigel Croxon     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This
180530d68baSNigel Croxon );
181530d68baSNigel Croxon 
182530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
183530d68baSNigel Croxon //
184530d68baSNigel Croxon 
185530d68baSNigel Croxon typedef
186530d68baSNigel Croxon EFI_STATUS
187530d68baSNigel Croxon (EFIAPI *EFI_SIMPLE_NETWORK_INITIALIZE) (
188*751cbce3SNigel Croxon     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
189530d68baSNigel Croxon     IN UINTN                                ExtraRxBufferSize  OPTIONAL,
190530d68baSNigel Croxon     IN UINTN                                ExtraTxBufferSize  OPTIONAL
191530d68baSNigel Croxon );
192530d68baSNigel Croxon 
193530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
194530d68baSNigel Croxon //
195530d68baSNigel Croxon 
196530d68baSNigel Croxon typedef
197530d68baSNigel Croxon EFI_STATUS
198530d68baSNigel Croxon (EFIAPI *EFI_SIMPLE_NETWORK_RESET) (
199*751cbce3SNigel Croxon     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
200530d68baSNigel Croxon     IN BOOLEAN                              ExtendedVerification
201530d68baSNigel Croxon );
202530d68baSNigel Croxon 
203530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
204530d68baSNigel Croxon //
205530d68baSNigel Croxon 
206530d68baSNigel Croxon typedef
207530d68baSNigel Croxon EFI_STATUS
208530d68baSNigel Croxon (EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN) (
209*751cbce3SNigel Croxon     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This
210530d68baSNigel Croxon );
211530d68baSNigel Croxon 
212530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
213530d68baSNigel Croxon //
214530d68baSNigel Croxon 
215530d68baSNigel Croxon typedef
216530d68baSNigel Croxon EFI_STATUS
217530d68baSNigel Croxon (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE_FILTERS) (
218*751cbce3SNigel Croxon     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
219530d68baSNigel Croxon     IN UINT32                               Enable,
220530d68baSNigel Croxon     IN UINT32                               Disable,
221530d68baSNigel Croxon     IN BOOLEAN                              ResetMCastFilter,
222530d68baSNigel Croxon     IN UINTN                                MCastFilterCnt     OPTIONAL,
223530d68baSNigel Croxon     IN EFI_MAC_ADDRESS                      *MCastFilter       OPTIONAL
224530d68baSNigel Croxon );
225530d68baSNigel Croxon 
226530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
227530d68baSNigel Croxon //
228530d68baSNigel Croxon 
229530d68baSNigel Croxon typedef
230530d68baSNigel Croxon EFI_STATUS
231530d68baSNigel Croxon (EFIAPI *EFI_SIMPLE_NETWORK_STATION_ADDRESS) (
232*751cbce3SNigel Croxon     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
233530d68baSNigel Croxon     IN BOOLEAN                              Reset,
234530d68baSNigel Croxon     IN EFI_MAC_ADDRESS                      *New      OPTIONAL
235530d68baSNigel Croxon );
236530d68baSNigel Croxon 
237530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
238530d68baSNigel Croxon //
239530d68baSNigel Croxon 
240530d68baSNigel Croxon typedef
241530d68baSNigel Croxon EFI_STATUS
242530d68baSNigel Croxon (EFIAPI *EFI_SIMPLE_NETWORK_STATISTICS) (
243*751cbce3SNigel Croxon     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
244530d68baSNigel Croxon     IN BOOLEAN                              Reset,
245530d68baSNigel Croxon     IN OUT UINTN                            *StatisticsSize   OPTIONAL,
246530d68baSNigel Croxon     OUT EFI_NETWORK_STATISTICS              *StatisticsTable  OPTIONAL
247530d68baSNigel Croxon );
248530d68baSNigel Croxon 
249530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
250530d68baSNigel Croxon //
251530d68baSNigel Croxon 
252530d68baSNigel Croxon typedef
253530d68baSNigel Croxon EFI_STATUS
254530d68baSNigel Croxon (EFIAPI *EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC) (
255*751cbce3SNigel Croxon     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
256530d68baSNigel Croxon     IN BOOLEAN                              IPv6,
257530d68baSNigel Croxon     IN EFI_IP_ADDRESS                       *IP,
258530d68baSNigel Croxon     OUT EFI_MAC_ADDRESS                     *MAC
259530d68baSNigel Croxon );
260530d68baSNigel Croxon 
261530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
262530d68baSNigel Croxon //
263530d68baSNigel Croxon 
264530d68baSNigel Croxon typedef
265530d68baSNigel Croxon EFI_STATUS
266530d68baSNigel Croxon (EFIAPI *EFI_SIMPLE_NETWORK_NVDATA) (
267*751cbce3SNigel Croxon     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
268530d68baSNigel Croxon     IN BOOLEAN                              ReadWrite,
269530d68baSNigel Croxon     IN UINTN                                Offset,
270530d68baSNigel Croxon     IN UINTN                                BufferSize,
271530d68baSNigel Croxon     IN OUT VOID                             *Buffer
272530d68baSNigel Croxon );
273530d68baSNigel Croxon 
274530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
275530d68baSNigel Croxon //
276530d68baSNigel Croxon 
277530d68baSNigel Croxon typedef
278530d68baSNigel Croxon EFI_STATUS
279530d68baSNigel Croxon (EFIAPI *EFI_SIMPLE_NETWORK_GET_STATUS) (
280*751cbce3SNigel Croxon     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
281530d68baSNigel Croxon     OUT UINT32                              *InterruptStatus  OPTIONAL,
282530d68baSNigel Croxon     OUT VOID                                **TxBuf           OPTIONAL
283530d68baSNigel Croxon );
284530d68baSNigel Croxon 
285530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
286530d68baSNigel Croxon //
287530d68baSNigel Croxon 
288530d68baSNigel Croxon typedef
289530d68baSNigel Croxon EFI_STATUS
290530d68baSNigel Croxon (EFIAPI *EFI_SIMPLE_NETWORK_TRANSMIT) (
291*751cbce3SNigel Croxon     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
292530d68baSNigel Croxon     IN UINTN                                HeaderSize,
293530d68baSNigel Croxon     IN UINTN                                BufferSize,
294530d68baSNigel Croxon     IN VOID                                 *Buffer,
295530d68baSNigel Croxon     IN EFI_MAC_ADDRESS                      *SrcAddr     OPTIONAL,
296530d68baSNigel Croxon     IN EFI_MAC_ADDRESS                      *DestAddr    OPTIONAL,
297530d68baSNigel Croxon     IN UINT16                               *Protocol    OPTIONAL
298530d68baSNigel Croxon );
299530d68baSNigel Croxon 
300530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
301530d68baSNigel Croxon //
302530d68baSNigel Croxon 
303530d68baSNigel Croxon typedef
304530d68baSNigel Croxon EFI_STATUS
305530d68baSNigel Croxon (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE) (
306*751cbce3SNigel Croxon     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
307530d68baSNigel Croxon     OUT UINTN                               *HeaderSize  OPTIONAL,
308530d68baSNigel Croxon     IN OUT UINTN                            *BufferSize,
309530d68baSNigel Croxon     OUT VOID                                *Buffer,
310530d68baSNigel Croxon     OUT EFI_MAC_ADDRESS                     *SrcAddr     OPTIONAL,
311530d68baSNigel Croxon     OUT EFI_MAC_ADDRESS                     *DestAddr    OPTIONAL,
312530d68baSNigel Croxon     OUT UINT16                              *Protocol    OPTIONAL
313530d68baSNigel Croxon );
314530d68baSNigel Croxon 
315530d68baSNigel Croxon ///////////////////////////////////////////////////////////////////////////////
316530d68baSNigel Croxon //
317530d68baSNigel Croxon 
318*751cbce3SNigel Croxon #define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION  0x00010000
319*751cbce3SNigel Croxon #define EFI_SIMPLE_NETWORK_INTERFACE_REVISION EFI_SIMPLE_NETWORK_PROTOCOL_REVISION
320530d68baSNigel Croxon 
321*751cbce3SNigel Croxon typedef struct _EFI_SIMPLE_NETWORK_PROTOCOL {
322530d68baSNigel Croxon     UINT64                              Revision;
323530d68baSNigel Croxon     EFI_SIMPLE_NETWORK_START            Start;
324530d68baSNigel Croxon     EFI_SIMPLE_NETWORK_STOP             Stop;
325530d68baSNigel Croxon     EFI_SIMPLE_NETWORK_INITIALIZE       Initialize;
326530d68baSNigel Croxon     EFI_SIMPLE_NETWORK_RESET            Reset;
327530d68baSNigel Croxon     EFI_SIMPLE_NETWORK_SHUTDOWN         Shutdown;
328530d68baSNigel Croxon     EFI_SIMPLE_NETWORK_RECEIVE_FILTERS  ReceiveFilters;
329530d68baSNigel Croxon     EFI_SIMPLE_NETWORK_STATION_ADDRESS  StationAddress;
330530d68baSNigel Croxon     EFI_SIMPLE_NETWORK_STATISTICS       Statistics;
331530d68baSNigel Croxon     EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC  MCastIpToMac;
332530d68baSNigel Croxon     EFI_SIMPLE_NETWORK_NVDATA           NvData;
333530d68baSNigel Croxon     EFI_SIMPLE_NETWORK_GET_STATUS       GetStatus;
334530d68baSNigel Croxon     EFI_SIMPLE_NETWORK_TRANSMIT         Transmit;
335530d68baSNigel Croxon     EFI_SIMPLE_NETWORK_RECEIVE          Receive;
336530d68baSNigel Croxon     EFI_EVENT                           WaitForPacket;
337530d68baSNigel Croxon     EFI_SIMPLE_NETWORK_MODE             *Mode;
338*751cbce3SNigel Croxon } EFI_SIMPLE_NETWORK_PROTOCOL;
339*751cbce3SNigel Croxon 
340*751cbce3SNigel Croxon // Note: Because it conflicted with the EDK2 struct name, the
341*751cbce3SNigel Croxon // 'EFI_SIMPLE_NETWORK_PROTOCOL' GUID definition, from older
342*751cbce3SNigel Croxon // versions of gnu-efi, is now obsoleted.
343*751cbce3SNigel Croxon // Use 'EFI_SIMPLE_NETWORK_PROTOCOL_GUID' instead.
344*751cbce3SNigel Croxon 
345*751cbce3SNigel Croxon typedef struct _EFI_SIMPLE_NETWORK_PROTOCOL _EFI_SIMPLE_NETWORK;
346*751cbce3SNigel Croxon typedef EFI_SIMPLE_NETWORK_PROTOCOL EFI_SIMPLE_NETWORK;
347530d68baSNigel Croxon 
348530d68baSNigel Croxon #endif /* _EFINET_H */
349