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

Go to the source code of this file.

Functions

BOOLEAN IsSupportedDevice (IN EFI_USB_IO_PROTOCOL *UsbIo)
 
BOOLEAN IsRndisInterface (IN EFI_USB_IO_PROTOCOL *UsbIo)
 
EFI_STATUS IsSameDevice (IN EFI_DEVICE_PATH_PROTOCOL *UsbRndisDataPath, IN EFI_DEVICE_PATH_PROTOCOL *UsbCdcDataPath)
 
BOOLEAN IsUsbCdcData (IN EFI_USB_IO_PROTOCOL *UsbIo)
 
BOOLEAN IsUsbRndis (IN EFI_USB_IO_PROTOCOL *UsbIo)
 
EFI_STATUS UpdateRndisDevice (IN EFI_DEVICE_PATH_PROTOCOL *UsbCdcDataPath, OUT USB_RNDIS_DEVICE **UsbRndisDevice)
 
VOID FindMatchingCdcData (IN USB_RNDIS_DEVICE *UsbRndisDevice)
 
EFI_STATUS EFIAPI FindMatchingRndisDev (IN EFI_HANDLE CdcHandle, OUT EFI_USB_IO_PROTOCOL **CdcUsbIo, OUT EFI_HANDLE *RndisHandle)
 
