]> git.proxmox.com Git - mirror_edk2.git/blame - EmulatorPkg/Win/Host/WinPacketFilter.c
EmulatorPkg/WinHost: Enable network support.
[mirror_edk2.git] / EmulatorPkg / Win / Host / WinPacketFilter.c
CommitLineData
bb78cfbe
NW
1/**@file\r
2 Windows Packet Filter implementation of the EMU_SNP_PROTOCOL that allows the\r
3 emulator to get on real networks.\r
4\r
5Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>\r
6Portions copyright (c) 2011, Apple Inc. All rights reserved.\r
7(C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>\r
8\r
9SPDX-License-Identifier: BSD-2-Clause-Patent\r
10\r
11**/\r
12#include "WinHost.h"\r
13\r
14#define NETWORK_LIBRARY_NAME_U L"SnpNt32Io.dll"\r
15#define NETWORK_LIBRARY_INITIALIZE "SnpInitialize"\r
16#define NETWORK_LIBRARY_FINALIZE "SnpFinalize"\r
17#define NETWORK_LIBRARY_SET_RCV_FILTER "SnpSetReceiveFilter"\r
18#define NETWORK_LIBRARY_RECEIVE "SnpReceive"\r
19#define NETWORK_LIBRARY_TRANSMIT "SnpTransmit"\r
20\r
21#pragma pack(1)\r
22typedef struct _NT_NET_INTERFACE_INFO {\r
23 UINT32 InterfaceIndex;\r
24 EFI_MAC_ADDRESS MacAddr;\r
25} NT_NET_INTERFACE_INFO;\r
26#pragma pack()\r
27\r
28#define NET_ETHER_HEADER_SIZE 14\r
29#define MAX_INTERFACE_INFO_NUMBER 16\r
30#define SNP_MAX_TX_BUFFER_NUM 65536\r
31#define SNP_TX_BUFFER_INCREASEMENT 32\r
32#define DEFAULT_SELECTED_NIC_INDEX 0\r
33\r
34//\r
35// Functions in Net Library\r
36//\r
37typedef\r
38INT32\r
39(*NT_NET_INITIALIZE) (\r
40 IN OUT UINT32 *InterfaceCount,\r
41 IN OUT NT_NET_INTERFACE_INFO * InterfaceInfoBuffer\r
42 );\r
43\r
44typedef\r
45INT32\r
46(*NT_NET_FINALIZE) (\r
47 VOID\r
48 );\r
49\r
50typedef\r
51INT32\r
52(*NT_NET_SET_RECEIVE_FILTER) (\r
53 IN UINT32 Index,\r
54 IN UINT32 EnableFilter,\r
55 IN UINT32 MCastFilterCnt,\r
56 IN EFI_MAC_ADDRESS * MCastFilter\r
57 );\r
58\r
59typedef\r
60INT32\r
61(*NT_NET_RECEIVE) (\r
62 IN UINT32 Index,\r
63 IN OUT UINT32 *BufferSize,\r
64 OUT VOID *Buffer\r
65 );\r
66\r
67typedef\r
68INT32\r
69(*NT_NET_TRANSMIT) (\r
70 IN UINT32 Index,\r
71 IN UINT32 HeaderSize,\r
72 IN UINT32 BufferSize,\r
73 IN VOID *Buffer,\r
74 IN EFI_MAC_ADDRESS * SrcAddr,\r
75 IN EFI_MAC_ADDRESS * DestAddr,\r
76 IN UINT16 *Protocol\r
77 );\r
78\r
79typedef struct _NT_NET_UTILITY_TABLE {\r
80 NT_NET_INITIALIZE Initialize;\r
81 NT_NET_FINALIZE Finalize;\r
82 NT_NET_SET_RECEIVE_FILTER SetReceiveFilter;\r
83 NT_NET_RECEIVE Receive;\r
84 NT_NET_TRANSMIT Transmit;\r
85} NT_NET_UTILITY_TABLE;\r
86\r
87//\r
88// Instance data for each fake SNP instance\r
89//\r
90#define WIN_NT_INSTANCE_SIGNATURE SIGNATURE_32 ('N', 'T', 'I', 'S')\r
91\r
92typedef struct {\r
93 UINT32 Signature;\r
94\r
95 //\r
96 // Array of the recycled transmit buffer address.\r
97 //\r
98 UINT64 *RecycledTxBuf;\r
99\r
100 //\r
101 // Current number of recycled buffer pointers in RecycledTxBuf.\r
102 //\r
103 UINT32 RecycledTxBufCount;\r
104\r
105 //\r
106 // The maximum number of recycled buffer pointers in RecycledTxBuf.\r
107 //\r
108 UINT32 MaxRecycledTxBuf;\r
109 EFI_SIMPLE_NETWORK_MODE Mode;\r
110 NT_NET_INTERFACE_INFO InterfaceInfo;\r
111} WIN_NT_INSTANCE_DATA;\r
112\r
113//\r
114// Instance data for each SNP private instance\r
115//\r
116#define WIN_NT_SIMPLE_NETWORK_PRIVATE_SIGNATURE SIGNATURE_32 ('N', 'T', 's', 'n')\r
117\r
118typedef struct {\r
119 UINTN Signature;\r
120 EMU_IO_THUNK_PROTOCOL *Thunk;\r
121 EMU_SNP_PROTOCOL EmuSnp;\r
122 EFI_SIMPLE_NETWORK_MODE *Mode;\r
123 HMODULE NetworkLibraryHandle;\r
124 NT_NET_UTILITY_TABLE NtNetUtilityTable;\r
125 WIN_NT_INSTANCE_DATA Instance;\r
126} WIN_NT_SNP_PRIVATE;\r
127\r
128#define WIN_NT_SNP_PRIVATE_DATA_FROM_THIS(a) \\r
129 CR(a, WIN_NT_SNP_PRIVATE, EmuSnp, WIN_NT_SIMPLE_NETWORK_PRIVATE_SIGNATURE)\r
130\r
131\r
132/**\r
133 Register storage for SNP Mode.\r
134\r
135 @param This Protocol instance pointer.\r
136 @param Mode SimpleNetworkProtocol Mode structure passed into driver.\r
137\r
138 @retval EFI_SUCCESS The network interface was started.\r
139 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
140\r
141**/\r
142EFI_STATUS\r
143WinNtSnpCreateMapping (\r
144 IN EMU_SNP_PROTOCOL *This,\r
145 IN EFI_SIMPLE_NETWORK_MODE *Mode\r
146 )\r
147{\r
148 WIN_NT_SNP_PRIVATE *Private;\r
149\r
150 Private = WIN_NT_SNP_PRIVATE_DATA_FROM_THIS (This);\r
151\r
152 Private->Mode = Mode;\r
153\r
154 //\r
155 // Set the broadcast address.\r
156 //\r
157 CopyMem (&Mode->BroadcastAddress, &Private->Instance.Mode.BroadcastAddress, sizeof (EFI_MAC_ADDRESS));\r
158 //\r
159 // Set the MAC address.\r
160 //\r
161 CopyMem (&Mode->CurrentAddress, &Private->Instance.Mode.CurrentAddress, sizeof (EFI_MAC_ADDRESS));\r
162 CopyMem (&Mode->PermanentAddress, &Private->Instance.Mode.PermanentAddress, sizeof (EFI_MAC_ADDRESS));\r
163\r
164 return EFI_SUCCESS;\r
165}\r
166\r
167/**\r
168 Changes the state of a network interface from "stopped" to "started".\r
169\r
170 @param This Protocol instance pointer.\r
171\r
172 @retval EFI_SUCCESS The network interface was started.\r
173 @retval EFI_ALREADY_STARTED The network interface is already in the started state.\r
174 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
175 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
176 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
177\r
178**/\r
179EFI_STATUS\r
180WinNtSnpStart (\r
181 IN EMU_SNP_PROTOCOL *This\r
182 )\r
183{\r
184 WIN_NT_SNP_PRIVATE *Private;\r
185\r
186 Private = WIN_NT_SNP_PRIVATE_DATA_FROM_THIS (This);\r
187\r
188 switch (Private->Mode->State) {\r
189 case EfiSimpleNetworkStopped:\r
190 break;\r
191\r
192 case EfiSimpleNetworkStarted:\r
193 case EfiSimpleNetworkInitialized:\r
194 return EFI_ALREADY_STARTED;\r
195 break;\r
196\r
197 default:\r
198 return EFI_DEVICE_ERROR;\r
199 break;\r
200 }\r
201\r
202 Private->Mode->State = EfiSimpleNetworkStarted;\r
203\r
204 return EFI_SUCCESS;\r
205}\r
206\r
207/**\r
208 Changes the state of a network interface from "started" to "stopped".\r
209\r
210 @param This Protocol instance pointer.\r
211\r
212 @retval EFI_SUCCESS The network interface was stopped.\r
213 @retval EFI_ALREADY_STARTED The network interface is already in the stopped state.\r
214 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
215 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
216 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
217\r
218**/\r
219EFI_STATUS\r
220WinNtSnpStop (\r
221 IN EMU_SNP_PROTOCOL *This\r
222 )\r
223{\r
224 WIN_NT_SNP_PRIVATE *Private;\r
225\r
226 Private = WIN_NT_SNP_PRIVATE_DATA_FROM_THIS (This);\r
227\r
228 switch ( Private->Mode->State ) {\r
229 case EfiSimpleNetworkStarted:\r
230 break;\r
231\r
232 case EfiSimpleNetworkStopped:\r
233 return EFI_NOT_STARTED;\r
234 break;\r
235\r
236 default:\r
237 return EFI_DEVICE_ERROR;\r
238 break;\r
239 }\r
240\r
241 Private->Mode->State = EfiSimpleNetworkStopped;\r
242\r
243 return EFI_SUCCESS;\r
244}\r
245\r
246/**\r
247 Resets a network adapter and allocates the transmit and receive buffers\r
248 required by the network interface; optionally, also requests allocation\r
249 of additional transmit and receive buffers.\r
250\r
251 @param This The protocol instance pointer.\r
252 @param ExtraRxBufferSize The size, in bytes, of the extra receive buffer space\r
253 that the driver should allocate for the network interface.\r
254 Some network interfaces will not be able to use the extra\r
255 buffer, and the caller will not know if it is actually\r
256 being used.\r
257 @param ExtraTxBufferSize The size, in bytes, of the extra transmit buffer space\r
258 that the driver should allocate for the network interface.\r
259 Some network interfaces will not be able to use the extra\r
260 buffer, and the caller will not know if it is actually\r
261 being used.\r
262\r
263 @retval EFI_SUCCESS The network interface was initialized.\r
264 @retval EFI_NOT_STARTED The network interface has not been started.\r
265 @retval EFI_OUT_OF_RESOURCES There was not enough memory for the transmit and\r
266 receive buffers.\r
267 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
268 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
269 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
270\r
271**/\r
272EFI_STATUS\r
273WinNtSnpInitialize (\r
274 IN EMU_SNP_PROTOCOL *This,\r
275 IN UINTN ExtraRxBufferSize OPTIONAL,\r
276 IN UINTN ExtraTxBufferSize OPTIONAL\r
277 )\r
278{\r
279 WIN_NT_SNP_PRIVATE *Private;\r
280\r
281 Private = WIN_NT_SNP_PRIVATE_DATA_FROM_THIS (This);\r
282\r
283 switch ( Private->Mode->State ) {\r
284 case EfiSimpleNetworkStarted:\r
285 break;\r
286\r
287 case EfiSimpleNetworkStopped:\r
288 return EFI_NOT_STARTED;\r
289 break;\r
290\r
291 default:\r
292 return EFI_DEVICE_ERROR;\r
293 break;\r
294 }\r
295\r
296 Private->Mode->MCastFilterCount = 0;\r
297 Private->Mode->ReceiveFilterSetting = 0;\r
298 ZeroMem (Private->Mode->MCastFilter, sizeof (Private->Mode->MCastFilter));\r
299\r
300 Private->Mode->State = EfiSimpleNetworkInitialized;\r
301\r
302 return EFI_SUCCESS;\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
321EFI_STATUS\r
322WinNtSnpReset (\r
323 IN EMU_SNP_PROTOCOL *This,\r
324 IN BOOLEAN ExtendedVerification\r
325 )\r
326{\r
327 WIN_NT_SNP_PRIVATE *Private;\r
328\r
329 Private = WIN_NT_SNP_PRIVATE_DATA_FROM_THIS (This);\r
330\r
331 switch ( Private->Mode->State ) {\r
332 case EfiSimpleNetworkInitialized:\r
333 break;\r
334\r
335 case EfiSimpleNetworkStopped:\r
336 return EFI_NOT_STARTED;\r
337 break;\r
338\r
339 default:\r
340 return EFI_DEVICE_ERROR;\r
341 break;\r
342 }\r
343\r
344 return EFI_SUCCESS;\r
345}\r
346\r
347/**\r
348 Resets a network adapter and leaves it in a state that is safe for\r
349 another driver to initialize.\r
350\r
351 @param This Protocol instance pointer.\r
352\r
353 @retval EFI_SUCCESS The network interface was shutdown.\r
354 @retval EFI_NOT_STARTED The network interface has not been started.\r
355 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
356 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
357 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
358\r
359**/\r
360EFI_STATUS\r
361WinNtSnpShutdown (\r
362 IN EMU_SNP_PROTOCOL *This\r
363 )\r
364{\r
365 WIN_NT_SNP_PRIVATE *Private;\r
366\r
367 Private = WIN_NT_SNP_PRIVATE_DATA_FROM_THIS (This);\r
368\r
369 switch ( Private->Mode->State ) {\r
370 case EfiSimpleNetworkInitialized:\r
371 break;\r
372\r
373 case EfiSimpleNetworkStopped:\r
374 return EFI_NOT_STARTED;\r
375 break;\r
376\r
377 default:\r
378 return EFI_DEVICE_ERROR;\r
379 break;\r
380 }\r
381\r
382 Private->Mode->State = EfiSimpleNetworkStarted;\r
383\r
384 Private->Mode->ReceiveFilterSetting = 0;\r
385 Private->Mode->MCastFilterCount = 0;\r
386 ZeroMem (Private->Mode->MCastFilter, sizeof (Private->Mode->MCastFilter));\r
387\r
388 return EFI_SUCCESS;\r
389}\r
390\r
391/**\r
392 Manages the multicast receive filters of a network interface.\r
393\r
394 @param This The protocol instance pointer.\r
395 @param Enable A bit mask of receive filters to enable on the network interface.\r
396 @param Disable A bit mask of receive filters to disable on the network interface.\r
397 @param ResetMCastFilter Set to TRUE to reset the contents of the multicast receive\r
398 filters on the network interface to their default values.\r
399 @param McastFilterCnt Number of multicast HW MAC addresses in the new\r
400 MCastFilter list. This value must be less than or equal to\r
401 the MCastFilterCnt field of EMU_SNP_MODE. This\r
402 field is optional if ResetMCastFilter is TRUE.\r
403 @param MCastFilter A pointer to a list of new multicast receive filter HW MAC\r
404 addresses. This list will replace any existing multicast\r
405 HW MAC address list. This field is optional if\r
406 ResetMCastFilter is TRUE.\r
407\r
408 @retval EFI_SUCCESS The multicast receive filter list was updated.\r
409 @retval EFI_NOT_STARTED The network interface has not been started.\r
410 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
411 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
412 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
413\r
414**/\r
415EFI_STATUS\r
416WinNtSnpReceiveFilters (\r
417 IN EMU_SNP_PROTOCOL *This,\r
418 IN UINT32 Enable,\r
419 IN UINT32 Disable,\r
420 IN BOOLEAN ResetMCastFilter,\r
421 IN UINTN MCastFilterCnt OPTIONAL,\r
422 IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL\r
423 )\r
424{\r
425 WIN_NT_SNP_PRIVATE *Private;\r
426 INT32 ReturnValue;\r
427\r
428 Private = WIN_NT_SNP_PRIVATE_DATA_FROM_THIS (This);\r
429\r
430 ReturnValue = Private->NtNetUtilityTable.SetReceiveFilter (\r
431 Private->Instance.InterfaceInfo.InterfaceIndex,\r
432 Enable,\r
433 (UINT32)MCastFilterCnt,\r
434 MCastFilter\r
435 );\r
436\r
437 if (ReturnValue <= 0) {\r
438 return EFI_DEVICE_ERROR;\r
439 }\r
440\r
441 return EFI_SUCCESS;\r
442}\r
443\r
444/**\r
445 Modifies or resets the current station address, if supported.\r
446\r
447 @param This The protocol instance pointer.\r
448 @param Reset Flag used to reset the station address to the network interfaces\r
449 permanent address.\r
450 @param New The new station address to be used for the network interface.\r
451\r
452 @retval EFI_SUCCESS The network interfaces station address was updated.\r
453 @retval EFI_NOT_STARTED The network interface has not been started.\r
454 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
455 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
456 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
457\r
458**/\r
459EFI_STATUS\r
460WinNtSnpStationAddress (\r
461 IN EMU_SNP_PROTOCOL *This,\r
462 IN BOOLEAN Reset,\r
463 IN EFI_MAC_ADDRESS *New OPTIONAL\r
464 )\r
465{\r
466 WIN_NT_SNP_PRIVATE *Private;\r
467\r
468 Private = WIN_NT_SNP_PRIVATE_DATA_FROM_THIS (This);\r
469\r
470 return EFI_UNSUPPORTED;\r
471}\r
472\r
473/**\r
474 Resets or collects the statistics on a network interface.\r
475\r
476 @param This Protocol instance pointer.\r
477 @param Reset Set to TRUE to reset the statistics for the network interface.\r
478 @param StatisticsSize On input the size, in bytes, of StatisticsTable. On\r
479 output the size, in bytes, of the resulting table of\r
480 statistics.\r
481 @param StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that\r
482 contains the statistics.\r
483\r
484 @retval EFI_SUCCESS The statistics were collected from the network interface.\r
485 @retval EFI_NOT_STARTED The network interface has not been started.\r
486 @retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer\r
487 size needed to hold the statistics is returned in\r
488 StatisticsSize.\r
489 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
490 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
491 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
492\r
493**/\r
494EFI_STATUS\r
495WinNtSnpStatistics (\r
496 IN EMU_SNP_PROTOCOL *This,\r
497 IN BOOLEAN Reset,\r
498 IN OUT UINTN *StatisticsSize OPTIONAL,\r
499 OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL\r
500 )\r
501{\r
502 WIN_NT_SNP_PRIVATE *Private;\r
503\r
504 Private = WIN_NT_SNP_PRIVATE_DATA_FROM_THIS (This);\r
505\r
506 return EFI_UNSUPPORTED;\r
507}\r
508\r
509/**\r
510 Converts a multicast IP address to a multicast HW MAC address.\r
511\r
512 @param This The protocol instance pointer.\r
513 @param IPv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460]. Set\r
514 to FALSE if the multicast IP address is IPv4 [RFC 791].\r
515 @param IP The multicast IP address that is to be converted to a multicast\r
516 HW MAC address.\r
517 @param MAC The multicast HW MAC address that is to be generated from IP.\r
518\r
519 @retval EFI_SUCCESS The multicast IP address was mapped to the multicast\r
520 HW MAC address.\r
521 @retval EFI_NOT_STARTED The network interface has not been started.\r
522 @retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer\r
523 size needed to hold the statistics is returned in\r
524 StatisticsSize.\r
525 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
526 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
527 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
528\r
529**/\r
530EFI_STATUS\r
531WinNtSnpMCastIpToMac (\r
532 IN EMU_SNP_PROTOCOL *This,\r
533 IN BOOLEAN IPv6,\r
534 IN EFI_IP_ADDRESS *IP,\r
535 OUT EFI_MAC_ADDRESS *MAC\r
536 )\r
537{\r
538 WIN_NT_SNP_PRIVATE *Private;\r
539\r
540 Private = WIN_NT_SNP_PRIVATE_DATA_FROM_THIS (This);\r
541\r
542 return EFI_UNSUPPORTED;\r
543}\r
544\r
545/**\r
546 Performs read and write operations on the NVRAM device attached to a\r
547 network interface.\r
548\r
549 @param This The protocol instance pointer.\r
550 @param ReadWrite TRUE for read operations, FALSE for write operations.\r
551 @param Offset Byte offset in the NVRAM device at which to start the read or\r
552 write operation. This must be a multiple of NvRamAccessSize and\r
553 less than NvRamSize.\r
554 @param BufferSize The number of bytes to read or write from the NVRAM device.\r
555 This must also be a multiple of NvramAccessSize.\r
556 @param Buffer A pointer to the data buffer.\r
557\r
558 @retval EFI_SUCCESS The NVRAM access was performed.\r
559 @retval EFI_NOT_STARTED The network interface has not been started.\r
560 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
561 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
562 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
563\r
564**/\r
565EFI_STATUS\r
566WinNtSnpNvData (\r
567 IN EMU_SNP_PROTOCOL *This,\r
568 IN BOOLEAN ReadWrite,\r
569 IN UINTN Offset,\r
570 IN UINTN BufferSize,\r
571 IN OUT VOID *Buffer\r
572 )\r
573{\r
574 WIN_NT_SNP_PRIVATE *Private;\r
575\r
576 Private = WIN_NT_SNP_PRIVATE_DATA_FROM_THIS (This);\r
577\r
578 return EFI_UNSUPPORTED;\r
579}\r
580\r
581/**\r
582 Reads the current interrupt status and recycled transmit buffer status from\r
583 a network interface.\r
584\r
585 @param This The protocol instance pointer.\r
586 @param InterruptStatus A pointer to the bit mask of the currently active interrupts\r
587 If this is NULL, the interrupt status will not be read from\r
588 the device. If this is not NULL, the interrupt status will\r
589 be read from the device. When the interrupt status is read,\r
590 it will also be cleared. Clearing the transmit interrupt\r
591 does not empty the recycled transmit buffer array.\r
592 @param TxBuf Recycled transmit buffer address. The network interface will\r
593 not transmit if its internal recycled transmit buffer array\r
594 is full. Reading the transmit buffer does not clear the\r
595 transmit interrupt. If this is NULL, then the transmit buffer\r
596 status will not be read. If there are no transmit buffers to\r
597 recycle and TxBuf is not NULL, * TxBuf will be set to NULL.\r
598\r
599 @retval EFI_SUCCESS The status of the network interface was retrieved.\r
600 @retval EFI_NOT_STARTED The network interface has not been started.\r
601 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
602 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
603 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
604\r
605**/\r
606EFI_STATUS\r
607WinNtSnpGetStatus (\r
608 IN EMU_SNP_PROTOCOL *This,\r
609 OUT UINT32 *InterruptStatus OPTIONAL,\r
610 OUT VOID **TxBuf OPTIONAL\r
611 )\r
612{\r
613 WIN_NT_SNP_PRIVATE *Private;\r
614\r
615 Private = WIN_NT_SNP_PRIVATE_DATA_FROM_THIS (This);\r
616\r
617 if (TxBuf != NULL) {\r
618 if (Private->Instance.RecycledTxBufCount != 0) {\r
619 Private->Instance.RecycledTxBufCount --;\r
620 *((UINT8 **) TxBuf) = (UINT8 *) (UINTN)Private->Instance.RecycledTxBuf[Private->Instance.RecycledTxBufCount];\r
621 } else {\r
622 *((UINT8 **) TxBuf) = NULL;\r
623 }\r
624 }\r
625\r
626 if (InterruptStatus != NULL) {\r
627 *InterruptStatus = EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT;\r
628 }\r
629\r
630 return EFI_SUCCESS;\r
631}\r
632\r
633/**\r
634 Places a packet in the transmit queue of a network interface.\r
635\r
636 @param This The protocol instance pointer.\r
637 @param HeaderSize The size, in bytes, of the media header to be filled in by\r
638 the Transmit() function. If HeaderSize is non-zero, then it\r
639 must be equal to This->Mode->MediaHeaderSize and the DestAddr\r
640 and Protocol parameters must not be NULL.\r
641 @param BufferSize The size, in bytes, of the entire packet (media header and\r
642 data) to be transmitted through the network interface.\r
643 @param Buffer A pointer to the packet (media header followed by data) to be\r
644 transmitted. This parameter cannot be NULL. If HeaderSize is zero,\r
645 then the media header in Buffer must already be filled in by the\r
646 caller. If HeaderSize is non-zero, then the media header will be\r
647 filled in by the Transmit() function.\r
648 @param SrcAddr The source HW MAC address. If HeaderSize is zero, then this parameter\r
649 is ignored. If HeaderSize is non-zero and SrcAddr is NULL, then\r
650 This->Mode->CurrentAddress is used for the source HW MAC address.\r
651 @param DestAddr The destination HW MAC address. If HeaderSize is zero, then this\r
652 parameter is ignored.\r
653 @param Protocol The type of header to build. If HeaderSize is zero, then this\r
654 parameter is ignored. See RFC 1700, section "Ether Types", for\r
655 examples.\r
656\r
657 @retval EFI_SUCCESS The packet was placed on the transmit queue.\r
658 @retval EFI_NOT_STARTED The network interface has not been started.\r
659 @retval EFI_NOT_READY The network interface is too busy to accept this transmit request.\r
660 @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.\r
661 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
662 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
663 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
664\r
665**/\r
666EFI_STATUS\r
667WinNtSnpTransmit (\r
668 IN EMU_SNP_PROTOCOL *This,\r
669 IN UINTN HeaderSize,\r
670 IN UINTN BufferSize,\r
671 IN VOID *Buffer,\r
672 IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL,\r
673 IN EFI_MAC_ADDRESS *DestAddr OPTIONAL,\r
674 IN UINT16 *Protocol OPTIONAL\r
675 )\r
676{\r
677 WIN_NT_SNP_PRIVATE *Private;\r
678 INT32 ReturnValue;\r
679 UINT64 *Tmp;\r
680\r
681 Private = WIN_NT_SNP_PRIVATE_DATA_FROM_THIS (This);\r
682\r
683 if ((HeaderSize != 0) && (SrcAddr == NULL)) {\r
684 SrcAddr = &Private->Instance.Mode.CurrentAddress;\r
685 }\r
686\r
687 ReturnValue = Private->NtNetUtilityTable.Transmit (\r
688 Private->Instance.InterfaceInfo.InterfaceIndex,\r
689 (UINT32)HeaderSize,\r
690 (UINT32)BufferSize,\r
691 Buffer,\r
692 SrcAddr,\r
693 DestAddr,\r
694 Protocol\r
695 );\r
696\r
697 if (ReturnValue < 0) {\r
698 return EFI_DEVICE_ERROR;\r
699 } else {\r
700 if ((Private->Instance.MaxRecycledTxBuf + SNP_TX_BUFFER_INCREASEMENT) >= SNP_MAX_TX_BUFFER_NUM) {\r
701 return EFI_NOT_READY;\r
702 }\r
703\r
704 if (Private->Instance.RecycledTxBufCount < Private->Instance.MaxRecycledTxBuf) {\r
705 Private->Instance.RecycledTxBuf[Private->Instance.RecycledTxBufCount] = (UINT64) Buffer;\r
706 Private->Instance.RecycledTxBufCount ++;\r
707 } else {\r
708 Tmp = malloc (sizeof (UINT64) * (Private->Instance.MaxRecycledTxBuf + SNP_TX_BUFFER_INCREASEMENT));\r
709 if (Tmp == NULL) {\r
710 return EFI_DEVICE_ERROR;\r
711 }\r
712 CopyMem (Tmp, Private->Instance.RecycledTxBuf, sizeof (UINT64) * Private->Instance.RecycledTxBufCount);\r
713 free (Private->Instance.RecycledTxBuf);\r
714 Private->Instance.RecycledTxBuf = Tmp;\r
715 Private->Instance.MaxRecycledTxBuf += SNP_TX_BUFFER_INCREASEMENT;\r
716 }\r
717 }\r
718\r
719 return EFI_SUCCESS;\r
720}\r
721\r
722/**\r
723 Receives a packet from a network interface.\r
724\r
725 @param This The protocol instance pointer.\r
726 @param HeaderSize The size, in bytes, of the media header received on the network\r
727 interface. If this parameter is NULL, then the media header size\r
728 will not be returned.\r
729 @param BufferSize On entry, the size, in bytes, of Buffer. On exit, the size, in\r
730 bytes, of the packet that was received on the network interface.\r
731 @param Buffer A pointer to the data buffer to receive both the media header and\r
732 the data.\r
733 @param SrcAddr The source HW MAC address. If this parameter is NULL, the\r
734 HW MAC source address will not be extracted from the media\r
735 header.\r
736 @param DestAddr The destination HW MAC address. If this parameter is NULL,\r
737 the HW MAC destination address will not be extracted from the\r
738 media header.\r
739 @param Protocol The media header type. If this parameter is NULL, then the\r
740 protocol will not be extracted from the media header. See\r
741 RFC 1700 section "Ether Types" for examples.\r
742\r
743 @retval EFI_SUCCESS The received data was stored in Buffer, and BufferSize has\r
744 been updated to the number of bytes received.\r
745 @retval EFI_NOT_STARTED The network interface has not been started.\r
746 @retval EFI_NOT_READY The network interface is too busy to accept this transmit\r
747 request.\r
748 @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.\r
749 @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.\r
750 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.\r
751 @retval EFI_UNSUPPORTED This function is not supported by the network interface.\r
752\r
753**/\r
754EFI_STATUS\r
755WinNtSnpReceive (\r
756 IN EMU_SNP_PROTOCOL *This,\r
757 OUT UINTN *HeaderSize OPTIONAL,\r
758 IN OUT UINTN *BufferSize,\r
759 OUT VOID *Buffer,\r
760 OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL,\r
761 OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL,\r
762 OUT UINT16 *Protocol OPTIONAL\r
763 )\r
764{\r
765 WIN_NT_SNP_PRIVATE *Private;\r
766 INT32 ReturnValue;\r
767 UINTN BufSize;\r
768\r
769 Private = WIN_NT_SNP_PRIVATE_DATA_FROM_THIS (This);\r
770\r
771 BufSize = *BufferSize;\r
772\r
773 ASSERT (Private->NtNetUtilityTable.Receive != NULL);\r
774\r
775 ReturnValue = Private->NtNetUtilityTable.Receive (\r
776 Private->Instance.InterfaceInfo.InterfaceIndex,\r
777 BufferSize,\r
778 Buffer\r
779 );\r
780\r
781 if (ReturnValue < 0) {\r
782 if (ReturnValue == -100) {\r
783 return EFI_BUFFER_TOO_SMALL;\r
784 }\r
785\r
786 return EFI_DEVICE_ERROR;\r
787 } else if (ReturnValue == 0) {\r
788 return EFI_NOT_READY;\r
789 }\r
790\r
791 if (HeaderSize != NULL) {\r
792 *HeaderSize = 14;\r
793 }\r
794\r
795 if (SrcAddr != NULL) {\r
796 ZeroMem (SrcAddr, sizeof (EFI_MAC_ADDRESS));\r
797 CopyMem (SrcAddr, ((UINT8 *) Buffer) + 6, 6);\r
798 }\r
799\r
800 if (DestAddr != NULL) {\r
801 ZeroMem (DestAddr, sizeof (EFI_MAC_ADDRESS));\r
802 CopyMem (DestAddr, ((UINT8 *) Buffer), 6);\r
803 }\r
804\r
805 if (Protocol != NULL) {\r
806 *Protocol = NTOHS (*((UINT16 *) (((UINT8 *) Buffer) + 12)));\r
807 }\r
808\r
809 return (*BufferSize <= BufSize) ? EFI_SUCCESS : EFI_BUFFER_TOO_SMALL;\r
810}\r
811\r
812/**\r
813 Initialize the snpnt32 driver instance.\r
814\r
815 @param Instance Pointer to the instance context data.\r
816 @param NetInfo Pointer to the interface info.\r
817\r
818 @retval EFI_SUCCESS The driver instance is initialized.\r
819 @retval other Initialization errors.\r
820\r
821**/\r
822EFI_STATUS\r
823WinNtInitializeInstanceData (\r
824 IN OUT WIN_NT_INSTANCE_DATA *Instance,\r
825 IN NT_NET_INTERFACE_INFO *NetInfo\r
826 )\r
827{\r
828 if (Instance == NULL || NetInfo == NULL) {\r
829 return EFI_INVALID_PARAMETER;\r
830 }\r
831\r
832 ZeroMem (Instance, sizeof (WIN_NT_INSTANCE_DATA));\r
833\r
834 Instance->Signature = WIN_NT_INSTANCE_SIGNATURE;\r
835 Instance->RecycledTxBufCount = 0;\r
836 Instance->MaxRecycledTxBuf = 32;\r
837 Instance->Mode.State = EfiSimpleNetworkInitialized;\r
838 Instance->Mode.HwAddressSize = NET_ETHER_ADDR_LEN;\r
839 Instance->Mode.MediaHeaderSize = NET_ETHER_HEADER_SIZE;\r
840 Instance->Mode.MaxPacketSize = 1500;\r
841 Instance->Mode.MaxMCastFilterCount = MAX_MCAST_FILTER_CNT;\r
842 Instance->Mode.IfType = NET_IFTYPE_ETHERNET;\r
843 Instance->Mode.MediaPresentSupported = TRUE;\r
844 Instance->Mode.MediaPresent = TRUE;\r
845\r
846 //\r
847 // Allocate the RecycledTxBuf.\r
848 //\r
849 Instance->RecycledTxBuf = malloc (sizeof (UINT64) * Instance->MaxRecycledTxBuf);\r
850 if (Instance->RecycledTxBuf == NULL) {\r
851 return EFI_OUT_OF_RESOURCES;\r
852 }\r
853\r
854 //\r
855 // Set the interface information.\r
856 //\r
857 CopyMem (&Instance->InterfaceInfo, NetInfo, sizeof (Instance->InterfaceInfo));\r
858\r
859\r
860 //\r
861 // Set broadcast address\r
862 //\r
863 SetMem (&Instance->Mode.BroadcastAddress, sizeof (EFI_MAC_ADDRESS), 0xFF);\r
864\r
865 //\r
866 // Copy Current/PermanentAddress MAC address\r
867 //\r
868 CopyMem (&Instance->Mode.CurrentAddress, &Instance->InterfaceInfo.MacAddr, sizeof(Instance->Mode.CurrentAddress));\r
869 CopyMem (&Instance->Mode.PermanentAddress, &Instance->InterfaceInfo.MacAddr, sizeof(Instance->Mode.PermanentAddress));\r
870\r
871 //\r
872 // Since the fake SNP is based on a real NIC, to avoid conflict with the host\r
873 // NIC network stack, we use a different MAC address.\r
874 // So just change the last byte of the MAC address for the real NIC.\r
875 //\r
876 Instance->Mode.CurrentAddress.Addr[NET_ETHER_ADDR_LEN - 1]++;\r
877\r
878 return EFI_SUCCESS;\r
879}\r
880\r
881/**\r
882 Initialize the net utility data.\r
883\r
884 @param This Pointer to the private data.\r
885 @param ActiveInstance The active network interface.\r
886\r
887 @retval EFI_SUCCESS The global data is initialized.\r
888 @retval EFI_NOT_FOUND The required DLL is not found.\r
889 @retval EFI_DEVICE_ERROR Error initialize network utility library.\r
890 @retval other Other errors.\r
891\r
892**/\r
893EFI_STATUS\r
894WintNtInitializeNetUtilityData (\r
895 IN OUT WIN_NT_SNP_PRIVATE *Private,\r
896 IN UINT8 ActiveInstance\r
897 )\r
898{\r
899 EFI_STATUS Status;\r
900 CHAR16 *DllFileNameU;\r
901 INT32 ReturnValue;\r
902 BOOLEAN NetUtilityLibInitDone;\r
903 NT_NET_INTERFACE_INFO NetInterfaceInfoBuffer[MAX_INTERFACE_INFO_NUMBER];\r
904 UINT32 InterfaceCount;\r
905 UINT8 ActiveInterfaceIndex;\r
906\r
907 if (Private == NULL) {\r
908 return EFI_INVALID_PARAMETER;\r
909 }\r
910\r
911 NetUtilityLibInitDone = FALSE;\r
912 InterfaceCount = MAX_INTERFACE_INFO_NUMBER;\r
913 DllFileNameU = NETWORK_LIBRARY_NAME_U;\r
914\r
915 //\r
916 // Load network utility library\r
917 //\r
918 Private->NetworkLibraryHandle = LoadLibraryEx (DllFileNameU, NULL, 0);\r
919 if (NULL == Private->NetworkLibraryHandle) {\r
920 return EFI_NOT_FOUND;\r
921 }\r
922\r
923 Private->NtNetUtilityTable.Initialize = (NT_NET_INITIALIZE) GetProcAddress (Private->NetworkLibraryHandle, NETWORK_LIBRARY_INITIALIZE);\r
924 if (NULL == Private->NtNetUtilityTable.Initialize) {\r
925 Status = EFI_NOT_FOUND;\r
926 goto ErrorReturn;\r
927 }\r
928\r
929 Private->NtNetUtilityTable.Finalize = (NT_NET_FINALIZE) GetProcAddress (Private->NetworkLibraryHandle, NETWORK_LIBRARY_FINALIZE);\r
930 if (NULL == Private->NtNetUtilityTable.Finalize) {\r
931 Status = EFI_NOT_FOUND;\r
932 goto ErrorReturn;\r
933 }\r
934\r
935 Private->NtNetUtilityTable.SetReceiveFilter = (NT_NET_SET_RECEIVE_FILTER) GetProcAddress (Private->NetworkLibraryHandle, NETWORK_LIBRARY_SET_RCV_FILTER);\r
936 if (NULL == Private->NtNetUtilityTable.SetReceiveFilter) {\r
937 Status = EFI_NOT_FOUND;\r
938 goto ErrorReturn;\r
939 }\r
940\r
941 Private->NtNetUtilityTable.Receive = (NT_NET_RECEIVE) GetProcAddress (Private->NetworkLibraryHandle, NETWORK_LIBRARY_RECEIVE);\r
942 if (NULL == Private->NtNetUtilityTable.Receive) {\r
943 Status = EFI_NOT_FOUND;\r
944 goto ErrorReturn;\r
945 }\r
946\r
947 Private->NtNetUtilityTable.Transmit = (NT_NET_TRANSMIT) GetProcAddress (Private->NetworkLibraryHandle, NETWORK_LIBRARY_TRANSMIT);\r
948 if (NULL == Private->NtNetUtilityTable.Transmit) {\r
949 Status = EFI_NOT_FOUND;\r
950 goto ErrorReturn;\r
951 }\r
952\r
953 //\r
954 // Initialize the network utility library\r
955 // And enumerate the interfaces in emulator host\r
956 //\r
957 ReturnValue = Private->NtNetUtilityTable.Initialize (&InterfaceCount, &NetInterfaceInfoBuffer[0]);\r
958 if (ReturnValue <= 0) {\r
959 Status = EFI_DEVICE_ERROR;\r
960 goto ErrorReturn;\r
961 }\r
962\r
963 NetUtilityLibInitDone = TRUE;\r
964\r
965 if (InterfaceCount == 0) {\r
966 Status = EFI_NOT_FOUND;\r
967 goto ErrorReturn;\r
968 }\r
969\r
970 DEBUG ((DEBUG_INFO, "%a, total %d interface(s) found\n", __FUNCTION__, InterfaceCount));\r
971 //\r
972 // Active interface index is set to first interface if given instance does\r
973 // not exist.\r
974 //\r
975 ActiveInterfaceIndex = (ActiveInstance >= InterfaceCount ? DEFAULT_SELECTED_NIC_INDEX : ActiveInstance);\r
976\r
977 //\r
978 // Initialize instance\r
979 //\r
980 Status = WinNtInitializeInstanceData (&Private->Instance, &NetInterfaceInfoBuffer[ActiveInterfaceIndex]);\r
981 if (EFI_ERROR (Status)) {\r
982 goto ErrorReturn;\r
983 }\r
984\r
985 return EFI_SUCCESS;\r
986\r
987ErrorReturn:\r
988\r
989 if (Private->Instance.RecycledTxBuf != NULL) {\r
990 free (Private->Instance.RecycledTxBuf);\r
991 }\r
992\r
993 if (NetUtilityLibInitDone) {\r
994 if (Private->NtNetUtilityTable.Finalize != NULL) {\r
995 Private->NtNetUtilityTable.Finalize ();\r
996 Private->NtNetUtilityTable.Finalize = NULL;\r
997 }\r
998 }\r
999\r
1000 return Status;\r
1001}\r
1002\r
1003/**\r
1004 Release the net utility data.\r
1005\r
1006 @param This Pointer to the private data.\r
1007\r
1008 @retval EFI_SUCCESS The global data is released.\r
1009 @retval other Other errors.\r
1010\r
1011**/\r
1012EFI_STATUS\r
1013WintNtReleaseNetUtilityData (\r
1014 IN OUT WIN_NT_SNP_PRIVATE *Private\r
1015 )\r
1016{\r
1017 if (Private == NULL) {\r
1018 return EFI_INVALID_PARAMETER;\r
1019 }\r
1020\r
1021 if (Private->Instance.RecycledTxBuf != NULL) {\r
1022 free (Private->Instance.RecycledTxBuf);\r
1023 }\r
1024\r
1025 if (Private->NtNetUtilityTable.Finalize != NULL) {\r
1026 Private->NtNetUtilityTable.Finalize ();\r
1027 }\r
1028\r
1029 FreeLibrary (Private->NetworkLibraryHandle);\r
1030\r
1031 return EFI_SUCCESS;\r
1032}\r
1033\r
1034EMU_SNP_PROTOCOL mWinNtSnpProtocol = {\r
1035 WinNtSnpCreateMapping,\r
1036 WinNtSnpStart,\r
1037 WinNtSnpStop,\r
1038 WinNtSnpInitialize,\r
1039 WinNtSnpReset,\r
1040 WinNtSnpShutdown,\r
1041 WinNtSnpReceiveFilters,\r
1042 WinNtSnpStationAddress,\r
1043 WinNtSnpStatistics,\r
1044 WinNtSnpMCastIpToMac,\r
1045 WinNtSnpNvData,\r
1046 WinNtSnpGetStatus,\r
1047 WinNtSnpTransmit,\r
1048 WinNtSnpReceive\r
1049};\r
1050\r
1051/**\r
1052 Open SNP thunk protocol.\r
1053\r
1054 @param This Pointer to the thunk protocol instance.\r
1055\r
1056 @retval EFI_SUCCESS SNP thunk protocol is opened successfully.\r
1057 @retval EFI_UNSUPPORTED This is not SNP thunk protocol.\r
1058 @retval EFI_OUT_OF_RESOURCES Not enough memory.\r
1059 @retval other Other errors.\r
1060\r
1061**/\r
1062EFI_STATUS\r
1063WinNtSnpThunkOpen (\r
1064 IN EMU_IO_THUNK_PROTOCOL *This\r
1065 )\r
1066{\r
1067 WIN_NT_SNP_PRIVATE *Private;\r
1068 UINT8 HostInterfaceIndex;\r
1069\r
1070 HostInterfaceIndex = 0;\r
1071\r
1072 if (This->Private != NULL) {\r
1073 return EFI_ALREADY_STARTED;\r
1074 }\r
1075\r
1076 if (!CompareGuid (This->Protocol, &gEmuSnpProtocolGuid)) {\r
1077 return EFI_UNSUPPORTED;\r
1078 }\r
1079\r
1080 Private = malloc (sizeof (WIN_NT_SNP_PRIVATE));\r
1081 if (Private == NULL) {\r
1082 return EFI_OUT_OF_RESOURCES;\r
1083 }\r
1084\r
1085 Private->Signature = WIN_NT_SIMPLE_NETWORK_PRIVATE_SIGNATURE;\r
1086 Private->Thunk = This;\r
1087 CopyMem (&Private->EmuSnp, &mWinNtSnpProtocol, sizeof (mWinNtSnpProtocol));\r
1088\r
1089 This->Interface = &Private->EmuSnp;\r
1090 This->Private = Private;\r
1091\r
1092 if (This->ConfigString != NULL && This->ConfigString[0] != '\0') {\r
1093 HostInterfaceIndex = (UINT8)StrDecimalToUintn (This->ConfigString);\r
1094 }\r
1095\r
1096 return WintNtInitializeNetUtilityData (Private, HostInterfaceIndex);\r
1097}\r
1098\r
1099/**\r
1100 Close SNP thunk protocol.\r
1101\r
1102 @param This Pointer to the thunk protocol instance.\r
1103\r
1104 @retval EFI_SUCCESS SNP thunk protocol is closed successfully.\r
1105 @retval EFI_UNSUPPORTED This is not SNP thunk protocol.\r
1106 @retval other Other errors.\r
1107\r
1108**/\r
1109EFI_STATUS\r
1110WinNtSnpThunkClose (\r
1111 IN EMU_IO_THUNK_PROTOCOL *This\r
1112 )\r
1113{\r
1114 WIN_NT_SNP_PRIVATE *Private;\r
1115\r
1116 if (!CompareGuid (This->Protocol, &gEmuSnpProtocolGuid)) {\r
1117 return EFI_UNSUPPORTED;\r
1118 }\r
1119\r
1120 Private = This->Private;\r
1121 WintNtReleaseNetUtilityData (Private);\r
1122 free (Private);\r
1123\r
1124 return EFI_SUCCESS;\r
1125}\r
1126\r
1127EMU_IO_THUNK_PROTOCOL mWinNtSnpThunkIo = {\r
1128 &gEmuSnpProtocolGuid,\r
1129 NULL,\r
1130 NULL,\r
1131 0,\r
1132 WinNtSnpThunkOpen,\r
1133 WinNtSnpThunkClose,\r
1134 NULL\r
1135};\r