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

Go to the source code of this file.

Functions

EFI_STATUS UsbHubCtrlSetHubDepth (IN USB_DEVICE *HubDev, IN UINT16 Depth)
 
EFI_STATUS UsbHubCtrlClearHubFeature (IN USB_DEVICE *HubDev, IN UINT16 Feature)
 
EFI_STATUS UsbHubCtrlClearPortFeature (IN USB_DEVICE *HubDev, IN UINT8 Port, IN UINT16 Feature)
 
EFI_STATUS UsbHubCtrlClearTTBuffer (IN USB_DEVICE *HubDev, IN UINT8 Port, IN UINT16 DevAddr, IN UINT16 EpNum, IN UINT16 EpType)
 
EFI_STATUS UsbHubCtrlGetHubDesc (IN USB_DEVICE *HubDev, OUT VOID *Buf, IN UINTN Len)
 
EFI_STATUS UsbHubCtrlGetHubStatus (IN USB_DEVICE *HubDev, OUT UINT32 *State)
 
EFI_STATUS UsbHubCtrlGetPortStatus (IN USB_DEVICE *HubDev, IN UINT8 Port, OUT VOID *State)
 
EFI_STATUS UsbHubCtrlSetPortFeature (IN USB_DEVICE *HubDev, IN UINT8 Port, IN UINT8 Feature)
 
EFI_STATUS UsbHubReadDesc (IN USB_DEVICE *HubDev, OUT EFI_USB_HUB_DESCRIPTOR *HubDesc)
 
EFI_STATUS UsbHubAckHubStatus (IN USB_DEVICE *HubDev)
 
BOOLEAN UsbIsHubInterface (IN USB_INTERFACE *UsbIf)
 
EFI_STATUS EFIAPI UsbOnHubInterrupt (IN VOID *Data, IN UINTN DataLength, IN VOID *Context, IN UINT32 Result)
 
EFI_STATUS UsbHubInit (IN USB_INTERFACE *HubIf)
 
EFI_STATUS UsbHubGetPortStatus (IN USB_INTERFACE *HubIf, IN UINT8 Port, OUT EFI_USB_PORT_STATUS *PortState)
 
VOID UsbHubClearPortChange (IN USB_INTERFACE *HubIf, IN UINT8 Port)
 
EFI_STATUS UsbHubSetPortFeature (IN USB_INTERFACE *HubIf, IN UINT8 Port, IN EFI_USB_PORT_FEATURE Feature)
 
EFI_STATUS UsbHubClearPortFeature (IN USB_INTERFACE *HubIf, IN UINT8 Port, IN EFI_USB_PORT_FEATURE Feature)
 
EFI_STATUS UsbHubResetPort (IN USB_INTERFACE *HubIf, IN UINT8 Port)
 
EFI_STATUS UsbHubRelease (IN USB_INTERFACE *HubIf)
 
EFI_STATUS UsbRootHubInit (IN USB_INTERFACE *HubIf)
 
EFI_STATUS UsbRootHubGetPortStatus (IN USB_INTERFACE *HubIf, IN UINT8 Port, OUT EFI_USB_PORT_STATUS *PortState)
 
VOID UsbRootHubClearPortChange (IN USB_INTERFACE *HubIf, IN UINT8 Port)
 
EFI_STATUS UsbRootHubSetPortFeature (IN USB_INTERFACE *HubIf, IN UINT8 Port, IN EFI_USB_PORT_FEATURE Feature)
 
EFI_STATUS UsbRootHubClearPortFeature (IN USB_INTERFACE *HubIf, IN UINT8 Port, IN EFI_USB_PORT_FEATURE Feature)
 
EFI_STATUS UsbRootHubResetPort (IN USB_INTERFACE *RootIf, IN UINT8 Port)
 
EFI_STATUS UsbRootHubRelease (IN USB_INTERFACE *HubIf)
 

Variables

USB_CHANGE_FEATURE_MAP mHubFeatureMap []
 
USB_CHANGE_FEATURE_MAP mRootHubFeatureMap []
 
USB_HUB_API mUsbHubApi
 
USB_HUB_API mUsbRootHubApi
 

Detailed Description

Unified interface for RootHub and Hub.

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

Definition in file UsbHub.c.

