TianoCore EDK2 master
Loading...
Searching...
No Matches
SnpSharedHelpers.c File Reference

Go to the source code of this file.

Data Structures

struct  TX_BUF_MAP_INFO
 

Functions

VOID EFIAPI VirtioNetShutdownRx (IN OUT VNET_DEV *Dev)
 
VOID EFIAPI VirtioNetShutdownTx (IN OUT VNET_DEV *Dev)
 
VOID EFIAPI VirtioNetUninitRing (IN OUT VNET_DEV *Dev, IN OUT VRING *Ring, IN VOID *RingMap)
 
EFI_STATUS EFIAPI VirtioNetMapTxBuf (IN VNET_DEV *Dev, IN VOID *Buffer, IN UINTN NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress)
 
EFI_STATUS EFIAPI VirtioNetUnmapTxBuf (IN VNET_DEV *Dev, OUT VOID **Buffer, IN EFI_PHYSICAL_ADDRESS DeviceAddress)
 
INTN EFIAPI VirtioNetTxBufMapInfoCompare (IN CONST VOID *UserStruct1, IN CONST VOID *UserStruct2)
 
INTN EFIAPI VirtioNetTxBufDeviceAddressCompare (IN CONST VOID *StandaloneKey, IN CONST VOID *UserStruct)
 

Detailed Description

Helper functions used by at least two Simple Network Protocol methods.

Copyright (C) 2013, Red Hat, Inc.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file SnpSharedHelpers.c.

Function Documentation

◆ VirtioNetMapTxBuf()

EFI_STATUS EFIAPI VirtioNetMapTxBuf ( IN VNET_DEV Dev,
IN VOID *  Buffer,
IN UINTN  NumberOfBytes,
OUT EFI_PHYSICAL_ADDRESS DeviceAddress 
)

Map Caller-supplied TxBuf buffer to the device-mapped address

Parameters
[in]DevThe VNET_DEV driver instance which wants to map the Tx packet.
[in]BufferThe system physical address of TxBuf
[in]NumberOfBytesNumber of bytes to map
[out]DeviceAddressThe resulting device address for the bus master access.
Return values
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.
Returns
Status codes from VirtioMapAllBytesInSharedBuffer()
Return values
EFI_SUCCESSCaller-supplied buffer is successfully mapped.

Definition at line 124 of file SnpSharedHelpers.c.

◆ VirtioNetShutdownRx()

VOID EFIAPI VirtioNetShutdownRx ( IN OUT VNET_DEV Dev)

Release RX and TX resources on the boundary of the EfiSimpleNetworkInitialized state.

These functions contribute to rolling back a partial, failed initialization of the virtio-net SNP driver instance, or to shutting down a fully initialized, running instance.

They are only callable by the VirtioNetInitialize() and the VirtioNetShutdown() SNP methods. See the state diagram in "VirtioNet.h".

Parameters
[in,out]DevThe VNET_DEV driver instance being shut down, or whose partial, failed initialization is being rolled back.

Definition at line 41 of file SnpSharedHelpers.c.

◆ VirtioNetShutdownTx()

VOID EFIAPI VirtioNetShutdownTx ( IN OUT VNET_DEV Dev)

Definition at line 55 of file SnpSharedHelpers.c.

◆ VirtioNetTxBufDeviceAddressCompare()

INTN EFIAPI VirtioNetTxBufDeviceAddressCompare ( IN CONST VOID *  StandaloneKey,
IN CONST VOID *  UserStruct 
)

Compare a standalone DeviceAddress against a TX_BUF_MAP_INFO object containing an embedded DeviceAddress.

Parameters
[in]StandaloneKeyPointer to DeviceAddress, which has type EFI_PHYSICAL_ADDRESS.
[in]UserStructPointer to the TX_BUF_MAP_INFO object with the embedded DeviceAddress.
Return values
<0If StandaloneKey compares less than UserStruct's key.
0If StandaloneKey compares equal to UserStruct's key.
>0If StandaloneKey compares greater than UserStruct's key.

Definition at line 288 of file SnpSharedHelpers.c.

◆ VirtioNetTxBufMapInfoCompare()

INTN EFIAPI VirtioNetTxBufMapInfoCompare ( IN CONST VOID *  UserStruct1,
IN CONST VOID *  UserStruct2 
)

Comparator function for two TX_BUF_MAP_INFO objects.

Parameters
[in]UserStruct1Pointer to the first TX_BUF_MAP_INFO object.
[in]UserStruct2Pointer to the second TX_BUF_MAP_INFO object.
Return values
<0If UserStruct1 compares less than UserStruct2.
0If UserStruct1 compares equal to UserStruct2.
>0If UserStruct1 compares greater than UserStruct2.

Definition at line 254 of file SnpSharedHelpers.c.

◆ VirtioNetUninitRing()

VOID EFIAPI VirtioNetUninitRing ( IN OUT VNET_DEV Dev,
IN OUT VRING Ring,
IN VOID *  RingMap 
)

Release TX and RX VRING resources.

Parameters
[in,out]DevThe VNET_DEV driver instance which was using the ring.
[in,out]RingThe virtio ring to clean up.
[in]RingMapA token return from the VirtioRingMap()

Definition at line 96 of file SnpSharedHelpers.c.

◆ VirtioNetUnmapTxBuf()

EFI_STATUS EFIAPI VirtioNetUnmapTxBuf ( IN VNET_DEV Dev,
OUT VOID **  Buffer,
IN EFI_PHYSICAL_ADDRESS  DeviceAddress 
)

Unmap (aka reverse mapping) device mapped TxBuf buffer to the system physical address

Parameters
[in]DevThe VNET_DEV driver instance which wants to reverse- and unmap the Tx packet.
[out]BufferThe system physical address of TxBuf
[in]DeviceAddressThe device address for the TxBuf
Return values
EFI_INVALID_PARAMETERThe DeviceAddress is not mapped
EFI_SUCCESSThe TxBuf at DeviceAddress has been unmapped, and Buffer has been set to TxBuf's system physical address.

Definition at line 213 of file SnpSharedHelpers.c.