xref: /DragonStub/inc/efinet.h (revision 751cbce3f640c79fbb4660cb59a372b79a7f4d11) !
1 #ifndef _EFINET_H
2 #define _EFINET_H
3 
4 
5 /*++
6 Copyright (c) 1999  Intel Corporation
7 
8 Module Name:
9     efinet.h
10 
11 Abstract:
12     EFI Simple Network protocol
13 
14 Revision History
15 --*/
16 
17 
18 ///////////////////////////////////////////////////////////////////////////////
19 //
20 //      Simple Network Protocol
21 //
22 
23 #define EFI_SIMPLE_NETWORK_PROTOCOL_GUID \
24     { 0xA19832B9, 0xAC25, 0x11D3, {0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
25 
26 INTERFACE_DECL(_EFI_SIMPLE_NETWORK_PROTOCOL);
27 
28 ///////////////////////////////////////////////////////////////////////////////
29 //
30 
31 typedef struct {
32     //
33     // Total number of frames received.  Includes frames with errors and
34     // dropped frames.
35     //
36     UINT64  RxTotalFrames;
37 
38     //
39     // Number of valid frames received and copied into receive buffers.
40     //
41     UINT64  RxGoodFrames;
42 
43     //
44     // Number of frames below the minimum length for the media.
45     // This would be <64 for ethernet.
46     //
47     UINT64  RxUndersizeFrames;
48 
49     //
50     // Number of frames longer than the maxminum length for the
51     // media.  This would be >1500 for ethernet.
52     //
53     UINT64  RxOversizeFrames;
54 
55     //
56     // Valid frames that were dropped because receive buffers were full.
57     //
58     UINT64  RxDroppedFrames;
59 
60     //
61     // Number of valid unicast frames received and not dropped.
62     //
63     UINT64  RxUnicastFrames;
64 
65     //
66     // Number of valid broadcast frames received and not dropped.
67     //
68     UINT64  RxBroadcastFrames;
69 
70     //
71     // Number of valid mutlicast frames received and not dropped.
72     //
73     UINT64  RxMulticastFrames;
74 
75     //
76     // Number of frames w/ CRC or alignment errors.
77     //
78     UINT64  RxCrcErrorFrames;
79 
80     //
81     // Total number of bytes received.  Includes frames with errors
82     // and dropped frames.
83     //
84     UINT64  RxTotalBytes;
85 
86     //
87     // Transmit statistics.
88     //
89     UINT64  TxTotalFrames;
90     UINT64  TxGoodFrames;
91     UINT64  TxUndersizeFrames;
92     UINT64  TxOversizeFrames;
93     UINT64  TxDroppedFrames;
94     UINT64  TxUnicastFrames;
95     UINT64  TxBroadcastFrames;
96     UINT64  TxMulticastFrames;
97     UINT64  TxCrcErrorFrames;
98     UINT64  TxTotalBytes;
99 
100     //
101     // Number of collisions detection on this subnet.
102     //
103     UINT64  Collisions;
104 
105     //
106     // Number of frames destined for unsupported protocol.
107     //
108     UINT64  UnsupportedProtocol;
109 
110 } EFI_NETWORK_STATISTICS;
111 
112 ///////////////////////////////////////////////////////////////////////////////
113 //
114 
115 typedef enum {
116     EfiSimpleNetworkStopped,
117     EfiSimpleNetworkStarted,
118     EfiSimpleNetworkInitialized,
119     EfiSimpleNetworkMaxState
120 } EFI_SIMPLE_NETWORK_STATE;
121 
122 ///////////////////////////////////////////////////////////////////////////////
123 //
124 
125 #define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST               0x01
126 #define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST             0x02
127 #define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST             0x04
128 #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS           0x08
129 #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10
130 
131 ///////////////////////////////////////////////////////////////////////////////
132 //
133 
134 #define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT        0x01
135 #define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT       0x02
136 #define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT        0x04
137 #define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT       0x08
138 
139 ///////////////////////////////////////////////////////////////////////////////
140 //
141 #define MAX_MCAST_FILTER_CNT    16
142 typedef struct {
143     UINT32                      State;
144     UINT32                      HwAddressSize;
145     UINT32                      MediaHeaderSize;
146     UINT32                      MaxPacketSize;
147     UINT32                      NvRamSize;
148     UINT32                      NvRamAccessSize;
149     UINT32                      ReceiveFilterMask;
150     UINT32                      ReceiveFilterSetting;
151     UINT32                      MaxMCastFilterCount;
152     UINT32                      MCastFilterCount;
153     EFI_MAC_ADDRESS             MCastFilter[MAX_MCAST_FILTER_CNT];
154     EFI_MAC_ADDRESS             CurrentAddress;
155     EFI_MAC_ADDRESS             BroadcastAddress;
156     EFI_MAC_ADDRESS             PermanentAddress;
157     UINT8                       IfType;
158     BOOLEAN                     MacAddressChangeable;
159     BOOLEAN                     MultipleTxSupported;
160     BOOLEAN                     MediaPresentSupported;
161     BOOLEAN                     MediaPresent;
162 } EFI_SIMPLE_NETWORK_MODE;
163 
164 ///////////////////////////////////////////////////////////////////////////////
165 //
166 
167 typedef
168 EFI_STATUS
169 (EFIAPI *EFI_SIMPLE_NETWORK_START) (
170     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This
171 );
172 
173 ///////////////////////////////////////////////////////////////////////////////
174 //
175 
176 typedef
177 EFI_STATUS
178 (EFIAPI *EFI_SIMPLE_NETWORK_STOP) (
179     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This
180 );
181 
182 ///////////////////////////////////////////////////////////////////////////////
183 //
184 
185 typedef
186 EFI_STATUS
187 (EFIAPI *EFI_SIMPLE_NETWORK_INITIALIZE) (
188     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
189     IN UINTN                                ExtraRxBufferSize  OPTIONAL,
190     IN UINTN                                ExtraTxBufferSize  OPTIONAL
191 );
192 
193 ///////////////////////////////////////////////////////////////////////////////
194 //
195 
196 typedef
197 EFI_STATUS
198 (EFIAPI *EFI_SIMPLE_NETWORK_RESET) (
199     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
200     IN BOOLEAN                              ExtendedVerification
201 );
202 
203 ///////////////////////////////////////////////////////////////////////////////
204 //
205 
206 typedef
207 EFI_STATUS
208 (EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN) (
209     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This
210 );
211 
212 ///////////////////////////////////////////////////////////////////////////////
213 //
214 
215 typedef
216 EFI_STATUS
217 (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE_FILTERS) (
218     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
219     IN UINT32                               Enable,
220     IN UINT32                               Disable,
221     IN BOOLEAN                              ResetMCastFilter,
222     IN UINTN                                MCastFilterCnt     OPTIONAL,
223     IN EFI_MAC_ADDRESS                      *MCastFilter       OPTIONAL
224 );
225 
226 ///////////////////////////////////////////////////////////////////////////////
227 //
228 
229 typedef
230 EFI_STATUS
231 (EFIAPI *EFI_SIMPLE_NETWORK_STATION_ADDRESS) (
232     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
233     IN BOOLEAN                              Reset,
234     IN EFI_MAC_ADDRESS                      *New      OPTIONAL
235 );
236 
237 ///////////////////////////////////////////////////////////////////////////////
238 //
239 
240 typedef
241 EFI_STATUS
242 (EFIAPI *EFI_SIMPLE_NETWORK_STATISTICS) (
243     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
244     IN BOOLEAN                              Reset,
245     IN OUT UINTN                            *StatisticsSize   OPTIONAL,
246     OUT EFI_NETWORK_STATISTICS              *StatisticsTable  OPTIONAL
247 );
248 
249 ///////////////////////////////////////////////////////////////////////////////
250 //
251 
252 typedef
253 EFI_STATUS
254 (EFIAPI *EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC) (
255     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
256     IN BOOLEAN                              IPv6,
257     IN EFI_IP_ADDRESS                       *IP,
258     OUT EFI_MAC_ADDRESS                     *MAC
259 );
260 
261 ///////////////////////////////////////////////////////////////////////////////
262 //
263 
264 typedef
265 EFI_STATUS
266 (EFIAPI *EFI_SIMPLE_NETWORK_NVDATA) (
267     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
268     IN BOOLEAN                              ReadWrite,
269     IN UINTN                                Offset,
270     IN UINTN                                BufferSize,
271     IN OUT VOID                             *Buffer
272 );
273 
274 ///////////////////////////////////////////////////////////////////////////////
275 //
276 
277 typedef
278 EFI_STATUS
279 (EFIAPI *EFI_SIMPLE_NETWORK_GET_STATUS) (
280     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
281     OUT UINT32                              *InterruptStatus  OPTIONAL,
282     OUT VOID                                **TxBuf           OPTIONAL
283 );
284 
285 ///////////////////////////////////////////////////////////////////////////////
286 //
287 
288 typedef
289 EFI_STATUS
290 (EFIAPI *EFI_SIMPLE_NETWORK_TRANSMIT) (
291     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
292     IN UINTN                                HeaderSize,
293     IN UINTN                                BufferSize,
294     IN VOID                                 *Buffer,
295     IN EFI_MAC_ADDRESS                      *SrcAddr     OPTIONAL,
296     IN EFI_MAC_ADDRESS                      *DestAddr    OPTIONAL,
297     IN UINT16                               *Protocol    OPTIONAL
298 );
299 
300 ///////////////////////////////////////////////////////////////////////////////
301 //
302 
303 typedef
304 EFI_STATUS
305 (EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE) (
306     IN struct _EFI_SIMPLE_NETWORK_PROTOCOL  *This,
307     OUT UINTN                               *HeaderSize  OPTIONAL,
308     IN OUT UINTN                            *BufferSize,
309     OUT VOID                                *Buffer,
310     OUT EFI_MAC_ADDRESS                     *SrcAddr     OPTIONAL,
311     OUT EFI_MAC_ADDRESS                     *DestAddr    OPTIONAL,
312     OUT UINT16                              *Protocol    OPTIONAL
313 );
314 
315 ///////////////////////////////////////////////////////////////////////////////
316 //
317 
318 #define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION  0x00010000
319 #define EFI_SIMPLE_NETWORK_INTERFACE_REVISION EFI_SIMPLE_NETWORK_PROTOCOL_REVISION
320 
321 typedef struct _EFI_SIMPLE_NETWORK_PROTOCOL {
322     UINT64                              Revision;
323     EFI_SIMPLE_NETWORK_START            Start;
324     EFI_SIMPLE_NETWORK_STOP             Stop;
325     EFI_SIMPLE_NETWORK_INITIALIZE       Initialize;
326     EFI_SIMPLE_NETWORK_RESET            Reset;
327     EFI_SIMPLE_NETWORK_SHUTDOWN         Shutdown;
328     EFI_SIMPLE_NETWORK_RECEIVE_FILTERS  ReceiveFilters;
329     EFI_SIMPLE_NETWORK_STATION_ADDRESS  StationAddress;
330     EFI_SIMPLE_NETWORK_STATISTICS       Statistics;
331     EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC  MCastIpToMac;
332     EFI_SIMPLE_NETWORK_NVDATA           NvData;
333     EFI_SIMPLE_NETWORK_GET_STATUS       GetStatus;
334     EFI_SIMPLE_NETWORK_TRANSMIT         Transmit;
335     EFI_SIMPLE_NETWORK_RECEIVE          Receive;
336     EFI_EVENT                           WaitForPacket;
337     EFI_SIMPLE_NETWORK_MODE             *Mode;
338 } EFI_SIMPLE_NETWORK_PROTOCOL;
339 
340 // Note: Because it conflicted with the EDK2 struct name, the
341 // 'EFI_SIMPLE_NETWORK_PROTOCOL' GUID definition, from older
342 // versions of gnu-efi, is now obsoleted.
343 // Use 'EFI_SIMPLE_NETWORK_PROTOCOL_GUID' instead.
344 
345 typedef struct _EFI_SIMPLE_NETWORK_PROTOCOL _EFI_SIMPLE_NETWORK;
346 typedef EFI_SIMPLE_NETWORK_PROTOCOL EFI_SIMPLE_NETWORK;
347 
348 #endif /* _EFINET_H */
349