TianoCore EDK2 master
|
#include "UsbBus.h"
Go to the source code of this file.
Variables | |
USB_CLASS_FORMAT_DEVICE_PATH | mAllUsbClassDevicePath |
Wrapper function for usb host controller interface.
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file UsbUtility.c.
EFI_STATUS EFIAPI AddUsbDPToList | ( | IN EFI_DEVICE_PATH_PROTOCOL * | UsbDP, |
IN LIST_ENTRY * | UsbIoDPList | ||
) |
Add a usb device path into the DEVICE_PATH_LIST_ITEM list.
UsbDP | a usb device path of DEVICE_PATH_LIST_ITEM. |
UsbIoDPList | a DEVICE_PATH_LIST_ITEM list. |
EFI_INVALID_PARAMETER | If parameters are invalid, return this value. |
EFI_SUCCESS | If Add operation is successful, return this value. |
Definition at line 688 of file UsbUtility.c.
EFI_DEVICE_PATH_PROTOCOL *EFIAPI GetUsbDPFromFullDP | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DevicePath | ) |
Create a new device path which only contain the first Usb part of the DevicePath.
DevicePath | A full device path which contain the usb nodes. |
Definition at line 564 of file UsbUtility.c.
BOOLEAN EFIAPI MatchUsbClass | ( | IN USB_CLASS_DEVICE_PATH * | UsbClassDevicePathPtr, |
IN USB_INTERFACE * | UsbIf | ||
) |
Check whether usb device, whose interface is UsbIf, matches the usb class which indicated by UsbClassDevicePathPtr whose is a short form usb class device path.
UsbClassDevicePathPtr | a short form usb class device path. |
UsbIf | a usb device interface. |
TRUE | the usb device match the usb class. |
FALSE | the usb device does not match the usb class. |
Definition at line 732 of file UsbUtility.c.
BOOLEAN MatchUsbWwid | ( | IN USB_WWID_DEVICE_PATH * | UsbWWIDDevicePathPtr, |
IN USB_INTERFACE * | UsbIf | ||
) |
Check whether usb device, whose interface is UsbIf, matches the usb WWID requirement which indicated by UsbWWIDDevicePathPtr whose is a short form usb WWID device path.
UsbWWIDDevicePathPtr | a short form usb WWID device path. |
UsbIf | a usb device interface. |
TRUE | the usb device match the usb WWID requirement. |
FALSE | the usb device does not match the usb WWID requirement. |
Definition at line 810 of file UsbUtility.c.
BOOLEAN EFIAPI SearchUsbDPInList | ( | IN EFI_DEVICE_PATH_PROTOCOL * | UsbDP, |
IN LIST_ENTRY * | UsbIoDPList | ||
) |
Check whether a usb device path is in a DEVICE_PATH_LIST_ITEM list.
UsbDP | a usb device path of DEVICE_PATH_LIST_ITEM. |
UsbIoDPList | a DEVICE_PATH_LIST_ITEM list. |
TRUE | there is a DEVICE_PATH_LIST_ITEM in UsbIoDPList which contains the passed in UsbDP. |
FALSE | there is no DEVICE_PATH_LIST_ITEM in UsbIoDPList which contains the passed in UsbDP. |
Definition at line 636 of file UsbUtility.c.
EFI_STATUS EFIAPI UsbBusAddWantedUsbIoDP | ( | IN EFI_USB_BUS_PROTOCOL * | UsbBusId, |
IN EFI_DEVICE_PATH_PROTOCOL * | RemainingDevicePath | ||
) |
Store a wanted usb child device info (its Usb part of device path) which is indicated by RemainingDevicePath in a Usb bus which is indicated by UsbBusId.
UsbBusId | Point to EFI_USB_BUS_PROTOCOL interface. |
RemainingDevicePath | The remaining device patch. |
EFI_SUCCESS | Add operation is successful. |
EFI_INVALID_PARAMETER | The parameters are invalid. |
Definition at line 951 of file UsbUtility.c.
EFI_STATUS EFIAPI UsbBusFreeUsbDPList | ( | IN LIST_ENTRY * | UsbIoDPList | ) |
Free a DEVICE_PATH_LIST_ITEM list.
UsbIoDPList | a DEVICE_PATH_LIST_ITEM list pointer. |
EFI_INVALID_PARAMETER | If parameters are invalid, return this value. |
EFI_SUCCESS | If free operation is successful, return this value. |
Definition at line 902 of file UsbUtility.c.
BOOLEAN EFIAPI UsbBusIsWantedUsbIO | ( | IN USB_BUS * | Bus, |
IN USB_INTERFACE * | UsbIf | ||
) |
Check whether a usb child device is the wanted device in a bus.
Bus | The Usb bus's private data pointer. |
UsbIf | The usb child device interface. |
True | If a usb child device is the wanted device in a bus. |
False | If a usb child device is NOT the wanted device in a bus. |
Definition at line 1022 of file UsbUtility.c.
EFI_STATUS EFIAPI UsbBusRecursivelyConnectWantedUsbIo | ( | IN EFI_USB_BUS_PROTOCOL * | UsbBusId | ) |
Recursively connect every wanted usb child device to ensure they all fully connected. Check all the child Usb IO handles in this bus, recursively connecte if it is wanted usb child device.
UsbBusId | Point to EFI_USB_BUS_PROTOCOL interface. |
EFI_SUCCESS | Connect is done successfully. |
EFI_INVALID_PARAMETER | The parameter is invalid. |
Definition at line 1134 of file UsbUtility.c.
VOID UsbCloseHostProtoByChild | ( | IN USB_BUS * | Bus, |
IN EFI_HANDLE | Child | ||
) |
Close the USB host controller protocol BY_CHILD.
Bus | The USB bus driver. |
Child | The child handle. |
Definition at line 511 of file UsbUtility.c.
EFI_TPL UsbGetCurrentTpl | ( | VOID | ) |
return the current TPL, copied from the EDKII glue lib.
VOID. |
Definition at line 542 of file UsbUtility.c.
EFI_STATUS UsbHcAsyncInterruptTransfer | ( | IN USB_BUS * | UsbBus, |
IN UINT8 | DevAddr, | ||
IN UINT8 | EpAddr, | ||
IN UINT8 | DevSpeed, | ||
IN UINTN | MaxPacket, | ||
IN BOOLEAN | IsNewTransfer, | ||
IN OUT UINT8 * | DataToggle, | ||
IN UINTN | PollingInterval, | ||
IN UINTN | DataLength, | ||
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR * | Translator, | ||
IN EFI_ASYNC_USB_TRANSFER_CALLBACK | Callback, | ||
IN VOID *Context | OPTIONAL | ||
) |
Queue or cancel an asynchronous interrupt transfer.
UsbBus | The USB bus driver. |
DevAddr | The target device address. |
EpAddr | The target endpoint address, with direction encoded in bit 7. |
DevSpeed | The device's speed. |
MaxPacket | The endpoint's max packet size. |
IsNewTransfer | Whether this is a new request. If not, cancel the old request. |
DataToggle | Data toggle to use on input, next toggle on output. |
PollingInterval | The interval to poll the interrupt transfer (in ms). |
DataLength | The length of periodical data receive. |
Translator | The transaction translator for low/full speed device. |
Callback | Function to call when data is received. |
Context | The context to the callback. |
EFI_SUCCESS | The asynchronous transfer is queued. |
Others | Failed to queue the transfer. |
Definition at line 335 of file UsbUtility.c.
EFI_STATUS UsbHcBulkTransfer | ( | IN USB_BUS * | UsbBus, |
IN UINT8 | DevAddr, | ||
IN UINT8 | EpAddr, | ||
IN UINT8 | DevSpeed, | ||
IN UINTN | MaxPacket, | ||
IN UINT8 | BufferNum, | ||
IN OUT VOID * | Data[], | ||
IN OUT UINTN * | DataLength, | ||
IN OUT UINT8 * | DataToggle, | ||
IN UINTN | TimeOut, | ||
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR * | Translator, | ||
OUT UINT32 * | UsbResult | ||
) |
Execute a bulk transfer to the device's endpoint.
UsbBus | The USB bus driver. |
DevAddr | The target device address. |
EpAddr | The target endpoint address, with direction encoded in bit 7. |
DevSpeed | The device's speed. |
MaxPacket | The endpoint's max packet size. |
BufferNum | The number of data buffer. |
Data | Array of pointers to data buffer. |
DataLength | The length of data buffer. |
DataToggle | On input, the initial data toggle to use, also return the next toggle on output. |
TimeOut | The time to wait until timeout. |
Translator | The transaction translator for low/full speed device. |
UsbResult | The result of USB execution. |
EFI_SUCCESS | The bulk transfer is finished without error. |
Others | Failed to execute bulk transfer, result in UsbResult. |
Definition at line 263 of file UsbUtility.c.
EFI_STATUS UsbHcClearRootHubPortFeature | ( | IN USB_BUS * | UsbBus, |
IN UINT8 | PortIndex, | ||
IN EFI_USB_PORT_FEATURE | Feature | ||
) |
Clear the root hub port feature.
UsbBus | The USB bus driver. |
PortIndex | The port index. |
Feature | The port feature to clear. |
EFI_SUCCESS | The port feature is clear. |
Others | Failed to clear port feature. |
Definition at line 153 of file UsbUtility.c.
EFI_STATUS UsbHcControlTransfer | ( | IN USB_BUS * | UsbBus, |
IN UINT8 | DevAddr, | ||
IN UINT8 | DevSpeed, | ||
IN UINTN | MaxPacket, | ||
IN EFI_USB_DEVICE_REQUEST * | Request, | ||
IN EFI_USB_DATA_DIRECTION | Direction, | ||
IN OUT VOID * | Data, | ||
IN OUT UINTN * | DataLength, | ||
IN UINTN | TimeOut, | ||
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR * | Translator, | ||
OUT UINT32 * | UsbResult | ||
) |
Execute a control transfer to the device.
UsbBus | The USB bus driver. |
DevAddr | The device address. |
DevSpeed | The device speed. |
MaxPacket | Maximum packet size of endpoint 0. |
Request | The control transfer request. |
Direction | The direction of data stage. |
Data | The buffer holding data. |
DataLength | The length of the data. |
TimeOut | Timeout (in ms) to wait until timeout. |
Translator | The transaction translator for low/full speed device. |
UsbResult | The result of transfer. |
EFI_SUCCESS | The control transfer finished without error. |
Others | The control transfer failed, reason returned in UsbReslt. |
Definition at line 190 of file UsbUtility.c.
EFI_STATUS UsbHcGetCapability | ( | IN USB_BUS * | UsbBus, |
OUT UINT8 * | MaxSpeed, | ||
OUT UINT8 * | NumOfPort, | ||
OUT UINT8 * | Is64BitCapable | ||
) |
Get the capability of the host controller.
UsbBus | The usb driver. |
MaxSpeed | The maximum speed this host controller supports. |
NumOfPort | The number of the root hub port. |
Is64BitCapable | Whether this controller support 64 bit addressing. |
EFI_SUCCESS | The host controller capability is returned. |
Others | Failed to retrieve the host controller capability. |
Definition at line 57 of file UsbUtility.c.
EFI_STATUS UsbHcGetRootHubPortStatus | ( | IN USB_BUS * | UsbBus, |
IN UINT8 | PortIndex, | ||
OUT EFI_USB_PORT_STATUS * | PortStatus | ||
) |
Get the root hub port state.
UsbBus | The USB bus driver. |
PortIndex | The index of port. |
PortStatus | The variable to save port state. |
EFI_SUCCESS | The root port state is returned in. |
Others | Failed to get the root hub port state. |
Definition at line 95 of file UsbUtility.c.
EFI_STATUS UsbHcSetRootHubPortFeature | ( | IN USB_BUS * | UsbBus, |
IN UINT8 | PortIndex, | ||
IN EFI_USB_PORT_FEATURE | Feature | ||
) |
Set the root hub port feature.
UsbBus | The USB bus driver. |
PortIndex | The port index. |
Feature | The port feature to set. |
EFI_SUCCESS | The port feature is set. |
Others | Failed to set port feature. |
Definition at line 124 of file UsbUtility.c.
EFI_STATUS UsbHcSyncInterruptTransfer | ( | IN USB_BUS * | UsbBus, |
IN UINT8 | DevAddr, | ||
IN UINT8 | EpAddr, | ||
IN UINT8 | DevSpeed, | ||
IN UINTN | MaxPacket, | ||
IN OUT VOID * | Data, | ||
IN OUT UINTN * | DataLength, | ||
IN OUT UINT8 * | DataToggle, | ||
IN UINTN | TimeOut, | ||
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR * | Translator, | ||
OUT UINT32 * | UsbResult | ||
) |
Execute a synchronous interrupt transfer to the target endpoint.
UsbBus | The USB bus driver. |
DevAddr | The target device address. |
EpAddr | The target endpoint address, with direction encoded in bit 7. |
DevSpeed | The device's speed. |
MaxPacket | The endpoint's max packet size. |
Data | Pointer to data buffer. |
DataLength | The length of data buffer. |
DataToggle | On input, the initial data toggle to use, also return the next toggle on output. |
TimeOut | The time to wait until timeout. |
Translator | The transaction translator for low/full speed device. |
UsbResult | The result of USB execution. |
EFI_SUCCESS | The synchronous interrupt transfer is OK. |
Others | Failed to execute the synchronous interrupt transfer. |
Definition at line 411 of file UsbUtility.c.
EFI_STATUS UsbOpenHostProtoByChild | ( | IN USB_BUS * | Bus, |
IN EFI_HANDLE | Child | ||
) |
Open the USB host controller protocol BY_CHILD.
Bus | The USB bus driver. |
Child | The child handle. |
Definition at line 471 of file UsbUtility.c.
USB_CLASS_FORMAT_DEVICE_PATH mAllUsbClassDevicePath |
Definition at line 17 of file UsbUtility.c.