]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/SimpleNetwork.h
Code have been checked with 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
9319d2c2
LG
122///\r
123/// State of the network interface\r
124/// When an EFI_SIMPLE_NETWORK_PROTOCOL driver initializes a\r
125/// network interface, the network interface is left in the EfiSimpleNetworkStopped state.\r
126///\r
d1f95000 127typedef enum {\r
128 EfiSimpleNetworkStopped,\r
129 EfiSimpleNetworkStarted,\r
130 EfiSimpleNetworkInitialized,\r
131 EfiSimpleNetworkMaxState\r
132} EFI_SIMPLE_NETWORK_STATE;\r
133\r
134#define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST 0x01\r
135#define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST 0x02\r
136#define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST 0x04\r
137#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08\r
138#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10\r
139\r
140#define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT 0x01\r
141#define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT 0x02\r
142#define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT 0x04\r
143#define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT 0x08\r
144\r
145#define MAX_MCAST_FILTER_CNT 16\r
146typedef struct {\r
992f22b9
LG
147 ///\r
148 /// Reports the current state of the network interface.\r
149 ///\r
d1f95000 150 UINT32 State;\r
992f22b9
LG
151 ///\r
152 /// The size, in bytes, of the network interface's HW address.\r
153 ///\r
d1f95000 154 UINT32 HwAddressSize;\r
992f22b9
LG
155 ///\r
156 /// The size, in bytes, of the network interface's media header.\r
157 ///\r
d1f95000 158 UINT32 MediaHeaderSize;\r
992f22b9
LG
159 ///\r
160 /// The maximum size, in bytes, of the packets supported by the network interface.\r
161 ///\r
d1f95000 162 UINT32 MaxPacketSize;\r
992f22b9
LG
163 ///\r
164 /// The size, in bytes, of the NVRAM device attached to the network interface.\r
165 ///\r
d1f95000 166 UINT32 NvRamSize;\r
992f22b9
LG
167 ///\r
168 /// The size that must be used for all NVRAM reads and writes. The\r
169 /// start address for NVRAM read and write operations and the total\r
170 /// length of those operations, must be a multiple of this value. The\r
171 /// legal values for this field are 0, 1, 2, 4, and 8.\r
172 ///\r
d1f95000 173 UINT32 NvRamAccessSize;\r
992f22b9
LG
174 ///\r
175 /// The multicast receive filter settings supported by the network interface.\r
176 ///\r
d1f95000 177 UINT32 ReceiveFilterMask;\r
992f22b9
LG
178 ///\r
179 /// The current multicast receive filter settings.\r
180 ///\r
d1f95000 181 UINT32 ReceiveFilterSetting;\r
992f22b9
LG
182 ///\r
183 /// The maximum number of multicast address receive filters supported by the driver.\r
184 ///\r
d1f95000 185 UINT32 MaxMCastFilterCount;\r
992f22b9
LG
186 ///\r
187 /// The current number of multicast address receive filters.\r
188 ///\r
d1f95000 189 UINT32 MCastFilterCount;\r
992f22b9
LG
190 ///\r
191 /// Array containing the addresses of the current multicast address receive filters.\r
192 ///\r
d1f95000 193 EFI_MAC_ADDRESS MCastFilter[MAX_MCAST_FILTER_CNT];\r
992f22b9
LG
194 ///\r
195 /// The current HW MAC address for the network interface.\r
196 ///\r
d1f95000 197 EFI_MAC_ADDRESS CurrentAddress;\r
992f22b9
LG
198 ///\r
199 /// The current HW MAC address for broadcast packets.\r
200 ///\r
d1f95000 201 EFI_MAC_ADDRESS BroadcastAddress;\r
992f22b9
LG
202 ///\r
203 /// The permanent HW MAC address for the network interface.\r
204 ///\r
d1f95000 205 EFI_MAC_ADDRESS PermanentAddress;\r
992f22b9
LG
206 ///\r
207 /// The interface type of the network interface.\r
208 ///\r
d1f95000 209 UINT8 IfType;\r
992f22b9
LG
210 ///\r
211 /// TRUE if the HW MAC address can be changed.\r
212 ///\r
d1f95000 213 BOOLEAN MacAddressChangeable;\r
992f22b9
LG
214 ///\r
215 /// TRUE if the network interface can transmit more than one packet at a time.\r
216 ///\r
d1f95000 217 BOOLEAN MultipleTxSupported;\r
992f22b9
LG
218 ///\r
219 /// TRUE if the presence of media can be determined; otherwise FALSE.\r
220 ///\r
d1f95000 221 BOOLEAN MediaPresentSupported;\r
992f22b9
LG
222 ///\r
223 /// TRUE if media are connected to the network interface; otherwise FALSE.\r
224 ///\r
d1f95000 225 BOOLEAN MediaPresent;\r
226} EFI_SIMPLE_NETWORK_MODE;\r
227\r
228//\r
229// Protocol Member Functions\r
230//\r
231/**\r
232 Changes the state of a network interface from "stopped" to "started".\r
233\r
234 @param This Protocol instance pointer.\r
235\r
236 @retval EFI_SUCCESS The network interface was started.\r
237 @retval EFI_ALREADY_STARTED The network interface is already in the started state.\r
238 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
239 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
240 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
241\r
242**/\r
243typedef\r
244EFI_STATUS\r
8b13229b 245(EFIAPI *EFI_SIMPLE_NETWORK_START)(\r
d1f95000 246 IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
ed66e1bc 247 );\r
d1f95000 248\r
249/**\r
250 Changes the state of a network interface from "started" to "stopped".\r
251\r
252 @param This Protocol instance pointer.\r
253\r
254 @retval EFI_SUCCESS The network interface was stopped.\r
255 @retval EFI_ALREADY_STARTED The network interface is already in the stopped state.\r
256 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
257 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
258 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
259\r
260**/\r
261typedef\r
262EFI_STATUS\r
8b13229b 263(EFIAPI *EFI_SIMPLE_NETWORK_STOP)(\r
d1f95000 264 IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
ed66e1bc 265 );\r
d1f95000 266\r
267/**\r
268 Resets a network adapter and allocates the transmit and receive buffers \r
269 required by the network interface; optionally, also requests allocation \r
270 of additional transmit and receive buffers.\r
271\r
272 @param This Protocol instance pointer.\r
273 @param ExtraRxBufferSize The size, in bytes, of the extra receive buffer space\r
274 that the driver should allocate for the network interface.\r
275 Some network interfaces will not be able to use the extra\r
276 buffer, and the caller will not know if it is actually\r
277 being used.\r
278 @param ExtraTxBufferSize The size, in bytes, of the extra transmit buffer space\r
279 that the driver should allocate for the network interface.\r
280 Some network interfaces will not be able to use the extra\r
281 buffer, and the caller will not know if it is actually\r
282 being used.\r
283\r
284 @retval EFI_SUCCESS The network interface was initialized.\r
285 @retval EFI_NOT_STARTED The network interface has not been started\r
286 @retval EFI_OUT_OF_RESOURCES There was not enough memory for the transmit and\r
287 receive buffers. .\r
288 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
289 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
290 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
291\r
292**/\r
293typedef\r
294EFI_STATUS\r
8b13229b 295(EFIAPI *EFI_SIMPLE_NETWORK_INITIALIZE)(\r
d1f95000 296 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
297 IN UINTN ExtraRxBufferSize OPTIONAL,\r
298 IN UINTN ExtraTxBufferSize OPTIONAL\r
ed66e1bc 299 );\r
d1f95000 300\r
301/**\r
302 Resets a network adapter and re-initializes it with the parameters that were \r
303 provided in the previous call to Initialize(). \r
304\r
305 @param This Protocol instance pointer.\r
306 @param ExtendedVerification Indicates that the driver may perform a more\r
307 exhaustive verification operation of the device\r
308 during reset.\r
309\r
310 @retval EFI_SUCCESS The network interface was reset.\r
311 @retval EFI_NOT_STARTED The network interface has not been started\r
312 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
313 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
314 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
315\r
316**/\r
317typedef\r
318EFI_STATUS\r
8b13229b 319(EFIAPI *EFI_SIMPLE_NETWORK_RESET)(\r
d1f95000 320 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
321 IN BOOLEAN ExtendedVerification\r
ed66e1bc 322 );\r
d1f95000 323\r
324/**\r
325 Resets a network adapter and leaves it in a state that is safe for \r
326 another driver to initialize.\r
327\r
328 @param This Protocol instance pointer.\r
329\r
330 @retval EFI_SUCCESS The network interface was shutdown.\r
331 @retval EFI_NOT_STARTED The network interface has not been started\r
332 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
333 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
334 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
335\r
336**/\r
337typedef\r
338EFI_STATUS\r
8b13229b 339(EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN)(\r
d1f95000 340 IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
ed66e1bc 341 );\r
d1f95000 342\r
343/**\r
344 Manages the multicast receive filters of a network interface.\r
345\r
346 @param This Protocol instance pointer.\r
347 @param Enable A bit mask of receive filters to enable on the network interface.\r
348 @param Disable A bit mask of receive filters to disable on the network interface.\r
349 @param ResetMCastFilter Set to TRUE to reset the contents of the multicast receive\r
350 filters on the network interface to their default values.\r
351 @param McastFilterCnt Number of multicast HW MAC addresses in the new\r
352 MCastFilter list. This value must be less than or equal to\r
353 the MCastFilterCnt field of EFI_SIMPLE_NETWORK_MODE. This\r
354 field is optional if ResetMCastFilter is TRUE.\r
355 @param MCastFilter A pointer to a list of new multicast receive filter HW MAC\r
356 addresses. This list will replace any existing multicast\r
357 HW MAC address list. This field is optional if\r
358 ResetMCastFilter is TRUE.\r
359\r
360 @retval EFI_SUCCESS The multicast receive filter list was updated.\r
361 @retval EFI_NOT_STARTED The network interface has not been started\r
362 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
363 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
364 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
365\r
366**/\r
367typedef\r
368EFI_STATUS\r
8b13229b 369(EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE_FILTERS)(\r
d1f95000 370 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
371 IN UINT32 Enable,\r
372 IN UINT32 Disable,\r
373 IN BOOLEAN ResetMCastFilter,\r
374 IN UINTN MCastFilterCnt OPTIONAL,\r
375 IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL\r
ed66e1bc 376 );\r
d1f95000 377\r
378/**\r
379 Modifies or resets the current station address, if supported.\r
380\r
381 @param This Protocol instance pointer.\r
382 @param Reset Flag used to reset the station address to the network interfaces\r
383 permanent address.\r
384 @param New New station address to be used for the network interface.\r
385\r
386 @retval EFI_SUCCESS The network interfaces station address was updated.\r
387 @retval EFI_NOT_STARTED The network interface has not been started\r
388 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
389 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
390 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
391\r
392**/\r
393typedef\r
394EFI_STATUS\r
8b13229b 395(EFIAPI *EFI_SIMPLE_NETWORK_STATION_ADDRESS)(\r
d1f95000 396 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
397 IN BOOLEAN Reset,\r
398 IN EFI_MAC_ADDRESS *New OPTIONAL\r
ed66e1bc 399 );\r
d1f95000 400\r
401/**\r
402 Resets or collects the statistics on a network interface.\r
403\r
404 @param This Protocol instance pointer.\r
405 @param Reset Set to TRUE to reset the statistics for the network interface.\r
406 @param StatisticsSize On input the size, in bytes, of StatisticsTable. On\r
407 output the size, in bytes, of the resulting table of\r
408 statistics.\r
409 @param StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that\r
410 contains the statistics.\r
411\r
412 @retval EFI_SUCCESS The statistics were collected from the network interface.\r
413 @retval EFI_NOT_STARTED The network interface has not been started.\r
414 @retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer\r
415 size needed to hold the statistics is returned in\r
416 StatisticsSize.\r
417 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
418 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
419 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
420\r
421**/\r
422typedef\r
423EFI_STATUS\r
8b13229b 424(EFIAPI *EFI_SIMPLE_NETWORK_STATISTICS)(\r
d1f95000 425 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
426 IN BOOLEAN Reset,\r
427 IN OUT UINTN *StatisticsSize OPTIONAL,\r
428 OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL\r
ed66e1bc 429 );\r
d1f95000 430\r
431/**\r
432 Converts a multicast IP address to a multicast HW MAC address.\r
433\r
434 @param This Protocol instance pointer.\r
435 @param IPv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460]. Set\r
436 to FALSE if the multicast IP address is IPv4 [RFC 791].\r
437 @param IP The multicast IP address that is to be converted to a multicast\r
438 HW MAC address.\r
439 @param MAC The multicast HW MAC address that is to be generated from IP.\r
440\r
441 @retval EFI_SUCCESS The multicast IP address was mapped to the multicast\r
442 HW MAC address.\r
443 @retval EFI_NOT_STARTED The network interface has not been started.\r
444 @retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer\r
445 size needed to hold the statistics is returned in\r
446 StatisticsSize.\r
447 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
448 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
449 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
450\r
451**/\r
452typedef\r
453EFI_STATUS\r
8b13229b 454(EFIAPI *EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC)(\r
d1f95000 455 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
456 IN BOOLEAN IPv6,\r
457 IN EFI_IP_ADDRESS *IP,\r
458 OUT EFI_MAC_ADDRESS *MAC\r
ed66e1bc 459 );\r
d1f95000 460\r
461/**\r
462 Performs read and write operations on the NVRAM device attached to a \r
463 network interface.\r
464\r
465 @param This Protocol instance pointer.\r
466 @param ReadWrite TRUE for read operations, FALSE for write operations.\r
467 @param Offset Byte offset in the NVRAM device at which to start the read or\r
468 write operation. This must be a multiple of NvRamAccessSize and\r
469 less than NvRamSize.\r
470 @param BufferSize The number of bytes to read or write from the NVRAM device.\r
471 This must also be a multiple of NvramAccessSize.\r
472 @param Buffer A pointer to the data buffer.\r
473\r
474 @retval EFI_SUCCESS The NVRAM access was performed.\r
475 @retval EFI_NOT_STARTED The network interface has not been started.\r
476 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
477 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
478 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
479\r
480**/\r
481typedef\r
482EFI_STATUS\r
8b13229b 483(EFIAPI *EFI_SIMPLE_NETWORK_NVDATA)(\r
d1f95000 484 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
485 IN BOOLEAN ReadWrite,\r
486 IN UINTN Offset,\r
487 IN UINTN BufferSize,\r
488 IN OUT VOID *Buffer\r
ed66e1bc 489 );\r
d1f95000 490\r
491/**\r
492 Reads the current interrupt status and recycled transmit buffer status from \r
493 a network interface.\r
494\r
495 @param This Protocol instance pointer.\r
496 @param InterruptStatus A pointer to the bit mask of the currently active interrupts\r
497 If this is NULL, the interrupt status will not be read from\r
498 the device. If this is not NULL, the interrupt status will\r
499 be read from the device. When the interrupt status is read,\r
500 it will also be cleared. Clearing the transmit interrupt\r
501 does not empty the recycled transmit buffer array.\r
502 @param TxBuf Recycled transmit buffer address. The network interface will\r
503 not transmit if its internal recycled transmit buffer array\r
504 is full. Reading the transmit buffer does not clear the\r
505 transmit interrupt. If this is NULL, then the transmit buffer\r
506 status will not be read. If there are no transmit buffers to\r
507 recycle and TxBuf is not NULL, * TxBuf will be set to NULL.\r
508\r
509 @retval EFI_SUCCESS The status of the network interface was retrieved.\r
510 @retval EFI_NOT_STARTED The network interface has not been started.\r
511 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
512 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
513 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
514\r
515**/\r
516typedef\r
517EFI_STATUS\r
8b13229b 518(EFIAPI *EFI_SIMPLE_NETWORK_GET_STATUS)(\r
d1f95000 519 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
520 OUT UINT32 *InterruptStatus OPTIONAL,\r
521 OUT VOID **TxBuf OPTIONAL\r
ed66e1bc 522 );\r
d1f95000 523\r
524/**\r
525 Places a packet in the transmit queue of a network interface.\r
526\r
527 @param This Protocol instance pointer.\r
528 @param HeaderSize The size, in bytes, of the media header to be filled in by\r
529 the Transmit() function. If HeaderSize is non-zero, then it\r
530 must be equal to This->Mode->MediaHeaderSize and the DestAddr\r
531 and Protocol parameters must not be NULL.\r
532 @param BufferSize The size, in bytes, of the entire packet (media header and\r
533 data) to be transmitted through the network interface.\r
534 @param Buffer A pointer to the packet (media header followed by data) to be\r
535 transmitted. This parameter cannot be NULL. If HeaderSize is zero,\r
536 then the media header in Buffer must already be filled in by the\r
537 caller. If HeaderSize is non-zero, then the media header will be\r
538 filled in by the Transmit() function.\r
539 @param SrcAddr The source HW MAC address. If HeaderSize is zero, then this parameter\r
540 is ignored. If HeaderSize is non-zero and SrcAddr is NULL, then\r
541 This->Mode->CurrentAddress is used for the source HW MAC address.\r
542 @param DsetAddr The destination HW MAC address. If HeaderSize is zero, then this\r
543 parameter is ignored.\r
544 @param Protocol The type of header to build. If HeaderSize is zero, then this\r
545 parameter is ignored. See RFC 1700, section "Ether Types", for\r
546 examples.\r
547\r
548 @retval EFI_SUCCESS The packet was placed on the transmit queue.\r
549 @retval EFI_NOT_STARTED The network interface has not been started.\r
550 @retval EFI_NOT_READY The network interface is too busy to accept this transmit request. \r
551 @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.\r
552 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
553 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
554 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
555\r
556**/\r
557typedef\r
558EFI_STATUS\r
8b13229b 559(EFIAPI *EFI_SIMPLE_NETWORK_TRANSMIT)(\r
d1f95000 560 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
561 IN UINTN HeaderSize,\r
562 IN UINTN BufferSize,\r
563 IN VOID *Buffer,\r
564 IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL,\r
565 IN EFI_MAC_ADDRESS *DestAddr OPTIONAL,\r
566 IN UINT16 *Protocol OPTIONAL\r
ed66e1bc 567 );\r
d1f95000 568\r
569/**\r
570 Receives a packet from a network interface.\r
571\r
572 @param This Protocol instance pointer.\r
573 @param HeaderSize The size, in bytes, of the media header received on the network\r
574 interface. If this parameter is NULL, then the media header size\r
575 will not be returned.\r
576 @param BufferSize On entry, the size, in bytes, of Buffer. On exit, the size, in\r
577 bytes, of the packet that was received on the network interface.\r
578 @param Buffer A pointer to the data buffer to receive both the media header and\r
579 the data.\r
580 @param SrcAddr The source HW MAC address. If this parameter is NULL, the\r
581 HW MAC source address will not be extracted from the media\r
582 header.\r
583 @param DsetAddr The destination HW MAC address. If this parameter is NULL,\r
584 the HW MAC destination address will not be extracted from the\r
585 media header.\r
586 @param Protocol The media header type. If this parameter is NULL, then the\r
587 protocol will not be extracted from the media header. See\r
588 RFC 1700 section "Ether Types" for examples.\r
589\r
590 @retval EFI_SUCCESS The received data was stored in Buffer, and BufferSize has\r
591 been updated to the number of bytes received.\r
592 @retval EFI_NOT_STARTED The network interface has not been started.\r
593 @retval EFI_NOT_READY The network interface is too busy to accept this transmit\r
594 request.\r
595 @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.\r
596 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
597 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
598 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
599\r
600**/\r
601typedef\r
602EFI_STATUS\r
8b13229b 603(EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE)(\r
d1f95000 604 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
605 OUT UINTN *HeaderSize OPTIONAL,\r
606 IN OUT UINTN *BufferSize,\r
607 OUT VOID *Buffer,\r
608 OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL,\r
609 OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL,\r
610 OUT UINT16 *Protocol OPTIONAL\r
ed66e1bc 611 );\r
d1f95000 612\r
613#define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION 0x00010000\r
614\r
a6508c05 615//\r
616// Revision defined in EFI1.1\r
617// \r
618#define EFI_SIMPLE_NETWORK_INTERFACE_REVISION EFI_SIMPLE_NETWORK_PROTOCOL_REVISION\r
619\r
44717a39 620///\r
621/// The EFI_SIMPLE_NETWORK_PROTOCOL protocol is used to initialize access \r
622/// to a network adapter. Once the network adapter initializes, \r
623/// the EFI_SIMPLE_NETWORK_PROTOCOL protocol provides services that \r
624/// allow packets to be transmitted and received.\r
625///\r
d1f95000 626struct _EFI_SIMPLE_NETWORK_PROTOCOL {\r
1f08a159 627 ///\r
628 /// Revision of the EFI_SIMPLE_NETWORK_PROTOCOL. All future revisions must \r
629 /// be backwards compatible. If a future version is not backwards compatible \r
630 /// it is not the same GUID.\r
631 ///\r
d1f95000 632 UINT64 Revision;\r
633 EFI_SIMPLE_NETWORK_START Start;\r
634 EFI_SIMPLE_NETWORK_STOP Stop;\r
635 EFI_SIMPLE_NETWORK_INITIALIZE Initialize;\r
636 EFI_SIMPLE_NETWORK_RESET Reset;\r
637 EFI_SIMPLE_NETWORK_SHUTDOWN Shutdown;\r
638 EFI_SIMPLE_NETWORK_RECEIVE_FILTERS ReceiveFilters;\r
639 EFI_SIMPLE_NETWORK_STATION_ADDRESS StationAddress;\r
640 EFI_SIMPLE_NETWORK_STATISTICS Statistics;\r
641 EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC MCastIpToMac;\r
642 EFI_SIMPLE_NETWORK_NVDATA NvData;\r
643 EFI_SIMPLE_NETWORK_GET_STATUS GetStatus;\r
644 EFI_SIMPLE_NETWORK_TRANSMIT Transmit;\r
645 EFI_SIMPLE_NETWORK_RECEIVE Receive;\r
1f08a159 646 ///\r
647 /// Event used with WaitForEvent() to wait for a packet to be received.\r
648 ///\r
d1f95000 649 EFI_EVENT WaitForPacket;\r
44717a39 650 ///\r
651 /// Pointer to the EFI_SIMPLE_NETWORK_MODE data for the device.\r
652 ///\r
d1f95000 653 EFI_SIMPLE_NETWORK_MODE *Mode;\r
654};\r
655\r
656extern EFI_GUID gEfiSimpleNetworkProtocolGuid;\r
657\r
658#endif\r