Function Documentation

◆ UsbHubAckHubStatus()

EFI_STATUS UsbHubAckHubStatus ( IN USB_DEVICE HubDev)

Ack the hub change bits. If these bits are not ACKed, Hub will always return changed bit map from its interrupt endpoint.

Parameters
HubDevThe hub device.
Return values
EFI_SUCCESSThe hub change status is ACKed.
OthersFailed to ACK the hub status.

Definition at line 395 of file UsbHub.c.

◆ UsbHubClearPortChange()

VOID UsbHubClearPortChange ( IN USB_INTERFACE HubIf,
IN UINT8  Port 
)

Clear the port change status.

Parameters
HubIfThe hub interface.
PortThe hub port.

Definition at line 751 of file UsbHub.c.

◆ UsbHubClearPortFeature()

EFI_STATUS UsbHubClearPortFeature ( IN USB_INTERFACE HubIf,
IN UINT8  Port,
IN EFI_USB_PORT_FEATURE  Feature 
)

Interface function to clear the port feature for non-root hub.

Parameters
HubIfThe hub interface.
PortThe port of the hub to clear feature for.
FeatureThe feature to clear.
Return values
EFI_SUCCESSThe port feature is cleared.
OthersFailed to clear the port feature.

Definition at line 819 of file UsbHub.c.

◆ UsbHubCtrlClearHubFeature()

EFI_STATUS UsbHubCtrlClearHubFeature ( IN USB_DEVICE HubDev,
IN UINT16  Feature 
)

USB hub control transfer to clear the hub feature.

Parameters
HubDevThe device of the hub.
FeatureThe feature to clear.
Return values
EFI_SUCCESSFeature of the hub is cleared.
OthersFailed to clear the feature.

Definition at line 85 of file UsbHub.c.

◆ UsbHubCtrlClearPortFeature()

EFI_STATUS UsbHubCtrlClearPortFeature ( IN USB_DEVICE HubDev,
IN UINT8  Port,
IN UINT16  Feature 
)

Clear the feature of the device's port.

Parameters
HubDevThe hub device.
PortThe port to clear feature.
FeatureThe feature to clear.
Return values
EFI_SUCCESSThe feature of the port is cleared.
OthersFailed to clear the feature.

Definition at line 119 of file UsbHub.c.

◆ UsbHubCtrlClearTTBuffer()

EFI_STATUS UsbHubCtrlClearTTBuffer ( IN USB_DEVICE HubDev,
IN UINT8  Port,
IN UINT16  DevAddr,
IN UINT16  EpNum,
IN UINT16  EpType 
)

Clear the transaction translate buffer if full/low speed control/bulk transfer failed and the transfer uses this hub as translator.Remember to clear the TT buffer of transaction translator, not that of the parent.

Parameters
HubDevThe hub device.
PortThe port of the hub.
DevAddrAddress of the failed transaction.
EpNumThe endpoint number of the failed transaction.
EpTypeThe type of failed transaction.
Return values
EFI_SUCCESSThe TT buffer is cleared.
OthersFailed to clear the TT buffer.

Definition at line 164 of file UsbHub.c.

◆ UsbHubCtrlGetHubDesc()

EFI_STATUS UsbHubCtrlGetHubDesc ( IN USB_DEVICE HubDev,
OUT VOID *  Buf,
IN UINTN  Len 
)

Usb hub control transfer to get the (super speed) hub descriptor.

Parameters
HubDevThe hub device.
BufThe buffer to hold the descriptor.
LenThe length to retrieve.
Return values
EFI_SUCCESSThe hub descriptor is retrieved.
OthersFailed to retrieve the hub descriptor.

Definition at line 208 of file UsbHub.c.

◆ UsbHubCtrlGetHubStatus()

EFI_STATUS UsbHubCtrlGetHubStatus ( IN USB_DEVICE HubDev,
OUT UINT32 *  State 
)

Usb hub control transfer to get the hub status.

Parameters
HubDevThe hub device.
StateThe variable to return the status.
Return values
EFI_SUCCESSThe hub status is returned in State.
OthersFailed to get the hub status.

Definition at line 247 of file UsbHub.c.

◆ UsbHubCtrlGetPortStatus()

