TianoCore EDK2 master
Loading...
Searching...
No Matches
DriverBinding.h File Reference

Go to the source code of this file.

Data Structures

struct  ETHERNET_HEADER
 
struct  NIC_DEVICE
 

Macros

#define NETWORK_COMMON_DRIVER_VERSION   1
 
#define NETWORK_COMMON_POLLING_INTERVAL   0x10
 
#define RX_BUFFER_COUNT   32
 
#define TX_BUFFER_COUNT   32
 
#define MEMORY_REQUIRE   0
 
#define UNDI_DEV_SIGNATURE   SIGNATURE_32('u','n','d','i')
 
#define UNDI_DEV_FROM_THIS(a)   CR(a, NIC_DEVICE, NiiProtocol, UNDI_DEV_SIGNATURE)
 
#define UNDI_DEV_FROM_NIC(a)   CR(a, NIC_DEVICE, NicInfo, UNDI_DEV_SIGNATURE)
 

Typedefs

typedef VOID(* API_FUNC) (PXE_CDB *, NIC_DATA *)
 

Functions

EFI_STATUS EFIAPI NetworkCommonSupported (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
 
EFI_STATUS EFIAPI NetworkCommonDriverStart (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
 
EFI_STATUS EFIAPI NetworkCommonDriverStop (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
 
VOID PxeStructInit (OUT PXE_SW_UNDI *PxeSw)
 
VOID UpdateNicNum (IN NIC_DATA *Nic, IN OUT PXE_SW_UNDI *PxeSw)
 
EFI_STATUS EFIAPI UndiApiEntry (IN UINT64 Cdb)
 
UINTN MapIt (IN NIC_DATA *Nic, IN UINT64 MemAddr, IN UINT32 Size, IN UINT32 Direction, OUT UINT64 MappedAddr)
 
VOID UnMapIt (IN NIC_DATA *Nic, IN UINT64 MemAddr, IN UINT32 Size, IN UINT32 Direction, IN UINT64 MappedAddr)
 
VOID UndiGetState (IN PXE_CDB *Cdb, IN NIC_DATA *Nic)
 
VOID UndiStart (IN PXE_CDB *Cdb, IN NIC_DATA *Nic)
 
VOID UndiStop (IN PXE_CDB *Cdb, IN NIC_DATA *Nic)
 
VOID UndiGetInitInfo (IN PXE_CDB *Cdb, IN NIC_DATA *Nic)
 
VOID UndiGetConfigInfo (IN PXE_CDB *Cdb, IN NIC_DATA *Nic)
 
VOID UndiInitialize (IN PXE_CDB *Cdb, IN OUT NIC_DATA *Nic)
 
VOID UndiReset (IN PXE_CDB *Cdb, IN NIC_DATA *Nic)
 
VOID UndiShutdown (IN PXE_CDB *Cdb, IN OUT NIC_DATA *Nic)
 
VOID UndiInterruptEnable (IN PXE_CDB *Cdb, IN NIC_DATA *Nic)
 
VOID UndiReceiveFilter (IN PXE_CDB *Cdb, IN NIC_DATA *Nic)
 
VOID UndiStationAddress (IN PXE_CDB *Cdb, IN NIC_DATA *Nic)
 
VOID UndiStatistics (IN PXE_CDB *Cdb, IN NIC_DATA *Nic)
 
VOID UndiMcastIp2Mac (IN OUT PXE_CDB *Cdb, IN NIC_DATA *Nic)
 
VOID UndiNvData (IN PXE_CDB *Cdb, IN NIC_DATA *Nic)
 
VOID UndiGetStatus (IN PXE_CDB *Cdb, IN NIC_DATA *Nic)
 
VOID UndiFillHeader (IN PXE_CDB *Cdb, IN NIC_DATA *Nic)
 
VOID UndiTransmit (IN PXE_CDB *Cdb, IN NIC_DATA *Nic)
 
VOID UndiReceive (IN PXE_CDB *Cdb, IN NIC_DATA *Nic)
 
UINT16 Initialize (IN PXE_CDB *Cdb, IN OUT NIC_DATA *Nic)
 
UINT16 Transmit (IN PXE_CDB *Cdb, IN OUT NIC_DATA *Nic, IN UINT64 CpbAddr, IN UINT16 OpFlags)
 
UINT16 Receive (IN PXE_CDB *Cdb, IN OUT NIC_DATA *Nic, IN UINT64 CpbAddr, IN OUT UINT64 DbAddr)
 
UINT16 SetFilter (IN NIC_DATA *Nic, IN UINT16 SetFilter, IN UINT64 CpbAddr, IN UINT32 CpbSize)
 
UINT16 Statistics (IN NIC_DATA *Nic, IN UINT64 DbAddr, IN UINT16 DbSize)
 

Variables

PXE_SW_UNDIgPxe
 
NIC_DEVICEgLanDeviceList [MAX_LAN_INTERFACE]
 
EFI_COMPONENT_NAME2_PROTOCOL gNetworkCommonComponentName2
 

Detailed Description

Header file for for USB network common driver

Copyright (c) 2023, American Megatrends International LLC. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file DriverBinding.h.

Macro Definition Documentation

◆ MEMORY_REQUIRE

#define MEMORY_REQUIRE   0

Definition at line 28 of file DriverBinding.h.

◆ NETWORK_COMMON_DRIVER_VERSION

#define NETWORK_COMMON_DRIVER_VERSION   1

Definition at line 24 of file DriverBinding.h.

◆ NETWORK_COMMON_POLLING_INTERVAL

#define NETWORK_COMMON_POLLING_INTERVAL   0x10

Definition at line 25 of file DriverBinding.h.

◆ RX_BUFFER_COUNT

#define RX_BUFFER_COUNT   32

Definition at line 26 of file DriverBinding.h.

◆ TX_BUFFER_COUNT

#define TX_BUFFER_COUNT   32

Definition at line 27 of file DriverBinding.h.

◆ UNDI_DEV_FROM_NIC

#define UNDI_DEV_FROM_NIC (   a)    CR(a, NIC_DEVICE, NicInfo, UNDI_DEV_SIGNATURE)

Definition at line 32 of file DriverBinding.h.

◆ UNDI_DEV_FROM_THIS

#define UNDI_DEV_FROM_THIS (   a)    CR(a, NIC_DEVICE, NiiProtocol, UNDI_DEV_SIGNATURE)

Definition at line 31 of file DriverBinding.h.

◆ UNDI_DEV_SIGNATURE

#define UNDI_DEV_SIGNATURE   SIGNATURE_32('u','n','d','i')

Definition at line 30 of file DriverBinding.h.

Typedef Documentation

◆ API_FUNC

typedef VOID(* API_FUNC) (PXE_CDB *, NIC_DATA *)

Definition at line 52 of file DriverBinding.h.

Function Documentation

◆ Initialize()

UINT16 Initialize ( IN PXE_CDB Cdb,
IN OUT NIC_DATA Nic 
)

Initialize Network interface controller data.

Parameters
[in]CdbA pointer to the command descriptor block.
[in,out]NicA pointer to the Network interface controller data.
Return values
StatusA value of Pxe statcode.

Definition at line 492 of file PxeFunction.c.

◆ MapIt()

UINTN MapIt ( IN NIC_DATA Nic,
IN UINT64  MemAddr,
IN UINT32  Size,
IN UINT32  Direction,
OUT UINT64  MappedAddr 
)

Map virtual memory address for DMA. This field can be set to zero if there is no mapping service.

Parameters
[in]NicA pointer to the Network interface controller data.
[in]MemAddrVirtual address to be mapped.
[in]SizeSize of memory to be mapped.
[in]DirectionDirection of data flow for this memory's usage: cpu->device, device->cpu or both ways.
[out]MappedAddrPointer to return the mapped device address.

Definition at line 1746 of file PxeFunction.c.

◆ NetworkCommonDriverStart()

EFI_STATUS EFIAPI NetworkCommonDriverStart ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL RemainingDevicePath 
)

Network Common Driver Binding Start.

Parameters
[in]ThisProtocol instance pointer.
[in]ControllerHandleHandle of device to bind driver to.
[in]RemainingDevicePathOptional parameter use to pick a specific child device to start.
Return values
EFI_SUCCESSThis driver is added to ControllerHandle
EFI_DEVICE_ERRORThis driver could not be started due to a device error
EFI_OUT_OF_RESOURCESThe driver could not install successfully due to a lack of resources.
otherThis driver does not support this device

Definition at line 143 of file DriverBinding.c.

◆ NetworkCommonDriverStop()

EFI_STATUS EFIAPI NetworkCommonDriverStop ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  ControllerHandle,
IN UINTN  NumberOfChildren,
IN EFI_HANDLE ChildHandleBuffer 
)

Network Common Driver Binding Stop.

Parameters
[in]ThisProtocol instance pointer.
[in]ControllerHandleHandle of device to stop driver on
[in]NumberOfChildrenNumber of Handles in ChildHandleBuffer. If number of children is zero stop the entire bus driver.
[in]ChildHandleBufferList of Child Handles to Stop.
Return values
EFI_SUCCESSThis driver is removed ControllerHandle
otherThis driver was not removed from this device

Definition at line 433 of file DriverBinding.c.

◆ NetworkCommonSupported()

EFI_STATUS EFIAPI NetworkCommonSupported ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL RemainingDevicePath 
)

