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