TianoCore EDK2 master
Loading...
Searching...
No Matches
Callback.c File Reference
#include "Snp.h"

Go to the source code of this file.

Functions

VOID EFIAPI SnpUndi32CallbackBlock (IN UINT64 UniqueId, IN UINT32 Enable)
 
VOID EFIAPI SnpUndi32CallbackDelay (IN UINT64 UniqueId, IN UINT64 MicroSeconds)
 
VOID EFIAPI SnpUndi32CallbackMemio (IN UINT64 UniqueId, IN UINT8 ReadOrWrite, IN UINT8 NumBytes, IN UINT64 MemOrPortAddr, IN OUT UINT64 BufferPtr)
 
VOID EFIAPI SnpUndi32CallbackMap (IN UINT64 UniqueId, IN UINT64 CpuAddr, IN UINT32 NumBytes, IN UINT32 Direction, IN OUT UINT64 DeviceAddrPtr)
 
VOID EFIAPI SnpUndi32CallbackUnmap (IN UINT64 UniqueId, IN UINT64 CpuAddr, IN UINT32 NumBytes, IN UINT32 Direction, IN UINT64 DeviceAddr)
 
VOID EFIAPI SnpUndi32CallbackSync (IN UINT64 UniqueId, IN UINT64 CpuAddr, IN UINT32 NumBytes, IN UINT32 Direction, IN UINT64 DeviceAddr)
 

Detailed Description

This file contains the callback routines for undi3.1. the callback routines for Undi3.1 have an extra parameter UniqueId which stores the interface context for the NIC that snp is trying to talk.

Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Callback.c.

Function Documentation

◆ SnpUndi32CallbackBlock()

VOID EFIAPI SnpUndi32CallbackBlock ( IN UINT64  UniqueId,
IN UINT32  Enable 
)

Acquire or release a lock of the exclusive access to a critical section of the code/data.

This is a callback routine supplied to UNDI3.1 at undi_start time. New callbacks for 3.1: there won't be a virtual2physical callback for UNDI 3.1 because undi3.1 uses the MemMap call to map the required address by itself!

Parameters
UniqueIdThis was supplied to UNDI at Undi_Start, SNP uses this to store Undi interface context (Undi does not read or write this variable).
EnableNon-zero indicates acquire; Zero indicates release.

Definition at line 30 of file Callback.c.

◆ SnpUndi32CallbackDelay()

VOID EFIAPI SnpUndi32CallbackDelay ( IN UINT64  UniqueId,
IN UINT64  MicroSeconds 
)

Delay MicroSeconds of micro seconds.

This is a callback routine supplied to UNDI at undi_start time.

Parameters
UniqueIdThis was supplied to UNDI at Undi_Start, SNP uses this to store Undi interface context (Undi does not read or write this variable).
MicroSecondsNumber of micro seconds to pause, usually multiple of 10.

Definition at line 62 of file Callback.c.

◆ SnpUndi32CallbackMap()

VOID EFIAPI SnpUndi32CallbackMap ( IN UINT64  UniqueId,
IN UINT64  CpuAddr,
IN UINT32  NumBytes,
IN UINT32  Direction,
IN OUT UINT64  DeviceAddrPtr 
)

Map a CPU address to a device address.

This is a callback routine supplied to UNDI at undi_start time.

Parameters
UniqueIdThis was supplied to UNDI at Undi_Start, SNP uses this to store Undi interface context (Undi does not read or write this variable).
CpuAddrVirtual address to be mapped.
NumBytesSize of memory to be mapped.
DirectionDirection of data flow for this memory's usage: cpu->device, device->cpu or both ways.
DeviceAddrPtrPointer to return the mapped device address.

Definition at line 199 of file Callback.c.

◆ SnpUndi32CallbackMemio()

VOID EFIAPI SnpUndi32CallbackMemio ( IN UINT64  UniqueId,
IN UINT8  ReadOrWrite,
IN UINT8  NumBytes,
IN UINT64  MemOrPortAddr,
IN OUT UINT64  BufferPtr 
)

IO routine for UNDI3.1.

This is a callback routine supplied to UNDI at undi_start time.

Parameters
UniqueIdThis was supplied to UNDI at Undi_Start, SNP uses this to store Undi interface context (Undi does not read or write this variable).
ReadOrWriteIndicates read or write, IO or Memory.
NumBytesNumber of bytes to read or write.
MemOrPortAddrIO or memory address to read from or write to.
BufferPtrMemory location to read into or that contains the bytes to write.

Definition at line 89 of file Callback.c.

◆ SnpUndi32CallbackSync()

VOID EFIAPI SnpUndi32CallbackSync ( IN UINT64  UniqueId,
IN UINT64  CpuAddr,
IN UINT32  NumBytes,
IN UINT32  Direction,
IN UINT64  DeviceAddr 
)

Synchronize the virtual buffer contents with the mapped buffer contents.

This is a callback routine supplied to UNDI at undi_start time. The virtual and mapped buffers need not correspond to the same physical memory (especially if the virtual address is > 4GB). Depending on the direction for which the buffer is mapped, undi will need to synchronize their contents whenever it writes to/reads from the buffer using either the cpu address or the device address. EFI does not provide a sync call since virt=physical, we should just do the synchronization ourselves here.

Parameters
UniqueIdThis was supplied to UNDI at Undi_Start, SNP uses this to store Undi interface context (Undi does not read or write this variable).
CpuAddrVirtual address that was mapped.
NumBytesSize of memory mapped.
DirectionDirection of data flow for this memory's usage: cpu->device, device->cpu or both ways.
DeviceAddrThe mapped device address.

Definition at line 348 of file Callback.c.

◆ SnpUndi32CallbackUnmap()

VOID EFIAPI SnpUndi32CallbackUnmap ( IN UINT64  UniqueId,
IN UINT64  CpuAddr,
IN UINT32  NumBytes,
IN UINT32  Direction,
IN UINT64  DeviceAddr 
)

Unmap an address that was previously mapped using map callback.

This is a callback routine supplied to UNDI at undi_start time.

Parameters
UniqueIdThis was supplied to UNDI at Undi_Start, SNP uses this to store. Undi interface context (Undi does not read or write this variable).
CpuAddrVirtual address that was mapped.
NumBytesSize of memory mapped.
DirectionDirection of data flow for this memory's usage: cpu->device, device->cpu or both ways.
DeviceAddrThe mapped device address.

Definition at line 294 of file Callback.c.