]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/ManagedNetwork.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Include / Protocol / ManagedNetwork.h
CommitLineData
d1f95000 1/** @file\r
2 EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL as defined in UEFI 2.0.\r
3 EFI_MANAGED_NETWORK_PROTOCOL as defined in UEFI 2.0.\r
4\r
9095d37b 5Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 6SPDX-License-Identifier: BSD-2-Clause-Patent\r
d1f95000 7\r
9095d37b 8 @par Revision Reference:\r
5899caf0 9 This Protocol is introduced in UEFI Specification 2.0\r
10\r
d1f95000 11**/\r
12\r
19bee90c
LG
13#ifndef __EFI_MANAGED_NETWORK_PROTOCOL_H__\r
14#define __EFI_MANAGED_NETWORK_PROTOCOL_H__\r
d1f95000 15\r
16#include <Protocol/SimpleNetwork.h>\r
17\r
18#define EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL_GUID \\r
19 { \\r
20 0xf36ff770, 0xa7e1, 0x42cf, {0x9e, 0xd2, 0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c } \\r
21 }\r
22\r
23#define EFI_MANAGED_NETWORK_PROTOCOL_GUID \\r
24 { \\r
f6203b71 25 0x7ab33a91, 0xace5, 0x4326, { 0xb5, 0x72, 0xe7, 0xee, 0x33, 0xd3, 0x9f, 0x16 } \\r
d1f95000 26 }\r
27\r
28typedef struct _EFI_MANAGED_NETWORK_PROTOCOL EFI_MANAGED_NETWORK_PROTOCOL;\r
29\r
30typedef struct {\r
992f22b9
LG
31 ///\r
32 /// Timeout value for a UEFI one-shot timer event. A packet that has not been removed\r
33 /// from the MNP receive queue will be dropped if its receive timeout expires.\r
34 ///\r
d1f95000 35 UINT32 ReceivedQueueTimeoutValue;\r
992f22b9
LG
36 ///\r
37 /// Timeout value for a UEFI one-shot timer event. A packet that has not been removed\r
38 /// from the MNP transmit queue will be dropped if its receive timeout expires.\r
39 ///\r
d1f95000 40 UINT32 TransmitQueueTimeoutValue;\r
992f22b9
LG
41 ///\r
42 /// Ethernet type II 16-bit protocol type in host byte order. Valid\r
43 /// values are zero and 1,500 to 65,535.\r
44 ///\r
d1f95000 45 UINT16 ProtocolTypeFilter;\r
992f22b9
LG
46 ///\r
47 /// Set to TRUE to receive packets that are sent to the network\r
48 /// device MAC address. The startup default value is FALSE.\r
49 ///\r
d1f95000 50 BOOLEAN EnableUnicastReceive;\r
992f22b9
LG
51 ///\r
52 /// Set to TRUE to receive packets that are sent to any of the\r
53 /// active multicast groups. The startup default value is FALSE.\r
54 ///\r
d1f95000 55 BOOLEAN EnableMulticastReceive;\r
992f22b9
LG
56 ///\r
57 /// Set to TRUE to receive packets that are sent to the network\r
58 /// device broadcast address. The startup default value is FALSE.\r
59 ///\r
d1f95000 60 BOOLEAN EnableBroadcastReceive;\r
992f22b9
LG
61 ///\r
62 /// Set to TRUE to receive packets that are sent to any MAC address.\r
63 /// The startup default value is FALSE.\r
64 ///\r
d1f95000 65 BOOLEAN EnablePromiscuousReceive;\r
992f22b9
LG
66 ///\r
67 /// Set to TRUE to drop queued packets when the configuration\r
68 /// is changed. The startup default value is FALSE.\r
69 ///\r
d1f95000 70 BOOLEAN FlushQueuesOnReset;\r
992f22b9
LG
71 ///\r
72 /// Set to TRUE to timestamp all packets when they are received\r
73 /// by the MNP. Note that timestamps may be unsupported in some\r
74 /// MNP implementations. The startup default value is FALSE.\r
75 ///\r
d1f95000 76 BOOLEAN EnableReceiveTimestamps;\r
992f22b9
LG
77 ///\r
78 /// Set to TRUE to disable background polling in this MNP\r
79 /// instance. Note that background polling may not be supported in\r
80 /// all MNP implementations. The startup default value is FALSE,\r
81 /// unless background polling is not supported.\r
82 ///\r
d1f95000 83 BOOLEAN DisableBackgroundPolling;\r
84} EFI_MANAGED_NETWORK_CONFIG_DATA;\r
85\r
86typedef struct {\r
2f88bd3a
MK
87 EFI_TIME Timestamp;\r
88 EFI_EVENT RecycleEvent;\r
89 UINT32 PacketLength;\r
90 UINT32 HeaderLength;\r
91 UINT32 AddressLength;\r
92 UINT32 DataLength;\r
93 BOOLEAN BroadcastFlag;\r
94 BOOLEAN MulticastFlag;\r
95 BOOLEAN PromiscuousFlag;\r
96 UINT16 ProtocolType;\r
97 VOID *DestinationAddress;\r
98 VOID *SourceAddress;\r
99 VOID *MediaHeader;\r
100 VOID *PacketData;\r
d1f95000 101} EFI_MANAGED_NETWORK_RECEIVE_DATA;\r
102\r
103typedef struct {\r
2f88bd3a
MK
104 UINT32 FragmentLength;\r
105 VOID *FragmentBuffer;\r
d1f95000 106} EFI_MANAGED_NETWORK_FRAGMENT_DATA;\r
107\r
108typedef struct {\r
2f88bd3a
MK
109 EFI_MAC_ADDRESS *DestinationAddress; // OPTIONAL\r
110 EFI_MAC_ADDRESS *SourceAddress; // OPTIONAL\r
111 UINT16 ProtocolType; // OPTIONAL\r
112 UINT32 DataLength;\r
113 UINT16 HeaderLength; // OPTIONAL\r
114 UINT16 FragmentCount;\r
115 EFI_MANAGED_NETWORK_FRAGMENT_DATA FragmentTable[1];\r
d1f95000 116} EFI_MANAGED_NETWORK_TRANSMIT_DATA;\r
117\r
d1f95000 118typedef struct {\r
992f22b9
LG
119 ///\r
120 /// This Event will be signaled after the Status field is updated\r
121 /// by the MNP. The type of Event must be\r
122 /// EFI_NOTIFY_SIGNAL. The Task Priority Level (TPL) of\r
123 /// Event must be lower than or equal to TPL_CALLBACK.\r
124 ///\r
2f88bd3a 125 EFI_EVENT Event;\r
992f22b9
LG
126 ///\r
127 /// The status that is returned to the caller at the end of the operation\r
128 /// to indicate whether this operation completed successfully.\r
129 ///\r
2f88bd3a 130 EFI_STATUS Status;\r
d1f95000 131 union {\r
992f22b9
LG
132 ///\r
133 /// When this token is used for receiving, RxData is a pointer to the EFI_MANAGED_NETWORK_RECEIVE_DATA.\r
134 ///\r
2f88bd3a 135 EFI_MANAGED_NETWORK_RECEIVE_DATA *RxData;\r
992f22b9
LG
136 ///\r
137 /// When this token is used for transmitting, TxData is a pointer to the EFI_MANAGED_NETWORK_TRANSMIT_DATA.\r
138 ///\r
2f88bd3a 139 EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData;\r
d1f95000 140 } Packet;\r
141} EFI_MANAGED_NETWORK_COMPLETION_TOKEN;\r
142\r
143/**\r
144 Returns the operational parameters for the current MNP child driver.\r
145\r
af2dc6a7 146 @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
147 @param MnpConfigData The pointer to storage for MNP operational parameters.\r
148 @param SnpModeData The pointer to storage for SNP operational parameters.\r
d1f95000 149\r
150 @retval EFI_SUCCESS The operation completed successfully.\r
151 @retval EFI_INVALID_PARAMETER This is NULL.\r
152 @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation.\r
153 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured. The default\r
154 values are returned in MnpConfigData if it is not NULL.\r
155 @retval Other The mode data could not be read.\r
156\r
157**/\r
158typedef\r
159EFI_STATUS\r
8b13229b 160(EFIAPI *EFI_MANAGED_NETWORK_GET_MODE_DATA)(\r
d1f95000 161 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
162 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,\r
f6203b71 163 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL\r
ed66e1bc 164 );\r
d1f95000 165\r
166/**\r
167 Sets or clears the operational parameters for the MNP child driver.\r
168\r
af2dc6a7 169 @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
170 @param MnpConfigData The pointer to configuration data that will be assigned to the MNP\r
d1f95000 171 child driver instance. If NULL, the MNP child driver instance is\r
172 reset to startup defaults and all pending transmit and receive\r
173 requests are flushed.\r
174\r
175 @retval EFI_SUCCESS The operation completed successfully.\r
176 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
177 @retval EFI_OUT_OF_RESOURCES Required system resources (usually memory) could not be\r
178 allocated.\r
179 @retval EFI_UNSUPPORTED The requested feature is unsupported in this [MNP]\r
180 implementation.\r
181 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r
182 @retval Other The MNP child driver instance has been reset to startup defaults.\r
183\r
184**/\r
185typedef\r
186EFI_STATUS\r
8b13229b 187(EFIAPI *EFI_MANAGED_NETWORK_CONFIGURE)(\r
d1f95000 188 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
f6203b71 189 IN EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL\r
ed66e1bc 190 );\r
f6203b71 191\r
d1f95000 192/**\r
193 Translates an IP multicast address to a hardware (MAC) multicast address.\r
194\r
af2dc6a7 195 @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
d1f95000 196 @param Ipv6Flag Set to TRUE to if IpAddress is an IPv6 multicast address.\r
197 Set to FALSE if IpAddress is an IPv4 multicast address.\r
af2dc6a7 198 @param IpAddress The pointer to the multicast IP address (in network byte order) to convert.\r
199 @param MacAddress The pointer to the resulting multicast MAC address.\r
d1f95000 200\r
201 @retval EFI_SUCCESS The operation completed successfully.\r
202 @retval EFI_INVALID_PARAMETER One of the following conditions is TRUE:\r
203 - This is NULL.\r
204 - IpAddress is NULL.\r
205 - *IpAddress is not a valid multicast IP address.\r
206 - MacAddress is NULL.\r
207 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.\r
208 @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation.\r
209 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r
210 @retval Other The address could not be converted.\r
211\r
212**/\r
213typedef\r
214EFI_STATUS\r
8b13229b 215(EFIAPI *EFI_MANAGED_NETWORK_MCAST_IP_TO_MAC)(\r
d1f95000 216 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
217 IN BOOLEAN Ipv6Flag,\r
218 IN EFI_IP_ADDRESS *IpAddress,\r
f6203b71 219 OUT EFI_MAC_ADDRESS *MacAddress\r
ed66e1bc 220 );\r
d1f95000 221\r
222/**\r
223 Enables and disables receive filters for multicast address.\r
224\r
af2dc6a7 225 @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
d1f95000 226 @param JoinFlag Set to TRUE to join this multicast group.\r
227 Set to FALSE to leave this multicast group.\r
af2dc6a7 228 @param MacAddress The pointer to the multicast MAC group (address) to join or leave.\r
d1f95000 229\r
230 @retval EFI_SUCCESS The requested operation completed successfully.\r
231 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
232 - This is NULL.\r
233 - JoinFlag is TRUE and MacAddress is NULL.\r
234 - *MacAddress is not a valid multicast MAC address.\r
235 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.\r
236 @retval EFI_ALREADY_STARTED The supplied multicast group is already joined.\r
237 @retval EFI_NOT_FOUND The supplied multicast group is not joined.\r
f6203b71 238 @retval EFI_DEVICE_ERROR An unexpected network or system error occurred.\r
d1f95000 239 @retval EFI_UNSUPPORTED The requested feature is unsupported in this MNP implementation.\r
240 @retval Other The requested operation could not be completed.\r
241\r
242**/\r
243typedef\r
244EFI_STATUS\r
8b13229b 245(EFIAPI *EFI_MANAGED_NETWORK_GROUPS)(\r
d1f95000 246 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
247 IN BOOLEAN JoinFlag,\r
f6203b71 248 IN EFI_MAC_ADDRESS *MacAddress OPTIONAL\r
ed66e1bc 249 );\r
f6203b71 250\r
d1f95000 251/**\r
252 Places asynchronous outgoing data packets into the transmit queue.\r
253\r
af2dc6a7 254 @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
255 @param Token The pointer to a token associated with the transmit data descriptor.\r
d1f95000 256\r
257 @retval EFI_SUCCESS The transmit completion token was cached.\r
258 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.\r
259 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
260 @retval EFI_ACCESS_DENIED The transmit completion token is already in the transmit queue.\r
261 @retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a lack of system resources\r
262 (usually memory).\r
263 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
264 @retval EFI_NOT_READY The transmit request could not be queued because the transmit queue is full.\r
265\r
266**/\r
267typedef\r
268EFI_STATUS\r
8b13229b 269(EFIAPI *EFI_MANAGED_NETWORK_TRANSMIT)(\r
d1f95000 270 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
f6203b71 271 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token\r
ed66e1bc 272 );\r
f6203b71 273\r
d1f95000 274/**\r
275 Places an asynchronous receiving request into the receiving queue.\r
276\r
af2dc6a7 277 @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
278 @param Token The pointer to a token associated with the receive data descriptor.\r
d1f95000 279\r
280 @retval EFI_SUCCESS The receive completion token was cached.\r
281 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.\r
282 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r
283 - This is NULL.\r
284 - Token is NULL.\r
af2dc6a7 285 - Token.Event is NULL.\r
d1f95000 286 @retval EFI_OUT_OF_RESOURCES The transmit data could not be queued due to a lack of system resources\r
287 (usually memory).\r
288 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
289 @retval EFI_ACCESS_DENIED The receive completion token was already in the receive queue.\r
290 @retval EFI_NOT_READY The receive request could not be queued because the receive queue is full.\r
291\r
292**/\r
293typedef\r
294EFI_STATUS\r
8b13229b 295(EFIAPI *EFI_MANAGED_NETWORK_RECEIVE)(\r
d1f95000 296 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
f6203b71 297 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token\r
ed66e1bc 298 );\r
f6203b71 299\r
d1f95000 300/**\r
301 Aborts an asynchronous transmit or receive request.\r
302\r
af2dc6a7 303 @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
304 @param Token The pointer to a token that has been issued by\r
d1f95000 305 EFI_MANAGED_NETWORK_PROTOCOL.Transmit() or\r
306 EFI_MANAGED_NETWORK_PROTOCOL.Receive(). If\r
307 NULL, all pending tokens are aborted.\r
308\r
309 @retval EFI_SUCCESS The asynchronous I/O request was aborted and Token.Event\r
310 was signaled. When Token is NULL, all pending requests were\r
311 aborted and their events were signaled.\r
312 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.\r
313 @retval EFI_INVALID_PARAMETER This is NULL.\r
314 @retval EFI_NOT_FOUND When Token is not NULL, the asynchronous I/O request was\r
315 not found in the transmit or receive queue. It has either completed\r
316 or was not issued by Transmit() and Receive().\r
317\r
318**/\r
319typedef\r
320EFI_STATUS\r
8b13229b 321(EFIAPI *EFI_MANAGED_NETWORK_CANCEL)(\r
d1f95000 322 IN EFI_MANAGED_NETWORK_PROTOCOL *This,\r
f6203b71 323 IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token OPTIONAL\r
ed66e1bc 324 );\r
d1f95000 325\r
326/**\r
327 Polls for incoming data packets and processes outgoing data packets.\r
328\r
af2dc6a7 329 @param This The pointer to the EFI_MANAGED_NETWORK_PROTOCOL instance.\r
d1f95000 330\r
331 @retval EFI_SUCCESS Incoming or outgoing data was processed.\r
332 @retval EFI_NOT_STARTED This MNP child driver instance has not been configured.\r
333 @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.\r
334 @retval EFI_NOT_READY No incoming or outgoing data was processed. Consider increasing\r
335 the polling rate.\r
336 @retval EFI_TIMEOUT Data was dropped out of the transmit and/or receive queue.\r
337 Consider increasing the polling rate.\r
338\r
339**/\r
340typedef\r
341EFI_STATUS\r
8b13229b 342(EFIAPI *EFI_MANAGED_NETWORK_POLL)(\r
f6203b71 343 IN EFI_MANAGED_NETWORK_PROTOCOL *This\r
ed66e1bc 344 );\r
d1f95000 345\r
44717a39 346///\r
9095d37b 347/// The MNP is used by network applications (and drivers) to\r
44717a39 348/// perform raw (unformatted) asynchronous network packet I/O.\r
349///\r
d1f95000 350struct _EFI_MANAGED_NETWORK_PROTOCOL {\r
2f88bd3a
MK
351 EFI_MANAGED_NETWORK_GET_MODE_DATA GetModeData;\r
352 EFI_MANAGED_NETWORK_CONFIGURE Configure;\r
353 EFI_MANAGED_NETWORK_MCAST_IP_TO_MAC McastIpToMac;\r
354 EFI_MANAGED_NETWORK_GROUPS Groups;\r
355 EFI_MANAGED_NETWORK_TRANSMIT Transmit;\r
356 EFI_MANAGED_NETWORK_RECEIVE Receive;\r
357 EFI_MANAGED_NETWORK_CANCEL Cancel;\r
358 EFI_MANAGED_NETWORK_POLL Poll;\r
d1f95000 359};\r
360\r
2f88bd3a
MK
361extern EFI_GUID gEfiManagedNetworkServiceBindingProtocolGuid;\r
362extern EFI_GUID gEfiManagedNetworkProtocolGuid;\r
d1f95000 363\r
364#endif\r