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