]>
git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/VirtioNetDxe/SnpSharedHelpers.c
3 Helper functions used by at least two Simple Network Protocol methods.
5 Copyright (C) 2013, Red Hat, Inc.
7 This program and the accompanying materials are licensed and made available
8 under the terms and conditions of the BSD License which accompanies this
9 distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
13 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include <Library/MemoryAllocationLib.h>
19 #include "VirtioNet.h"
22 Release RX and TX resources on the boundary of the
23 EfiSimpleNetworkInitialized state.
25 These functions contribute to rolling back a partial, failed initialization
26 of the virtio-net SNP driver instance, or to shutting down a fully
27 initialized, running instance.
29 They are only callable by the VirtioNetInitialize() and the
30 VirtioNetShutdown() SNP methods. See the state diagram in "VirtioNet.h".
32 @param[in,out] Dev The VNET_DEV driver instance being shut down, or whose
33 partial, failed initialization is being rolled back.
42 Dev
->VirtIo
->UnmapSharedBuffer (Dev
->VirtIo
, Dev
->RxBufMap
);
43 Dev
->VirtIo
->FreeSharedPages (
57 Dev
->VirtIo
->UnmapSharedBuffer (Dev
->VirtIo
, Dev
->TxSharedReqMap
);
58 Dev
->VirtIo
->FreeSharedPages (
60 EFI_SIZE_TO_PAGES (sizeof *(Dev
->TxSharedReq
)),
64 FreePool (Dev
->TxFreeStack
);
68 Release TX and RX VRING resources.
70 @param[in,out] Dev The VNET_DEV driver instance which was using
72 @param[in,out] Ring The virtio ring to clean up.
73 @param[in] RingMap A token return from the VirtioRingMap()
83 Dev
->VirtIo
->UnmapSharedBuffer (Dev
->VirtIo
, RingMap
);
84 VirtioRingUninit (Dev
->VirtIo
, Ring
);