EFI_STATUS UsbHubCtrlGetPortStatus ( IN USB_DEVICE HubDev,
IN UINT8  Port,
OUT VOID *  State 
)

Usb hub control transfer to get the port status.

Parameters
HubDevThe hub device.
PortThe port of the hub.
StateVariable to return the hub port state.
Return values
EFI_SUCCESSThe port state is returned in State.
OthersFailed to retrieve the port state.

Definition at line 281 of file UsbHub.c.

◆ UsbHubCtrlSetHubDepth()

EFI_STATUS UsbHubCtrlSetHubDepth ( IN USB_DEVICE HubDev,
IN UINT16  Depth 
)

USB hub control transfer to set the hub depth.

Parameters
HubDevThe device of the hub.
DepthThe depth to set.
Return values
EFI_SUCCESSDepth of the hub is set.
OthersFailed to set the depth.

Definition at line 52 of file UsbHub.c.

◆ UsbHubCtrlSetPortFeature()

EFI_STATUS UsbHubCtrlSetPortFeature ( IN USB_DEVICE HubDev,
IN UINT8  Port,
IN UINT8  Feature 
)

Usb hub control transfer to set the port feature.

Parameters
HubDevThe Usb hub device.
PortThe Usb port to set feature for.
FeatureThe feature to set.
Return values
EFI_SUCCESSThe feature is set for the port.
OthersFailed to set the feature.

Definition at line 322 of file UsbHub.c.

◆ UsbHubGetPortStatus()

EFI_STATUS UsbHubGetPortStatus ( IN USB_INTERFACE HubIf,
IN UINT8  Port,
OUT EFI_USB_PORT_STATUS PortState 
)

Get the port status. This function is required to ACK the port change bits although it will return the port changes in PortState. Bus enumeration code doesn't need to ACK the port change bits.

Parameters
HubIfThe hub interface.
PortThe port of the hub to get state.
PortStateVariable to return the port state.
Return values
EFI_SUCCESSThe port status is successfully returned.
OthersFailed to return the status.

Definition at line 730 of file UsbHub.c.

◆ UsbHubInit()

EFI_STATUS UsbHubInit ( IN USB_INTERFACE HubIf)

Initialize the device for a non-root hub.

Parameters
HubIfThe USB hub interface.
Return values
EFI_SUCCESSThe hub is initialized.
EFI_DEVICE_ERRORFailed to initialize the hub.

Definition at line 563 of file UsbHub.c.

◆ UsbHubReadDesc()

EFI_STATUS UsbHubReadDesc ( IN USB_DEVICE HubDev,
OUT EFI_USB_HUB_DESCRIPTOR HubDesc 
)

Read the whole usb hub descriptor. It is necessary to do it in two steps because hub descriptor is of variable length.

Parameters
HubDevThe hub device.
HubDescThe variable to return the descriptor.
Return values
EFI_SUCCESSThe hub descriptor is read.
OthersFailed to read the hub descriptor.

Definition at line 362 of file UsbHub.c.

◆ UsbHubRelease()

EFI_STATUS UsbHubRelease ( IN USB_INTERFACE HubIf)

Release the hub's control of the interface.

Parameters
HubIfThe hub interface.
Return values
EFI_SUCCESSThe interface is release of hub control.

Definition at line 899 of file UsbHub.c.

◆ UsbHubResetPort()

EFI_STATUS UsbHubResetPort ( IN USB_INTERFACE HubIf,
IN UINT8  Port 
)

Interface function to reset the port.

Parameters
HubIfThe hub interface.
PortThe port to reset.
Return values
EFI_SUCCESSThe hub port is reset.
EFI_TIMEOUTFailed to reset the port in time.
OthersFailed to reset the port.

Definition at line 844 of file UsbHub.c.

◆ UsbHubSetPortFeature()

EFI_STATUS UsbHubSetPortFeature ( IN USB_INTERFACE HubIf,
IN UINT8  Port,
IN EFI_USB_PORT_FEATURE  Feature 
)

Function to set the port feature for non-root hub.

Parameters
HubIfThe hub interface.
PortThe port of the hub.
FeatureThe feature of the port to set.
Return values
EFI_SUCCESSThe hub port feature is set.
OthersFailed to set the port feature.

