LinuxPacketFilter.c 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. /**@file
  2. Linux Packet Filter implementation of the EMU_SNP_PROTOCOL that allows the
  3. emulator to get on real networks.
  4. Currently only the Berkeley Packet Filter is fully implemented and this file
  5. is just a template that needs to get filled in.
  6. Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
  7. Portions copyright (c) 2011, Apple Inc. All rights reserved.
  8. SPDX-License-Identifier: BSD-2-Clause-Patent
  9. **/
  10. #include "Host.h"
  11. #ifndef __APPLE__
  12. #define EMU_SNP_PRIVATE_SIGNATURE SIGNATURE_32('E', 'M', 's', 'n')
  13. typedef struct {
  14. UINTN Signature;
  15. EMU_IO_THUNK_PROTOCOL *Thunk;
  16. EMU_SNP_PROTOCOL EmuSnp;
  17. EFI_SIMPLE_NETWORK_MODE *Mode;
  18. } EMU_SNP_PRIVATE;
  19. #define EMU_SNP_PRIVATE_DATA_FROM_THIS(a) \
  20. CR(a, EMU_SNP_PRIVATE, EmuSnp, EMU_SNP_PRIVATE_SIGNATURE)
  21. /**
  22. Register storage for SNP Mode.
  23. @param This Protocol instance pointer.
  24. @param Mode SimpleNetworkProtocol Mode structure passed into driver.
  25. @retval EFI_SUCCESS The network interface was started.
  26. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  27. **/
  28. EFI_STATUS
  29. EmuSnpCreateMapping (
  30. IN EMU_SNP_PROTOCOL *This,
  31. IN EFI_SIMPLE_NETWORK_MODE *Mode
  32. )
  33. {
  34. EMU_SNP_PRIVATE *Private;
  35. Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
  36. Private->Mode = Mode;
  37. return EFI_SUCCESS;
  38. }
  39. /**
  40. Changes the state of a network interface from "stopped" to "started".
  41. @param This Protocol instance pointer.
  42. @retval EFI_SUCCESS The network interface was started.
  43. @retval EFI_ALREADY_STARTED The network interface is already in the started state.
  44. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  45. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  46. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  47. **/
  48. EFI_STATUS
  49. EmuSnpStart (
  50. IN EMU_SNP_PROTOCOL *This
  51. )
  52. {
  53. EMU_SNP_PRIVATE *Private;
  54. Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
  55. return EFI_UNSUPPORTED;
  56. }
  57. /**
  58. Changes the state of a network interface from "started" to "stopped".
  59. @param This Protocol instance pointer.
  60. @retval EFI_SUCCESS The network interface was stopped.
  61. @retval EFI_ALREADY_STARTED The network interface is already in the stopped state.
  62. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  63. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  64. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  65. **/
  66. EFI_STATUS
  67. EmuSnpStop (
  68. IN EMU_SNP_PROTOCOL *This
  69. )
  70. {
  71. EMU_SNP_PRIVATE *Private;
  72. Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
  73. return EFI_UNSUPPORTED;
  74. }
  75. /**
  76. Resets a network adapter and allocates the transmit and receive buffers
  77. required by the network interface; optionally, also requests allocation
  78. of additional transmit and receive buffers.
  79. @param This The protocol instance pointer.
  80. @param ExtraRxBufferSize The size, in bytes, of the extra receive buffer space
  81. that the driver should allocate for the network interface.
  82. Some network interfaces will not be able to use the extra
  83. buffer, and the caller will not know if it is actually
  84. being used.
  85. @param ExtraTxBufferSize The size, in bytes, of the extra transmit buffer space
  86. that the driver should allocate for the network interface.
  87. Some network interfaces will not be able to use the extra
  88. buffer, and the caller will not know if it is actually
  89. being used.
  90. @retval EFI_SUCCESS The network interface was initialized.
  91. @retval EFI_NOT_STARTED The network interface has not been started.
  92. @retval EFI_OUT_OF_RESOURCES There was not enough memory for the transmit and
  93. receive buffers.
  94. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  95. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  96. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  97. **/
  98. EFI_STATUS
  99. EmuSnpInitialize (
  100. IN EMU_SNP_PROTOCOL *This,
  101. IN UINTN ExtraRxBufferSize OPTIONAL,
  102. IN UINTN ExtraTxBufferSize OPTIONAL
  103. )
  104. {
  105. EMU_SNP_PRIVATE *Private;
  106. Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
  107. return EFI_UNSUPPORTED;
  108. }
  109. /**
  110. Resets a network adapter and re-initializes it with the parameters that were
  111. provided in the previous call to Initialize().
  112. @param This The protocol instance pointer.
  113. @param ExtendedVerification Indicates that the driver may perform a more
  114. exhaustive verification operation of the device
  115. during reset.
  116. @retval EFI_SUCCESS The network interface was reset.
  117. @retval EFI_NOT_STARTED The network interface has not been started.
  118. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  119. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  120. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  121. **/
  122. EFI_STATUS
  123. EmuSnpReset (
  124. IN EMU_SNP_PROTOCOL *This,
  125. IN BOOLEAN ExtendedVerification
  126. )
  127. {
  128. EMU_SNP_PRIVATE *Private;
  129. Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
  130. return EFI_UNSUPPORTED;
  131. }
  132. /**
  133. Resets a network adapter and leaves it in a state that is safe for
  134. another driver to initialize.
  135. @param This Protocol instance pointer.
  136. @retval EFI_SUCCESS The network interface was shutdown.
  137. @retval EFI_NOT_STARTED The network interface has not been started.
  138. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  139. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  140. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  141. **/
  142. EFI_STATUS
  143. EmuSnpShutdown (
  144. IN EMU_SNP_PROTOCOL *This
  145. )
  146. {
  147. EMU_SNP_PRIVATE *Private;
  148. Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
  149. return EFI_UNSUPPORTED;
  150. }
  151. /**
  152. Manages the multicast receive filters of a network interface.
  153. @param This The protocol instance pointer.
  154. @param Enable A bit mask of receive filters to enable on the network interface.
  155. @param Disable A bit mask of receive filters to disable on the network interface.
  156. @param ResetMCastFilter Set to TRUE to reset the contents of the multicast receive
  157. filters on the network interface to their default values.
  158. @param McastFilterCnt Number of multicast HW MAC addresses in the new
  159. MCastFilter list. This value must be less than or equal to
  160. the MCastFilterCnt field of EMU_SNP_MODE. This
  161. field is optional if ResetMCastFilter is TRUE.
  162. @param MCastFilter A pointer to a list of new multicast receive filter HW MAC
  163. addresses. This list will replace any existing multicast
  164. HW MAC address list. This field is optional if
  165. ResetMCastFilter is TRUE.
  166. @retval EFI_SUCCESS The multicast receive filter list was updated.
  167. @retval EFI_NOT_STARTED The network interface has not been started.
  168. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  169. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  170. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  171. **/
  172. EFI_STATUS
  173. EmuSnpReceiveFilters (
  174. IN EMU_SNP_PROTOCOL *This,
  175. IN UINT32 Enable,
  176. IN UINT32 Disable,
  177. IN BOOLEAN ResetMCastFilter,
  178. IN UINTN MCastFilterCnt OPTIONAL,
  179. IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL
  180. )
  181. {
  182. EMU_SNP_PRIVATE *Private;
  183. Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
  184. return EFI_UNSUPPORTED;
  185. }
  186. /**
  187. Modifies or resets the current station address, if supported.
  188. @param This The protocol instance pointer.
  189. @param Reset Flag used to reset the station address to the network interfaces
  190. permanent address.
  191. @param New The new station address to be used for the network interface.
  192. @retval EFI_SUCCESS The network interfaces station address was updated.
  193. @retval EFI_NOT_STARTED The network interface has not been started.
  194. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  195. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  196. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  197. **/
  198. EFI_STATUS
  199. EmuSnpStationAddress (
  200. IN EMU_SNP_PROTOCOL *This,
  201. IN BOOLEAN Reset,
  202. IN EFI_MAC_ADDRESS *New OPTIONAL
  203. )
  204. {
  205. EMU_SNP_PRIVATE *Private;
  206. Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
  207. return EFI_UNSUPPORTED;
  208. }
  209. /**
  210. Resets or collects the statistics on a network interface.
  211. @param This Protocol instance pointer.
  212. @param Reset Set to TRUE to reset the statistics for the network interface.
  213. @param StatisticsSize On input the size, in bytes, of StatisticsTable. On
  214. output the size, in bytes, of the resulting table of
  215. statistics.
  216. @param StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that
  217. contains the statistics.
  218. @retval EFI_SUCCESS The statistics were collected from the network interface.
  219. @retval EFI_NOT_STARTED The network interface has not been started.
  220. @retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer
  221. size needed to hold the statistics is returned in
  222. StatisticsSize.
  223. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  224. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  225. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  226. **/
  227. EFI_STATUS
  228. EmuSnpStatistics (
  229. IN EMU_SNP_PROTOCOL *This,
  230. IN BOOLEAN Reset,
  231. IN OUT UINTN *StatisticsSize OPTIONAL,
  232. OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL
  233. )
  234. {
  235. EMU_SNP_PRIVATE *Private;
  236. Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
  237. return EFI_UNSUPPORTED;
  238. }
  239. /**
  240. Converts a multicast IP address to a multicast HW MAC address.
  241. @param This The protocol instance pointer.
  242. @param IPv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460]. Set
  243. to FALSE if the multicast IP address is IPv4 [RFC 791].
  244. @param IP The multicast IP address that is to be converted to a multicast
  245. HW MAC address.
  246. @param MAC The multicast HW MAC address that is to be generated from IP.
  247. @retval EFI_SUCCESS The multicast IP address was mapped to the multicast
  248. HW MAC address.
  249. @retval EFI_NOT_STARTED The network interface has not been started.
  250. @retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer
  251. size needed to hold the statistics is returned in
  252. StatisticsSize.
  253. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  254. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  255. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  256. **/
  257. EFI_STATUS
  258. EmuSnpMCastIpToMac (
  259. IN EMU_SNP_PROTOCOL *This,
  260. IN BOOLEAN IPv6,
  261. IN EFI_IP_ADDRESS *IP,
  262. OUT EFI_MAC_ADDRESS *MAC
  263. )
  264. {
  265. EMU_SNP_PRIVATE *Private;
  266. Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
  267. return EFI_UNSUPPORTED;
  268. }
  269. /**
  270. Performs read and write operations on the NVRAM device attached to a
  271. network interface.
  272. @param This The protocol instance pointer.
  273. @param ReadWrite TRUE for read operations, FALSE for write operations.
  274. @param Offset Byte offset in the NVRAM device at which to start the read or
  275. write operation. This must be a multiple of NvRamAccessSize and
  276. less than NvRamSize.
  277. @param BufferSize The number of bytes to read or write from the NVRAM device.
  278. This must also be a multiple of NvramAccessSize.
  279. @param Buffer A pointer to the data buffer.
  280. @retval EFI_SUCCESS The NVRAM access was performed.
  281. @retval EFI_NOT_STARTED The network interface has not been started.
  282. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  283. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  284. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  285. **/
  286. EFI_STATUS
  287. EmuSnpNvData (
  288. IN EMU_SNP_PROTOCOL *This,
  289. IN BOOLEAN ReadWrite,
  290. IN UINTN Offset,
  291. IN UINTN BufferSize,
  292. IN OUT VOID *Buffer
  293. )
  294. {
  295. EMU_SNP_PRIVATE *Private;
  296. Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
  297. return EFI_UNSUPPORTED;
  298. }
  299. /**
  300. Reads the current interrupt status and recycled transmit buffer status from
  301. a network interface.
  302. @param This The protocol instance pointer.
  303. @param InterruptStatus A pointer to the bit mask of the currently active interrupts
  304. If this is NULL, the interrupt status will not be read from
  305. the device. If this is not NULL, the interrupt status will
  306. be read from the device. When the interrupt status is read,
  307. it will also be cleared. Clearing the transmit interrupt
  308. does not empty the recycled transmit buffer array.
  309. @param TxBuf Recycled transmit buffer address. The network interface will
  310. not transmit if its internal recycled transmit buffer array
  311. is full. Reading the transmit buffer does not clear the
  312. transmit interrupt. If this is NULL, then the transmit buffer
  313. status will not be read. If there are no transmit buffers to
  314. recycle and TxBuf is not NULL, * TxBuf will be set to NULL.
  315. @retval EFI_SUCCESS The status of the network interface was retrieved.
  316. @retval EFI_NOT_STARTED The network interface has not been started.
  317. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  318. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  319. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  320. **/
  321. EFI_STATUS
  322. EmuSnpGetStatus (
  323. IN EMU_SNP_PROTOCOL *This,
  324. OUT UINT32 *InterruptStatus OPTIONAL,
  325. OUT VOID **TxBuf OPTIONAL
  326. )
  327. {
  328. EMU_SNP_PRIVATE *Private;
  329. Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
  330. return EFI_UNSUPPORTED;
  331. }
  332. /**
  333. Places a packet in the transmit queue of a network interface.
  334. @param This The protocol instance pointer.
  335. @param HeaderSize The size, in bytes, of the media header to be filled in by
  336. the Transmit() function. If HeaderSize is non-zero, then it
  337. must be equal to This->Mode->MediaHeaderSize and the DestAddr
  338. and Protocol parameters must not be NULL.
  339. @param BufferSize The size, in bytes, of the entire packet (media header and
  340. data) to be transmitted through the network interface.
  341. @param Buffer A pointer to the packet (media header followed by data) to be
  342. transmitted. This parameter cannot be NULL. If HeaderSize is zero,
  343. then the media header in Buffer must already be filled in by the
  344. caller. If HeaderSize is non-zero, then the media header will be
  345. filled in by the Transmit() function.
  346. @param SrcAddr The source HW MAC address. If HeaderSize is zero, then this parameter
  347. is ignored. If HeaderSize is non-zero and SrcAddr is NULL, then
  348. This->Mode->CurrentAddress is used for the source HW MAC address.
  349. @param DestAddr The destination HW MAC address. If HeaderSize is zero, then this
  350. parameter is ignored.
  351. @param Protocol The type of header to build. If HeaderSize is zero, then this
  352. parameter is ignored. See RFC 1700, section "Ether Types", for
  353. examples.
  354. @retval EFI_SUCCESS The packet was placed on the transmit queue.
  355. @retval EFI_NOT_STARTED The network interface has not been started.
  356. @retval EFI_NOT_READY The network interface is too busy to accept this transmit request.
  357. @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.
  358. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  359. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  360. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  361. **/
  362. EFI_STATUS
  363. EmuSnpTransmit (
  364. IN EMU_SNP_PROTOCOL *This,
  365. IN UINTN HeaderSize,
  366. IN UINTN BufferSize,
  367. IN VOID *Buffer,
  368. IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
  369. IN EFI_MAC_ADDRESS *DestAddr OPTIONAL,
  370. IN UINT16 *Protocol OPTIONAL
  371. )
  372. {
  373. EMU_SNP_PRIVATE *Private;
  374. Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
  375. return EFI_UNSUPPORTED;
  376. }
  377. /**
  378. Receives a packet from a network interface.
  379. @param This The protocol instance pointer.
  380. @param HeaderSize The size, in bytes, of the media header received on the network
  381. interface. If this parameter is NULL, then the media header size
  382. will not be returned.
  383. @param BufferSize On entry, the size, in bytes, of Buffer. On exit, the size, in
  384. bytes, of the packet that was received on the network interface.
  385. @param Buffer A pointer to the data buffer to receive both the media header and
  386. the data.
  387. @param SrcAddr The source HW MAC address. If this parameter is NULL, the
  388. HW MAC source address will not be extracted from the media
  389. header.
  390. @param DestAddr The destination HW MAC address. If this parameter is NULL,
  391. the HW MAC destination address will not be extracted from the
  392. media header.
  393. @param Protocol The media header type. If this parameter is NULL, then the
  394. protocol will not be extracted from the media header. See
  395. RFC 1700 section "Ether Types" for examples.
  396. @retval EFI_SUCCESS The received data was stored in Buffer, and BufferSize has
  397. been updated to the number of bytes received.
  398. @retval EFI_NOT_STARTED The network interface has not been started.
  399. @retval EFI_NOT_READY The network interface is too busy to accept this transmit
  400. request.
  401. @retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.
  402. @retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
  403. @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
  404. @retval EFI_UNSUPPORTED This function is not supported by the network interface.
  405. **/
  406. EFI_STATUS
  407. EmuSnpReceive (
  408. IN EMU_SNP_PROTOCOL *This,
  409. OUT UINTN *HeaderSize OPTIONAL,
  410. IN OUT UINTN *BufferSize,
  411. OUT VOID *Buffer,
  412. OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
  413. OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL,
  414. OUT UINT16 *Protocol OPTIONAL
  415. )
  416. {
  417. EMU_SNP_PRIVATE *Private;
  418. Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
  419. return EFI_UNSUPPORTED;
  420. }
  421. EMU_SNP_PROTOCOL gEmuSnpProtocol = {
  422. GasketSnpCreateMapping,
  423. GasketSnpStart,
  424. GasketSnpStop,
  425. GasketSnpInitialize,
  426. GasketSnpReset,
  427. GasketSnpShutdown,
  428. GasketSnpReceiveFilters,
  429. GasketSnpStationAddress,
  430. GasketSnpStatistics,
  431. GasketSnpMCastIpToMac,
  432. GasketSnpNvData,
  433. GasketSnpGetStatus,
  434. GasketSnpTransmit,
  435. GasketSnpReceive
  436. };
  437. EFI_STATUS
  438. EmuSnpThunkOpen (
  439. IN EMU_IO_THUNK_PROTOCOL *This
  440. )
  441. {
  442. EMU_SNP_PRIVATE *Private;
  443. if (This->Private != NULL) {
  444. return EFI_ALREADY_STARTED;
  445. }
  446. if (!CompareGuid (This->Protocol, &gEmuSnpProtocolGuid)) {
  447. return EFI_UNSUPPORTED;
  448. }
  449. Private = malloc (sizeof (EMU_SNP_PRIVATE));
  450. if (Private == NULL) {
  451. return EFI_OUT_OF_RESOURCES;
  452. }
  453. Private->Signature = EMU_SNP_PRIVATE_SIGNATURE;
  454. Private->Thunk = This;
  455. CopyMem (&Private->EmuSnp, &gEmuSnpProtocol, sizeof (gEmuSnpProtocol));
  456. This->Interface = &Private->EmuSnp;
  457. This->Private = Private;
  458. return EFI_SUCCESS;
  459. }
  460. EFI_STATUS
  461. EmuSnpThunkClose (
  462. IN EMU_IO_THUNK_PROTOCOL *This
  463. )
  464. {
  465. EMU_SNP_PRIVATE *Private;
  466. if (!CompareGuid (This->Protocol, &gEmuSnpProtocolGuid)) {
  467. return EFI_UNSUPPORTED;
  468. }
  469. Private = This->Private;
  470. free (Private);
  471. return EFI_SUCCESS;
  472. }
  473. EMU_IO_THUNK_PROTOCOL gSnpThunkIo = {
  474. &gEmuSnpProtocolGuid,
  475. NULL,
  476. NULL,
  477. 0,
  478. GasketSnpThunkOpen,
  479. GasketSnpThunkClose,
  480. NULL
  481. };
  482. #endif