]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Protocol/SimpleNetwork.h
OvmfPkg: Skip initrd command on Xcode toolchain
[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 - 2018, Intel Corporation. All rights reserved.<BR>\r
13SPDX-License-Identifier: BSD-2-Clause-Patent\r
14\r
15 @par Revision Reference:\r
16 This Protocol is introduced in EFI Specification 1.10.\r
17\r
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
28typedef struct _EFI_SIMPLE_NETWORK_PROTOCOL EFI_SIMPLE_NETWORK_PROTOCOL;\r
29\r
30\r
31///\r
32/// Protocol defined in EFI1.1.\r
33///\r
34typedef EFI_SIMPLE_NETWORK_PROTOCOL EFI_SIMPLE_NETWORK;\r
35\r
36///\r
37/// Simple Network Protocol data structures.\r
38///\r
39typedef struct {\r
40 ///\r
41 /// Total number of frames received. Includes frames with errors and\r
42 /// dropped frames.\r
43 ///\r
44 UINT64 RxTotalFrames;\r
45\r
46 ///\r
47 /// Number of valid frames received and copied into receive buffers.\r
48 ///\r
49 UINT64 RxGoodFrames;\r
50\r
51 ///\r
52 /// Number of frames below the minimum length for the media.\r
53 /// This would be <64 for ethernet.\r
54 ///\r
55 UINT64 RxUndersizeFrames;\r
56\r
57 ///\r
58 /// Number of frames longer than the maxminum length for the\r
59 /// media. This would be >1500 for ethernet.\r
60 ///\r
61 UINT64 RxOversizeFrames;\r
62\r
63 ///\r
64 /// Valid frames that were dropped because receive buffers were full.\r
65 ///\r
66 UINT64 RxDroppedFrames;\r
67\r
68 ///\r
69 /// Number of valid unicast frames received and not dropped.\r
70 ///\r
71 UINT64 RxUnicastFrames;\r
72\r
73 ///\r
74 /// Number of valid broadcast frames received and not dropped.\r
75 ///\r
76 UINT64 RxBroadcastFrames;\r
77\r
78 ///\r
79 /// Number of valid mutlicast frames received and not dropped.\r
80 ///\r
81 UINT64 RxMulticastFrames;\r
82\r
83 ///\r
84 /// Number of frames w/ CRC or alignment errors.\r
85 ///\r
86 UINT64 RxCrcErrorFrames;\r
87\r
88 ///\r
89 /// Total number of bytes received. Includes frames with errors\r
90 /// and dropped frames.\r
91 //\r
92 UINT64 RxTotalBytes;\r
93\r
94 ///\r
95 /// Transmit statistics.\r
96 ///\r
97 UINT64 TxTotalFrames;\r
98 UINT64 TxGoodFrames;\r
99 UINT64 TxUndersizeFrames;\r
100 UINT64 TxOversizeFrames;\r
101 UINT64 TxDroppedFrames;\r
102 UINT64 TxUnicastFrames;\r
103 UINT64 TxBroadcastFrames;\r
104 UINT64 TxMulticastFrames;\r
105 UINT64 TxCrcErrorFrames;\r
106 UINT64 TxTotalBytes;\r
107\r
108 ///\r
109 /// Number of collisions detection on this subnet.\r
110 ///\r
111 UINT64 Collisions;\r
112\r
113 ///\r
114 /// Number of frames destined for unsupported protocol.\r
115 ///\r
116 UINT64 UnsupportedProtocol;\r
117\r
118 ///\r
119 /// Number of valid frames received that were duplicated.\r
120 ///\r
121 UINT64 RxDuplicatedFrames;\r
122\r
123 ///\r
124 /// Number of encrypted frames received that failed to decrypt.\r
125 ///\r
126 UINT64 RxDecryptErrorFrames;\r
127\r
128 ///\r
129 /// Number of frames that failed to transmit after exceeding the retry limit.\r
130 ///\r
131 UINT64 TxErrorFrames;\r
132\r
133 ///\r
134 /// Number of frames transmitted successfully after more than one attempt.\r
135 ///\r
136 UINT64 TxRetryFrames;\r
137} EFI_NETWORK_STATISTICS;\r
138\r
139///\r
140/// The state of the network interface.\r
141/// When an EFI_SIMPLE_NETWORK_PROTOCOL driver initializes a\r
142/// network interface, the network interface is left in the EfiSimpleNetworkStopped state.\r
143///\r
144typedef enum {\r
145 EfiSimpleNetworkStopped,\r
146 EfiSimpleNetworkStarted,\r
147 EfiSimpleNetworkInitialized,\r
148 EfiSimpleNetworkMaxState\r
149} EFI_SIMPLE_NETWORK_STATE;\r
150\r
151#define EFI_SIMPLE_NETWORK_RECEIVE_UNICAST 0x01\r
152#define EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST 0x02\r
153#define EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST 0x04\r
154#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS 0x08\r
155#define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10\r
156\r
157#define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT 0x01\r
158#define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT 0x02\r
159#define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT 0x04\r
160#define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT 0x08\r
161\r
162#define MAX_MCAST_FILTER_CNT 16\r
163typedef struct {\r
164 ///\r
165 /// Reports the current state of the network interface.\r
166 ///\r
167 UINT32 State;\r
168 ///\r
169 /// The size, in bytes, of the network interface's HW address.\r
170 ///\r
171 UINT32 HwAddressSize;\r
172 ///\r
173 /// The size, in bytes, of the network interface's media header.\r
174 ///\r
175 UINT32 MediaHeaderSize;\r
176 ///\r
177 /// The maximum size, in bytes, of the packets supported by the network interface.\r
178 ///\r
179 UINT32 MaxPacketSize;\r
180 ///\r
181 /// The size, in bytes, of the NVRAM device attached to the network interface.\r
182 ///\r
183 UINT32 NvRamSize;\r
184 ///\r
185 /// The size that must be used for all NVRAM reads and writes. The\r
186 /// start address for NVRAM read and write operations and the total\r
187 /// length of those operations, must be a multiple of this value. The\r
188 /// legal values for this field are 0, 1, 2, 4, and 8.\r
189 ///\r
190 UINT32 NvRamAccessSize;\r
191 ///\r
192 /// The multicast receive filter settings supported by the network interface.\r
193 ///\r
194 UINT32 ReceiveFilterMask;\r
195 ///\r
196 /// The current multicast receive filter settings.\r
197 ///\r
198 UINT32 ReceiveFilterSetting;\r
199 ///\r
200 /// The maximum number of multicast address receive filters supported by the driver.\r
201 ///\r
202 UINT32 MaxMCastFilterCount;\r
203 ///\r
204 /// The current number of multicast address receive filters.\r
205 ///\r
206 UINT32 MCastFilterCount;\r
207 ///\r
208 /// Array containing the addresses of the current multicast address receive filters.\r
209 ///\r
210 EFI_MAC_ADDRESS MCastFilter[MAX_MCAST_FILTER_CNT];\r
211 ///\r
212 /// The current HW MAC address for the network interface.\r
213 ///\r
214 EFI_MAC_ADDRESS CurrentAddress;\r
215 ///\r
216 /// The current HW MAC address for broadcast packets.\r
217 ///\r
218 EFI_MAC_ADDRESS BroadcastAddress;\r
219 ///\r
220 /// The permanent HW MAC address for the network interface.\r
221 ///\r
222 EFI_MAC_ADDRESS PermanentAddress;\r
223 ///\r
224 /// The interface type of the network interface.\r
225 ///\r
226 UINT8 IfType;\r
227 ///\r
228 /// TRUE if the HW MAC address can be changed.\r
229 ///\r
230 BOOLEAN MacAddressChangeable;\r
231 ///\r
232 /// TRUE if the network interface can transmit more than one packet at a time.\r
233 ///\r
234 BOOLEAN MultipleTxSupported;\r
235 ///\r
236 /// TRUE if the presence of media can be determined; otherwise FALSE.\r
237 ///\r
238 BOOLEAN MediaPresentSupported;\r
239 ///\r
240 /// TRUE if media are connected to the network interface; otherwise FALSE.\r
241 ///\r
242 BOOLEAN MediaPresent;\r
243} EFI_SIMPLE_NETWORK_MODE;\r
244\r
245//\r
246// Protocol Member Functions\r
247//\r
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
262(EFIAPI *EFI_SIMPLE_NETWORK_START)(\r
263 IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
264 );\r
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
280(EFIAPI *EFI_SIMPLE_NETWORK_STOP)(\r
281 IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
282 );\r
283\r
284/**\r
285 Resets a network adapter and allocates the transmit and receive buffers\r
286 required by the network interface; optionally, also requests allocation\r
287 of additional transmit and receive buffers.\r
288\r
289 @param This The protocol instance pointer.\r
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
302 @retval EFI_NOT_STARTED The network interface has not been started.\r
303 @retval EFI_OUT_OF_RESOURCES There was not enough memory for the transmit and\r
304 receive buffers.\r
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
312(EFIAPI *EFI_SIMPLE_NETWORK_INITIALIZE)(\r
313 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
314 IN UINTN ExtraRxBufferSize OPTIONAL,\r
315 IN UINTN ExtraTxBufferSize OPTIONAL\r
316 );\r
317\r
318/**\r
319 Resets a network adapter and re-initializes it with the parameters that were\r
320 provided in the previous call to Initialize().\r
321\r
322 @param This The protocol instance pointer.\r
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
328 @retval EFI_NOT_STARTED The network interface has not been started.\r
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
336(EFIAPI *EFI_SIMPLE_NETWORK_RESET)(\r
337 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
338 IN BOOLEAN ExtendedVerification\r
339 );\r
340\r
341/**\r
342 Resets a network adapter and leaves it in a state that is safe for\r
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
348 @retval EFI_NOT_STARTED The network interface has not been started.\r
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
356(EFIAPI *EFI_SIMPLE_NETWORK_SHUTDOWN)(\r
357 IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
358 );\r
359\r
360/**\r
361 Manages the multicast receive filters of a network interface.\r
362\r
363 @param This The protocol instance pointer.\r
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
378 @retval EFI_NOT_STARTED The network interface has not been started.\r
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
386(EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE_FILTERS)(\r
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
393 );\r
394\r
395/**\r
396 Modifies or resets the current station address, if supported.\r
397\r
398 @param This The protocol instance pointer.\r
399 @param Reset Flag used to reset the station address to the network interfaces\r
400 permanent address.\r
401 @param New The new station address to be used for the network interface.\r
402\r
403 @retval EFI_SUCCESS The network interfaces station address was updated.\r
404 @retval EFI_NOT_STARTED The network interface has not been started.\r
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
412(EFIAPI *EFI_SIMPLE_NETWORK_STATION_ADDRESS)(\r
413 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
414 IN BOOLEAN Reset,\r
415 IN EFI_MAC_ADDRESS *New OPTIONAL\r
416 );\r
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
441(EFIAPI *EFI_SIMPLE_NETWORK_STATISTICS)(\r
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
446 );\r
447\r
448/**\r
449 Converts a multicast IP address to a multicast HW MAC address.\r
450\r
451 @param This The protocol instance pointer.\r
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
471(EFIAPI *EFI_SIMPLE_NETWORK_MCAST_IP_TO_MAC)(\r
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
476 );\r
477\r
478/**\r
479 Performs read and write operations on the NVRAM device attached to a\r
480 network interface.\r
481\r
482 @param This The protocol instance pointer.\r
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
500(EFIAPI *EFI_SIMPLE_NETWORK_NVDATA)(\r
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
506 );\r
507\r
508/**\r
509 Reads the current interrupt status and recycled transmit buffer status from\r
510 a network interface.\r
511\r
512 @param This The protocol instance pointer.\r
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
535(EFIAPI *EFI_SIMPLE_NETWORK_GET_STATUS)(\r
536 IN EFI_SIMPLE_NETWORK_PROTOCOL *This,\r
537 OUT UINT32 *InterruptStatus OPTIONAL,\r
538 OUT VOID **TxBuf OPTIONAL\r
539 );\r
540\r
541/**\r
542 Places a packet in the transmit queue of a network interface.\r
543\r
544 @param This The protocol instance pointer.\r
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
559 @param DestAddr The destination HW MAC address. If HeaderSize is zero, then this\r
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
567 @retval EFI_NOT_READY The network interface is too busy to accept this transmit request.\r
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
576(EFIAPI *EFI_SIMPLE_NETWORK_TRANSMIT)(\r
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
584 );\r
585\r
586/**\r
587 Receives a packet from a network interface.\r
588\r
589 @param This The protocol instance pointer.\r
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
600 @param DestAddr The destination HW MAC address. If this parameter is NULL,\r
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
620(EFIAPI *EFI_SIMPLE_NETWORK_RECEIVE)(\r
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
628 );\r
629\r
630#define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION 0x00010000\r
631\r
632//\r
633// Revision defined in EFI1.1\r
634//\r
635#define EFI_SIMPLE_NETWORK_INTERFACE_REVISION EFI_SIMPLE_NETWORK_PROTOCOL_REVISION\r
636\r
637///\r
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
641/// allow packets to be transmitted and received.\r
642///\r
643struct _EFI_SIMPLE_NETWORK_PROTOCOL {\r
644 ///\r
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
647 /// it is not the same GUID.\r
648 ///\r
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
663 ///\r
664 /// Event used with WaitForEvent() to wait for a packet to be received.\r
665 ///\r
666 EFI_EVENT WaitForPacket;\r
667 ///\r
668 /// Pointer to the EFI_SIMPLE_NETWORK_MODE data for the device.\r
669 ///\r
670 EFI_SIMPLE_NETWORK_MODE *Mode;\r
671};\r
672\r
673extern EFI_GUID gEfiSimpleNetworkProtocolGuid;\r
674\r
675#endif\r