Definition at line 794 of file UsbHub.c.

◆ UsbIsHubInterface()

BOOLEAN UsbIsHubInterface ( IN USB_INTERFACE UsbIf)

Test whether the interface is a hub interface.

Parameters
UsbIfThe interface to test.
Return values
TRUEThe interface is a hub interface.
FALSEThe interface isn't a hub interface.

Definition at line 429 of file UsbHub.c.

◆ UsbOnHubInterrupt()

EFI_STATUS EFIAPI UsbOnHubInterrupt ( IN VOID *  Data,
IN UINTN  DataLength,
IN VOID *  Context,
IN UINT32  Result 
)

The callback function to the USB hub status change interrupt endpoint. It is called periodically by the underlying host controller.

Parameters
DataThe data read.
DataLengthThe length of the data read.
ContextThe context.
ResultThe result of the last interrupt transfer.
Return values
EFI_SUCCESSThe process is OK.
EFI_OUT_OF_RESOURCESFailed to allocate resource.

Definition at line 466 of file UsbHub.c.

◆ UsbRootHubClearPortChange()

VOID UsbRootHubClearPortChange ( IN USB_INTERFACE HubIf,
IN UINT8  Port 
)

Clear the port change status.

Parameters
HubIfThe root hub interface.
PortThe root hub port.

Definition at line 1044 of file UsbHub.c.

◆ UsbRootHubClearPortFeature()

EFI_STATUS UsbRootHubClearPortFeature ( IN USB_INTERFACE HubIf,
IN UINT8  Port,
IN EFI_USB_PORT_FEATURE  Feature 
)

Clear the root hub port feature.

Parameters
HubIfThe root hub interface.
PortThe root hub port.
FeatureThe feature to clear.
Return values
EFI_SUCCESSThe root hub port is cleared of the feature.
OthersFailed to clear the feature.

Definition at line 1112 of file UsbHub.c.

◆ UsbRootHubGetPortStatus()

EFI_STATUS UsbRootHubGetPortStatus ( IN USB_INTERFACE HubIf,
IN UINT8  Port,
OUT EFI_USB_PORT_STATUS PortState 
)

Get the port status. This function is required to ACK the port change bits although it will return the port changes in PortState. Bus enumeration code doesn't need to ACK the port change bits.

Parameters
HubIfThe root hub interface.
PortThe root hub port to get the state.
PortStateVariable to return the port state.
Return values
EFI_SUCCESSThe port state is returned.
OthersFailed to retrieve the port state.

Definition at line 1021 of file UsbHub.c.

◆ UsbRootHubInit()

EFI_STATUS UsbRootHubInit ( IN USB_INTERFACE HubIf)

Initialize the interface for root hub.

Parameters
HubIfThe root hub interface.
Return values
EFI_SUCCESSThe interface is initialized for root hub.
OthersFailed to initialize the hub.

Definition at line 942 of file UsbHub.c.

◆ UsbRootHubRelease()

EFI_STATUS UsbRootHubRelease ( IN USB_INTERFACE HubIf)

Release the root hub's control of the interface.

Parameters
HubIfThe root hub interface.
Return values
EFI_SUCCESSThe root hub's control of the interface is released.

Definition at line 1240 of file UsbHub.c.

◆ UsbRootHubResetPort()

EFI_STATUS UsbRootHubResetPort ( IN USB_INTERFACE RootIf,
IN UINT8  Port 
)

Interface function to reset the root hub port.

Parameters
RootIfThe root hub interface.
PortThe port to reset.
Return values
EFI_SUCCESSThe hub port is reset.
EFI_TIMEOUTFailed to reset the port in time.
EFI_NOT_FOUNDThe low/full speed device connected to high speed. root hub is released to the companion UHCI.
OthersFailed to reset the port.

Definition at line 1139 of file UsbHub.c.

◆ UsbRootHubSetPortFeature()

EFI_STATUS UsbRootHubSetPortFeature ( IN USB_INTERFACE HubIf,
IN UINT8  Port,
IN EFI_USB_PORT_FEATURE  Feature 
)

Set the root hub port feature.

Parameters
HubIfThe Usb hub interface.
PortThe hub port.
FeatureThe feature to set.
Return values
EFI_SUCCESSThe root hub port is set with the feature.
OthersFailed to set the feature.

