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