Network Common Driver Binding Support.

Parameters
[in]ThisProtocol instance pointer.
[in]ControllerHandleHandle of device to test.
[in]RemainingDevicePathOptional parameter use to pick a specific child device to start.
Return values
EFI_SUCCESSThis driver supports this device.
EFI_ALREADY_STARTEDThis driver is already running on this device.
otherThis driver does not support this device.

Definition at line 97 of file DriverBinding.c.

◆ PxeStructInit()

VOID PxeStructInit ( OUT PXE_SW_UNDI PxeSw)

Fill out PXE SW UNDI structure.

Parameters
[out]PxeSwA pointer to the PXE SW UNDI structure.

Definition at line 1641 of file PxeFunction.c.

◆ Receive()

UINT16 Receive ( IN PXE_CDB Cdb,
IN OUT NIC_DATA Nic,
IN UINT64  CpbAddr,
IN OUT UINT64  DbAddr 
)

Use USB Ethernet Protocol Bulk in command to receive data.

Parameters
[in]CdbA pointer to the command descriptor block.
[in,out]NicA pointer to the Network interface controller data.
[in]CpbAddrCommand Parameter Block Address.
[in,out]DbAddrData Block Address.

Definition at line 1528 of file PxeFunction.c.

◆ SetFilter()

UINT16 SetFilter ( IN NIC_DATA Nic,
IN UINT16  SetFilter,
IN UINT64  CpbAddr,
IN UINT32  CpbSize 
)

