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