TianoCore EDK2 master
|
#include "UsbCdcNcm.h"
Go to the source code of this file.
Variables | |
BIT_MAP | gTable [] |
This file contains code for USB Ethernet descriptor and specific requests implement.
Copyright (c) 2023, American Megatrends International LLC. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file UsbNcmFunction.c.
Convert value between PXE receive filter and USB ETH packet filter.
[in] | Value | PXE filter data. |
[out] | CdcFilter | A pointer to the Ethernet Packet Filter Bitmap value converted by PXE_OPFLAGS. |
Definition at line 848 of file UsbNcmFunction.c.
VOID GetEndpoint | ( | IN EFI_USB_IO_PROTOCOL * | UsbIo, |
IN OUT USB_ETHERNET_DRIVER * | UsbEthDriver | ||
) |
Get USB Ethernet IO endpoint and USB CDC data IO endpoint.
[in] | UsbIo | A pointer to the EFI_USB_IO_PROTOCOL instance. |
[in,out] | UsbEthDriver | A pointer to the USB_ETHERNET_DRIVER instance. |
Definition at line 157 of file UsbNcmFunction.c.
EFI_STATUS GetFunctionalDescriptor | ( | IN EFI_USB_CONFIG_DESCRIPTOR * | Config, |
IN UINT8 | FunDescriptorType, | ||
OUT VOID * | DataBuffer | ||
) |
Read Function descriptor
[in] | Config | A pointer to all of configuration. |
[in] | FunDescriptorType | USB CDC class descriptor SubType. |
[out] | DataBuffer | A pointer to the Data of corresponding to device capability. |
EFI_SUCCESS | The device capability descriptor was retrieved successfully. |
EFI_UNSUPPORTED | No supported. |
EFI_NOT_FOUND | The device capability descriptor was not found. |
Definition at line 100 of file UsbNcmFunction.c.
EFI_STATUS EFIAPI GetUsbEthFunDescriptor | ( | IN EDKII_USB_ETHERNET_PROTOCOL * | This, |
OUT USB_ETHERNET_FUN_DESCRIPTOR * | UsbEthFunDescriptor | ||
) |
Retrieves the USB Ethernet functional Descriptor.
This function get the Mac Address, Ethernet statistics, maximum segment size, number of multicast filters, and number of pattern filters from Ethernet functional Descriptor.
[in] | This | A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. |
[out] | UsbEthFunDescriptor | A pointer to the caller allocated USB Ethernet Functional Descriptor. |
EFI_SUCCESS | The USB Ethernet Functional descriptor was retrieved successfully. |
EFI_INVALID_PARAMETER | UsbEthFunDescriptor is NULL. |
EFI_NOT_FOUND | The USB Ethernet Functional descriptor was not found. |
Definition at line 663 of file UsbNcmFunction.c.
EFI_STATUS EFIAPI GetUsbEthMacAddress | ( | IN EDKII_USB_ETHERNET_PROTOCOL * | This, |
OUT EFI_MAC_ADDRESS * | MacAddress | ||
) |
Retrieves the USB Ethernet Mac Address.
[in] | This | A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. |
[out] | MacAddress | A pointer to the caller allocated USB Ethernet Mac Address. |
EFI_SUCCESS | The USB Header Functional descriptor was retrieved successfully. |
EFI_INVALID_PARAMETER | UsbHeaderFunDescriptor is NULL. |
EFI_NOT_FOUND | The USB Header Functional descriptor was not found. |
Definition at line 516 of file UsbNcmFunction.c.
EFI_STATUS EFIAPI GetUsbEthPowerFilter | ( | IN EDKII_USB_ETHERNET_PROTOCOL * | This, |
IN UINT16 | Value, | ||
OUT BOOLEAN * | PatternActive | ||
) |
This request retrieves the status of the specified Ethernet power management pattern filter from the device.
[in] | This | A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. |
[in] | Value | The filter number. |
[out] | PatternActive | A pointer to the pattern active boolean. |
EFI_SUCCESS | The request executed successfully. |
EFI_TIMEOUT | A timeout occurred executing the request. |
EFI_DEVICE_ERROR | The request failed due to a device error. |
EFI_INVALID_PARAMETER | One of the parameters has an invalid value. |
EFI_UNSUPPORTED | Not supported. |
Definition at line 803 of file UsbNcmFunction.c.
EFI_STATUS EFIAPI GetUsbEthStatistic | ( | IN EDKII_USB_ETHERNET_PROTOCOL * | This, |
IN UINT16 | FeatureSelector, | ||
OUT VOID * | Statistic | ||
) |
This request is used to retrieve a statistic based on the feature selector.
[in] | This | A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. |
[in] | FeatureSelector | Value of the feature selector. |
[out] | Statistic | A pointer to the 32 bit unsigned integer. |
EFI_SUCCESS | The request executed successfully. |
EFI_TIMEOUT | A timeout occurred executing the request. |
EFI_DEVICE_ERROR | The request failed due to a device error. |
EFI_INVALID_PARAMETER | One of the parameters has an invalid value. |
EFI_UNSUPPORTED | Not supported. |
Definition at line 928 of file UsbNcmFunction.c.
EFI_STATUS EFIAPI GetUsbHeaderFunDescriptor | ( | IN EDKII_USB_ETHERNET_PROTOCOL * | This, |
OUT USB_HEADER_FUN_DESCRIPTOR * | UsbHeaderFunDescriptor | ||
) |
Retrieves the USB Header functional Descriptor.
[in] | This | A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. |
[out] | UsbHeaderFunDescriptor | A pointer to the caller allocated USB Header Functional Descriptor. |
EFI_SUCCESS | The USB Header Functional descriptor was retrieved successfully. |
EFI_INVALID_PARAMETER | UsbHeaderFunDescriptor is NULL. |
EFI_NOT_FOUND | The USB Header Functional descriptor was not found. |
Definition at line 597 of file UsbNcmFunction.c.
EFI_STATUS EFIAPI GetUsbUnionFunDescriptor | ( | IN EDKII_USB_ETHERNET_PROTOCOL * | This, |
OUT USB_UNION_FUN_DESCRIPTOR * | UsbUnionFunDescriptor | ||
) |
Retrieves the USB Union functional Descriptor.
[in] | This | A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. |
[out] | UsbUnionFunDescriptor | A pointer to the caller allocated USB Union Functional Descriptor. |
EFI_SUCCESS | The USB Union Functional descriptor was retrieved successfully. |
EFI_INVALID_PARAMETER | UsbUnionFunDescriptor is NULL. |
EFI_NOT_FOUND | The USB Union Functional descriptor was not found. |
Definition at line 628 of file UsbNcmFunction.c.
EFI_STATUS EFIAPI InterruptCallback | ( | IN VOID * | Data, |
IN UINTN | DataLength, | ||
IN VOID * | Context, | ||
IN UINT32 | Status | ||
) |
Async USB transfer callback routine.
[in] | Data | Data received or sent via the USB Asynchronous Transfer, if the transfer completed successfully. |
[in] | DataLength | The length of Data received or sent via the Asynchronous Transfer, if transfer successfully completes. |
[in] | Context | Data passed from UsbAsyncInterruptTransfer() request. |
[in] | Status | Indicates the result of the asynchronous transfer. |
EFI_SUCCESS | The asynchronous USB transfer request has been successfully executed. |
EFI_DEVICE_ERROR | The asynchronous USB transfer request failed. |
Definition at line 422 of file UsbNcmFunction.c.
EFI_STATUS LoadAllDescriptor | ( | IN EFI_USB_IO_PROTOCOL * | UsbIo, |
OUT EFI_USB_CONFIG_DESCRIPTOR ** | ConfigDesc | ||
) |
Load All of device descriptor.
[in] | UsbIo | A pointer to the EFI_USB_IO_PROTOCOL instance. |
[out] | ConfigDesc | A pointer to the configuration descriptor. |
EFI_SUCCESS | The request executed successfully. |
EFI_OUT_OF_RESOURCES | The request could not be completed because the buffer specified by DescriptorLength and Descriptor is not large enough to hold the result of the request. |
EFI_TIMEOUT | A timeout occurred executing the request. |
EFI_DEVICE_ERROR | The request failed due to a device error. The transfer status is returned in Status. |
Definition at line 27 of file UsbNcmFunction.c.
BOOLEAN NextDescriptor | ( | IN EFI_USB_CONFIG_DESCRIPTOR * | Desc, |
IN OUT UINTN * | Offset | ||
) |
Returns pointer to the next descriptor for the pack of USB descriptors located in continues memory segment
[in] | Desc | A pointer to the CONFIG_DESCRIPTOR instance. |
[in,out] | Offset | A pointer to the sum of descriptor length. |
TRUE | The request executed successfully. |
FALSE | No next descriptor. |
Definition at line 65 of file UsbNcmFunction.c.
EFI_STATUS EFIAPI SetUsbEthMcastFilter | ( | IN EDKII_USB_ETHERNET_PROTOCOL * | This, |
IN UINT16 | Value, | ||
IN VOID * | McastAddr | ||
) |
This request sets the Ethernet device multicast filters as specified in the sequential list of 48 bit Ethernet multicast addresses.
[in] | This | A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. |
[in] | Value | Number of filters. |
[in] | McastAddr | A pointer to the value of the multicast addresses. |
EFI_SUCCESS | The request executed successfully. |
EFI_TIMEOUT | A timeout occurred executing the request. |
EFI_DEVICE_ERROR | The request failed due to a device error. |
EFI_INVALID_PARAMETER | One of the parameters has an invalid value. |
EFI_UNSUPPORTED | Not supported. |
Definition at line 698 of file UsbNcmFunction.c.
EFI_STATUS EFIAPI SetUsbEthPacketFilter | ( | IN EDKII_USB_ETHERNET_PROTOCOL * | This, |
IN UINT16 | Value | ||
) |
This request is used to configure device Ethernet packet filter settings.
[in] | This | A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. |
[in] | Value | Packet Filter Bitmap. |
EFI_SUCCESS | The request executed successfully. |
EFI_TIMEOUT | A timeout occurred executing the request. |
EFI_DEVICE_ERROR | The request failed due to a device error. |
EFI_INVALID_PARAMETER | One of the parameters has an invalid value. |
EFI_UNSUPPORTED | Not supported. |
Definition at line 880 of file UsbNcmFunction.c.
EFI_STATUS EFIAPI SetUsbEthPowerFilter | ( | IN EDKII_USB_ETHERNET_PROTOCOL * | This, |
IN UINT16 | Value, | ||
IN UINT16 | Length, | ||
IN VOID * | PatternFilter | ||
) |
This request sets up the specified Ethernet power management pattern filter as described in the data structure.
[in] | This | A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. |
[in] | Value | Number of filters. |
[in] | Length | Size of the power management pattern filter data. |
[in] | PatternFilter | A pointer to the power management pattern filter structure. |
EFI_SUCCESS | The request executed successfully. |
EFI_TIMEOUT | A timeout occurred executing the request. |
EFI_DEVICE_ERROR | The request failed due to a device error. |
EFI_INVALID_PARAMETER | One of the parameters has an invalid value. |
EFI_UNSUPPORTED | Not supported. |
Definition at line 756 of file UsbNcmFunction.c.
EFI_STATUS EFIAPI UsbEthNcmBulkSize | ( | IN EDKII_USB_ETHERNET_PROTOCOL * | This, |
OUT UINTN * | BulkSize | ||
) |
Get the USB NCM max NTB size.
[in] | This | A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. |
[out] | BulkSize | A pointer to the Bulk transfer data size. |
EFI_SUCCESS | Get the USB NCM max NTB size successfully. |
Definition at line 575 of file UsbNcmFunction.c.
EFI_STATUS EFIAPI UsbEthNcmInterrupt | ( | IN EDKII_USB_ETHERNET_PROTOCOL * | This, |
IN BOOLEAN | IsNewTransfer, | ||
IN UINTN | PollingInterval, | ||
IN EFI_USB_DEVICE_REQUEST * | Request | ||
) |
This function is used to manage a USB device with an interrupt transfer pipe.
[in] | This | A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. |
[in] | IsNewTransfer | If TRUE, a new transfer will be submitted to USB controller. If FALSE, the interrupt transfer is deleted from the device's interrupt transfer queue. |
[in] | PollingInterval | Indicates the periodic rate, in milliseconds, that the transfer is to be executed.This parameter is required when IsNewTransfer is TRUE. The value must be between 1 to 255, otherwise EFI_INVALID_PARAMETER is returned. The units are in milliseconds. |
[in] | Request | A pointer to the EFI_USB_DEVICE_REQUEST data. |
EFI_SUCCESS | The asynchronous USB transfer request transfer has been successfully executed. |
EFI_DEVICE_ERROR | The asynchronous USB transfer request failed. |
Definition at line 463 of file UsbNcmFunction.c.
EFI_STATUS EFIAPI UsbEthNcmReceive | ( | IN PXE_CDB * | Cdb, |
IN EDKII_USB_ETHERNET_PROTOCOL * | This, | ||
IN OUT VOID * | Packet, | ||
IN OUT UINTN * | PacketLength | ||
) |
This function is used to manage a USB device with the bulk transfer pipe. The endpoint is Bulk in.
[in] | Cdb | A pointer to the command descriptor block. |
[in] | This | A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. |
[in,out] | Packet | A pointer to the buffer of data that will be transmitted to USB device or received from USB device. |
[in,out] | PacketLength | A pointer to the PacketLength. |
EFI_SUCCESS | The bulk transfer has been successfully executed. |
EFI_DEVICE_ERROR | The transfer failed. The transfer status is returned in status. |
EFI_INVALID_PARAMETER | One or more parameters are invalid. |
EFI_OUT_OF_RESOURCES | The request could not be submitted due to a lack of resources. |
EFI_TIMEOUT | The control transfer fails due to timeout. |
Definition at line 217 of file UsbNcmFunction.c.
EFI_STATUS EFIAPI UsbEthNcmTransmit | ( | IN PXE_CDB * | Cdb, |
IN EDKII_USB_ETHERNET_PROTOCOL * | This, | ||
IN VOID * | Packet, | ||
IN OUT UINTN * | PacketLength | ||
) |
This function is used to manage a USB device with the bulk transfer pipe. The endpoint is Bulk out.
[in] | Cdb | A pointer to the command descriptor block. |
[in] | This | A pointer to the EDKII_USB_ETHERNET_PROTOCOL instance. |
[in] | Packet | A pointer to the buffer of data that will be transmitted to USB device or received from USB device. |
[in,out] | PacketLength | A pointer to the PacketLength. |
EFI_SUCCESS | The bulk transfer has been successfully executed. |
EFI_DEVICE_ERROR | The transfer failed. The transfer status is returned in status. |
EFI_INVALID_PARAMETER | One or more parameters are invalid. |
EFI_OUT_OF_RESOURCES | The request could not be submitted due to a lack of resources. |
EFI_TIMEOUT | The control transfer fails due to timeout. |
Definition at line 333 of file UsbNcmFunction.c.
BIT_MAP gTable[] |
Definition at line 832 of file UsbNcmFunction.c.