Set PXE receive filter.

Parameters
[in]NicA pointer to the Network interface controller data.
[in]SetFilterPXE receive filter
[in]CpbAddrCommand Parameter Block Address
[in]CpbSizeCommand Parameter Block Size

Definition at line 804 of file PxeFunction.c.

◆ Statistics()

UINT16 Statistics ( IN NIC_DATA Nic,
IN UINT64  DbAddr,
IN UINT16  DbSize 
)

Return data for DB data.

Parameters
[in]NicA pointer to the Network interface controller data.
[in]DbAddrData Block Address.
[in]DbSizeData Block Size.

Definition at line 995 of file PxeFunction.c.

◆ Transmit()

UINT16 Transmit ( IN PXE_CDB Cdb,
IN OUT NIC_DATA Nic,
IN UINT64  CpbAddr,
IN UINT16  OpFlags 
)

Use USB Ethernet Protocol Bulk out command to transmit data.

Parameters
[in]CdbA pointer to the command descriptor block.
[in,out]NicA pointer to the Network interface controller data.
[in]CpbAddrCommand Parameter Block Address.
[in]OpFlagsOperation Flags.

Definition at line 1369 of file PxeFunction.c.

◆ UndiApiEntry()

EFI_STATUS EFIAPI UndiApiEntry ( IN UINT64  Cdb)

UNDI API table entry.

Parameters
[in]CdbA pointer to the command descriptor block.

Definition at line 1716 of file PxeFunction.c.

◆ UndiFillHeader()

VOID UndiFillHeader ( IN PXE_CDB Cdb,
IN NIC_DATA Nic 
)

