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