EFI_STATUS EFIAPI UsbRndisDriverSupported (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
 
EFI_STATUS EFIAPI UsbRndisDriverStart (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
 
EFI_STATUS EFIAPI CheckandStopRndisDevice (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle)
 
EFI_STATUS EFIAPI UsbRndisDriverStop (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
 
EFI_STATUS EFIAPI UsbRndisEntry (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

EFI_DRIVER_BINDING_PROTOCOL gUsbRndisDriverBinding
 

Detailed Description

This file contains code for USB Remote Network Driver Interface Spec. Driver Binding

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

Definition in file UsbRndis.c.

Function Documentation

◆ CheckandStopRndisDevice()

EFI_STATUS EFIAPI CheckandStopRndisDevice ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  ControllerHandle 
)

CheckandStopRndisDevice

Parameters
[in]ThisProtocol instance pointer.
[in]ControllerHandleHandle of device to bind driver to.
Return values
EFI_SUCCESSThis driver is added to ControllerHandle
EFI_DEVICE_ERRORThis driver could not be started due to a device error
otherThis driver does not support this device

Definition at line 746 of file UsbRndis.c.

◆ FindMatchingCdcData()

VOID FindMatchingCdcData ( IN USB_RNDIS_DEVICE UsbRndisDevice)

For the given Rndis Device, find a matching CDC device already exists or not. If found update the handle and UsbIO protocol.

Parameters
[in]UsbRndisDeviceA pointer to the USB_RNDIS_DEVICE data.

Definition at line 297 of file UsbRndis.c.

◆ FindMatchingRndisDev()

EFI_STATUS EFIAPI FindMatchingRndisDev ( IN EFI_HANDLE  CdcHandle,
OUT EFI_USB_IO_PROTOCOL **  CdcUsbIo,
OUT EFI_HANDLE RndisHandle 
)

For the given UsbIo CdcData, find a matching RNDIS device already exists or not.

Parameters
[in]CdcHandleA pointer to the EFI_HANDLE for USB CDC Data.
[out]CdcUsbIoA pointer for retrieve the EFI_USB_IO_PROTOCOL instance.
[out]RndisHandleA pointer for retrieve the handle of RNDIS device.
Return values
EFI_SUCCESSThe USB_RNDIS_DEVICE matching this CDC Data is found.
EFI_NOT_FOUNDThe USB_RNDIS_DEVICE matching this CDC Data is not found.

Definition at line 382 of file UsbRndis.c.

◆ IsRndisInterface()

BOOLEAN IsRndisInterface ( IN EFI_USB_IO_PROTOCOL UsbIo)

Check if this interface is USB Rndis SubType but not CDC Data interface

Parameters
[in]UsbIoA pointer to the EFI_USB_IO_PROTOCOL instance.
Return values
TRUEUSB Rndis SubType.
FALSENot USB Rndis SubType.

Definition at line 69 of file UsbRndis.c.

◆ IsSameDevice()

EFI_STATUS IsSameDevice ( IN EFI_DEVICE_PATH_PROTOCOL UsbRndisDataPath,
IN EFI_DEVICE_PATH_PROTOCOL UsbCdcDataPath 
)

Check if the USB RNDIS and USB CDC Data interfaces are from the same device.

Parameters
[in]UsbRndisDataPathA pointer to the EFI_DEVICE_PATH_PROTOCOL instance.
[in]UsbCdcDataPathA pointer to the EFI_DEVICE_PATH_PROTOCOL instance.
Return values
EFI_SUCCESSIs the same device.
EFI_UNSUPPORTEDIs not the same device.

Definition at line 107 of file UsbRndis.c.

◆ IsSupportedDevice()

BOOLEAN IsSupportedDevice ( IN EFI_USB_IO_PROTOCOL UsbIo)

Check if this interface is USB Rndis SubType

Parameters
[in]UsbIoA pointer to the EFI_USB_IO_PROTOCOL instance.
Return values
TRUEUSB Rndis SubType.
FALSENot USB Rndis SubType.

Definition at line 30 of file UsbRndis.c.

◆ IsUsbCdcData()

BOOLEAN IsUsbCdcData ( IN EFI_USB_IO_PROTOCOL UsbIo)

Check if the USB CDC Data(UsbIo) installed and return USB CDC Data Handle.

Parameters
[in]UsbIoA pointer to the EFI_USB_IO_PROTOCOL instance.
Return values
TRUEUSB CDC Data(UsbIo) installed.
FALSEUSB CDC Data(UsbIo) did not installed.

Definition at line 145 of file UsbRndis.c.

◆ IsUsbRndis()

BOOLEAN IsUsbRndis ( IN EFI_USB_IO_PROTOCOL UsbIo)

Check if the USB Rndis(UsbIo) installed

Parameters
[in]UsbIoA pointer to the EFI_USB_IO_PROTOCOL instance.
Return values
TRUEUSB Rndis(UsbIo) installed.
FALSEUSB Rndis(UsbIo) did not installed.

Definition at line 178 of file UsbRndis.c.

◆ UpdateRndisDevice()

EFI_STATUS UpdateRndisDevice ( IN EFI_DEVICE_PATH_PROTOCOL UsbCdcDataPath,
OUT USB_RNDIS_DEVICE **  UsbRndisDevice 
)

Control comes here when a CDC device is found.Check if a RNDIS interface is already found for this device or not. For one device two USBIO will be installed each for CDC and RNDIS interface.

Parameters
[in]UsbCdcDataPathA pointer to the EFI_DEVICE_PATH_PROTOCOL instance.
[out]UsbRndisDeviceA pointer to the USB_RNDIS_DEVICE Data.
Return values
EFI_SUCCESSThe USB_RNDIS_DEVICE matching this CDC Data is found.
EFI_NOT_FOUNDThe USB_RNDIS_DEVICE matching this CDC Data is not found.

Definition at line 213 of file UsbRndis.c.

◆ UsbRndisDriverStart()

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

USB RNDIS 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 518 of file UsbRndis.c.

◆ UsbRndisDriverStop()

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

USB Rndis 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 795 of file UsbRndis.c.

◆ UsbRndisDriverSupported()

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

USB Rndis 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 470 of file UsbRndis.c.

◆ UsbRndisEntry()

EFI_STATUS EFIAPI UsbRndisEntry ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Entrypoint of RNDIS Driver.

This function is the entrypoint of RNDIS Driver. It installs Driver Binding Protocols together with Component Name Protocols.

Parameters
[in]ImageHandleThe firmware allocated handle for the EFI image.
[in]SystemTableA pointer to the EFI System Table.
Return values
EFI_SUCCESSThe entry point is executed successfully.

Definition at line 870 of file UsbRndis.c.

Variable Documentation

◆ gUsbRndisDriverBinding

EFI_DRIVER_BINDING_PROTOCOL gUsbRndisDriverBinding
Initial value:
= {
USB_RNDIS_DRIVER_VERSION,
}
#define NULL
Definition: Base.h:319
EFI_STATUS EFIAPI UsbRndisDriverSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: UsbRndis.c:470
EFI_STATUS EFIAPI UsbRndisDriverStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: UsbRndis.c:518
EFI_STATUS EFIAPI UsbRndisDriverStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
Definition: UsbRndis.c:795

Definition at line 11 of file UsbRndis.c.