This command is used to fill the media header(s) in transmit packet(s).

Parameters
[in]CdbA pointer to the command descriptor block.
[in]NicA pointer to the Network interface controller data.

Definition at line 1225 of file PxeFunction.c.

◆ UndiGetConfigInfo()

VOID UndiGetConfigInfo ( IN PXE_CDB Cdb,
IN NIC_DATA Nic 
)

This command is used to retrieve configuration information about the NIC being controlled by the UNDI.

Parameters
[in]CdbA pointer to the command descriptor block.
[in]NicA pointer to the Network interface controller data.

Definition at line 338 of file PxeFunction.c.

◆ UndiGetInitInfo()

VOID UndiGetInitInfo ( IN PXE_CDB Cdb,
IN NIC_DATA Nic 
)

This command is used to retrieve initialization information that is needed by drivers and applications to initialized UNDI.

Parameters
[in]CdbA pointer to the command descriptor block.
[in]NicA pointer to the Network interface controller data.

Definition at line 268 of file PxeFunction.c.

◆ UndiGetState()

VOID UndiGetState ( IN PXE_CDB Cdb,
IN NIC_DATA Nic 
)

This command is used to determine the operational state of the UNDI.

Parameters
[in]CdbA pointer to the command descriptor block.
[in]NicA pointer to the Network interface controller data.

Definition at line 63 of file PxeFunction.c.

◆ UndiGetStatus()

VOID UndiGetStatus ( IN PXE_CDB Cdb,
IN NIC_DATA Nic 
)

This command returns the current interrupt status and/or the transmitted buffer addresses and the current media status.

Parameters
[in]CdbA pointer to the command descriptor block.
[in]NicA pointer to the Network interface controller data.

Definition at line 1131 of file PxeFunction.c.

◆ UndiInitialize()

VOID UndiInitialize ( IN PXE_CDB Cdb,
IN OUT NIC_DATA Nic 
)

This command resets the network adapter and initializes UNDI using the parameters supplied in the CPB.

Parameters
[in]CdbA pointer to the command descriptor block.
[in,out]NicA pointer to the Network interface controller data.

Definition at line 390 of file PxeFunction.c.

◆ UndiInterruptEnable()

VOID UndiInterruptEnable ( IN PXE_CDB Cdb,
IN NIC_DATA Nic 
)

The Interrupt Enables command can be used to read and/or change the current external interrupt enable settings.

Parameters
[in]CdbA pointer to the command descriptor block.
[in]NicA pointer to the Network interface controller data.

Definition at line 667 of file PxeFunction.c.

◆ UndiMcastIp2Mac()

VOID UndiMcastIp2Mac ( IN OUT PXE_CDB Cdb,
IN NIC_DATA Nic 
)

Translate a multicast IPv4 or IPv6 address to a multicast MAC address.

Parameters
[in,out]CdbA pointer to the command descriptor block.
[in]NicA pointer to the Network interface controller data.

Definition at line 1032 of file PxeFunction.c.

◆ UndiNvData()

VOID UndiNvData ( IN PXE_CDB Cdb,
IN NIC_DATA Nic 
)

This command is used to read and write (if supported by NIC H/W) nonvolatile storage on the NIC.

Parameters
[in]CdbA pointer to the command descriptor block.
[in]NicA pointer to the Network interface controller data.

Definition at line 1103 of file PxeFunction.c.

◆ UndiReceive()

VOID UndiReceive ( IN PXE_CDB Cdb,
IN NIC_DATA Nic 
)

When the network adapter has received a frame, this command is used to copy the frame into driver/application storage.

Parameters
[in]CdbA pointer to the command descriptor block.
[in]NicA pointer to the Network interface controller data.

Definition at line 1473 of file PxeFunction.c.

◆ UndiReceiveFilter()

VOID UndiReceiveFilter ( IN PXE_CDB Cdb,
IN NIC_DATA Nic 
)

This command is used to read and change receive filters and, if supported, read and change the multicast MAC address filter list.

Parameters
[in]CdbA pointer to the command descriptor block.
[in]NicA pointer to the Network interface controller data.

Definition at line 695 of file PxeFunction.c.