Definition at line 1087 of file UsbHub.c.

Variable Documentation

◆ mHubFeatureMap

USB_CHANGE_FEATURE_MAP mHubFeatureMap[]
Initial value:
= {
{ USB_PORT_STAT_C_CONNECTION, EfiUsbPortConnectChange },
{ USB_PORT_STAT_C_ENABLE, EfiUsbPortEnableChange },
{ USB_PORT_STAT_C_SUSPEND, EfiUsbPortSuspendChange },
{ USB_PORT_STAT_C_OVERCURRENT, EfiUsbPortOverCurrentChange },
{ USB_PORT_STAT_C_RESET, EfiUsbPortResetChange }
}
#define USB_PORT_STAT_C_CONNECTION

Definition at line 19 of file UsbHub.c.

◆ mRootHubFeatureMap

USB_CHANGE_FEATURE_MAP mRootHubFeatureMap[]
Initial value:
= {
{ USB_PORT_STAT_C_CONNECTION, EfiUsbPortConnectChange },
{ USB_PORT_STAT_C_ENABLE, EfiUsbPortEnableChange },
{ USB_PORT_STAT_C_SUSPEND, EfiUsbPortSuspendChange },
{ USB_PORT_STAT_C_OVERCURRENT, EfiUsbPortOverCurrentChange },
{ USB_PORT_STAT_C_RESET, EfiUsbPortResetChange },
}

Definition at line 27 of file UsbHub.c.

◆ mUsbHubApi

USB_HUB_API mUsbHubApi
Initial value:
= {
}
EFI_STATUS UsbHubInit(IN USB_INTERFACE *HubIf)
Definition: UsbHub.c:563
EFI_STATUS UsbHubResetPort(IN USB_INTERFACE *HubIf, IN UINT8 Port)
Definition: UsbHub.c:844
EFI_STATUS UsbHubClearPortFeature(IN USB_INTERFACE *HubIf, IN UINT8 Port, IN EFI_USB_PORT_FEATURE Feature)
Definition: UsbHub.c:819
EFI_STATUS UsbHubRelease(IN USB_INTERFACE *HubIf)
Definition: UsbHub.c:899
EFI_STATUS UsbHubGetPortStatus(IN USB_INTERFACE *HubIf, IN UINT8 Port, OUT EFI_USB_PORT_STATUS *PortState)
Definition: UsbHub.c:730
EFI_STATUS UsbHubSetPortFeature(IN USB_INTERFACE *HubIf, IN UINT8 Port, IN EFI_USB_PORT_FEATURE Feature)
Definition: UsbHub.c:794
VOID UsbHubClearPortChange(IN USB_INTERFACE *HubIf, IN UINT8 Port)
Definition: UsbHub.c:751

Definition at line 1252 of file UsbHub.c.

◆ mUsbRootHubApi

USB_HUB_API mUsbRootHubApi
Initial value:
= {
}
EFI_STATUS UsbRootHubResetPort(IN USB_INTERFACE *RootIf, IN UINT8 Port)
Definition: UsbHub.c:1139
EFI_STATUS UsbRootHubClearPortFeature(IN USB_INTERFACE *HubIf, IN UINT8 Port, IN EFI_USB_PORT_FEATURE Feature)
Definition: UsbHub.c:1112
EFI_STATUS UsbRootHubGetPortStatus(IN USB_INTERFACE *HubIf, IN UINT8 Port, OUT EFI_USB_PORT_STATUS *PortState)
Definition: UsbHub.c:1021
EFI_STATUS UsbRootHubInit(IN USB_INTERFACE *HubIf)
Definition: UsbHub.c:942
VOID UsbRootHubClearPortChange(IN USB_INTERFACE *HubIf, IN UINT8 Port)
Definition: UsbHub.c:1044
EFI_STATUS UsbRootHubRelease(IN USB_INTERFACE *HubIf)
Definition: UsbHub.c:1240
EFI_STATUS UsbRootHubSetPortFeature(IN USB_INTERFACE *HubIf, IN UINT8 Port, IN EFI_USB_PORT_FEATURE Feature)
Definition: UsbHub.c:1087

Definition at line 1262 of file UsbHub.c.