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