◆ UndiReset()

VOID UndiReset ( IN PXE_CDB Cdb,
IN NIC_DATA Nic 
)

This command resets the network adapter and reinitializes the UNDI with the same parameters provided in the Initialize command.

Parameters
[in]CdbA pointer to the command descriptor block.
[in]NicA pointer to the Network interface controller data.

Definition at line 550 of file PxeFunction.c.

◆ UndiShutdown()

VOID UndiShutdown ( IN PXE_CDB Cdb,
IN OUT NIC_DATA Nic 
)

The Shutdown command resets the network adapter and leaves it in a safe state for another driver to initialize.

Parameters
[in]CdbA pointer to the command descriptor block.
[in,out]NicA pointer to the Network interface controller data.

Definition at line 614 of file PxeFunction.c.

◆ UndiStart()

VOID UndiStart ( IN PXE_CDB Cdb,
IN NIC_DATA Nic 
)

This command is used to change the UNDI operational state from stopped to started.

Parameters
[in]CdbA pointer to the command descriptor block.
[in]NicA pointer to the Network interface controller data.

Definition at line 106 of file PxeFunction.c.

◆ UndiStationAddress()

VOID UndiStationAddress ( IN PXE_CDB Cdb,
IN NIC_DATA Nic 
)

This command is used to get current station and broadcast MAC addresses and, if supported, to change the current station MAC address.

Parameters
[in]CdbA pointer to the command descriptor block.
[in]NicA pointer to the Network interface controller data.

Definition at line 871 of file PxeFunction.c.

◆ UndiStatistics()

VOID UndiStatistics ( IN PXE_CDB Cdb,
IN NIC_DATA Nic 
)

This command is used to read and clear the NIC traffic statistics.

Parameters
[in]CdbA pointer to the command descriptor block.
[in]NicA pointer to the Network interface controller data.

Definition at line 941 of file PxeFunction.c.

◆ UndiStop()

VOID UndiStop ( IN PXE_CDB Cdb,
IN NIC_DATA Nic 
)

This command is used to change the UNDI operational state from started to stopped.

Parameters
[in]CdbA pointer to the command descriptor block.
[in]NicA pointer to the Network interface controller data.

Definition at line 201 of file PxeFunction.c.

◆ UndiTransmit()

VOID UndiTransmit ( IN PXE_CDB Cdb,
IN NIC_DATA Nic 
)

The Transmit command is used to place a packet into the transmit queue.

Parameters
[in]CdbA pointer to the command descriptor block.
[in]NicA pointer to the Network interface controller data.

Definition at line 1308 of file PxeFunction.c.

◆ UnMapIt()

VOID UnMapIt ( IN NIC_DATA Nic,
IN UINT64  MemAddr,
IN UINT32  Size,
IN UINT32  Direction,
IN UINT64  MappedAddr 
)

Un-map previously mapped virtual memory address. This field can be set to zero only if the Map_Mem() service is also set to zero.

Parameters
[in]NicA pointer to the Network interface controller data.
[in]MemAddrVirtual address to be mapped.
[in]SizeSize of memory to be mapped.
[in]DirectionDirection of data flow for this memory's usage: cpu->device, device->cpu or both ways.
[in]MappedAddrPointer to return the mapped device address.

Definition at line 1786 of file PxeFunction.c.

◆ UpdateNicNum()

VOID UpdateNicNum ( IN NIC_DATA Nic,
IN OUT PXE_SW_UNDI PxeSw 
)

Update NIC number.

Parameters
[in]NicA pointer to the Network interface controller data.
[in,out]PxeSwA pointer to the PXE SW UNDI structure.

Definition at line 1681 of file PxeFunction.c.

Variable Documentation

◆ gLanDeviceList

NIC_DEVICE* gLanDeviceList[MAX_LAN_INTERFACE]
extern

Definition at line 11 of file DriverBinding.c.

◆ gNetworkCommonComponentName2

EFI_COMPONENT_NAME2_PROTOCOL gNetworkCommonComponentName2
extern

Definition at line 49 of file ComponentName.c.

◆ gPxe

PXE_SW_UNDI* gPxe
extern

Definition at line 10 of file DriverBinding.c.