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