/** @file\r
\r
+ Unified interface for RootHub and Hub.\r
+\r
Copyright (c) 2007, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
- Module Name:\r
-\r
- UsbHub.c\r
-\r
- Abstract:\r
-\r
- Unified interface for RootHub and Hub\r
-\r
- Revision History\r
-\r
-\r
**/\r
\r
#include "UsbBus.h"\r
\r
\r
/**\r
- USB hub control transfer to clear the hub feature\r
+ USB hub control transfer to clear the hub feature.\r
\r
- @param HubDev The device of the hub\r
- @param Feature The feature to clear\r
+ @param HubDev The device of the hub.\r
+ @param Feature The feature to clear.\r
\r
- @retval EFI_SUCCESS Feature of the hub is cleared\r
- @retval Others Failed to clear the feature\r
+ @retval EFI_SUCCESS Feature of the hub is cleared.\r
+ @retval Others Failed to clear the feature.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbHubCtrlClearHubFeature (\r
IN USB_DEVICE *HubDev,\r
\r
\r
/**\r
- Clear the feature of the device's port\r
+ Clear the feature of the device's port.\r
\r
- @param HubDev The hub device\r
- @param Port The port to clear feature\r
- @param Feature The feature to clear\r
+ @param HubDev The hub device.\r
+ @param Port The port to clear feature.\r
+ @param Feature The feature to clear.\r
\r
@retval EFI_SUCCESS The feature of the port is cleared.\r
@retval Others Failed to clear the feature.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbHubCtrlClearPortFeature (\r
IN USB_DEVICE *HubDev,\r
}\r
\r
\r
-\r
/**\r
Clear the transaction translate buffer if full/low\r
speed control/bulk transfer failed and the transfer\r
buffer of transaction translator, not that of the\r
parent.\r
\r
- @param HubDev The hub device\r
- @param Port The port of the hub\r
- @param DevAddr Address of the failed transaction\r
- @param EpNum The endpoint number of the failed transaction\r
- @param EpType The type of failed transaction\r
+ @param HubDev The hub device.\r
+ @param Port The port of the hub.\r
+ @param DevAddr Address of the failed transaction.\r
+ @param EpNum The endpoint number of the failed transaction.\r
+ @param EpType The type of failed transaction.\r
\r
- @retval EFI_SUCCESS The TT buffer is cleared\r
- @retval Others Failed to clear the TT buffer\r
+ @retval EFI_SUCCESS The TT buffer is cleared.\r
+ @retval Others Failed to clear the TT buffer.\r
\r
**/\r
EFI_STATUS\r
\r
\r
/**\r
- Usb hub control transfer to get the hub descriptor\r
+ Usb hub control transfer to get the hub descriptor.\r
\r
- @param HubDev The hub device\r
- @param Buf The buffer to hold the descriptor\r
- @param Len The length to retrieve\r
+ @param HubDev The hub device.\r
+ @param Buf The buffer to hold the descriptor.\r
+ @param Len The length to retrieve.\r
\r
- @retval EFI_SUCCESS The hub descriptor is retrieved\r
- @retval Others Failed to retrieve the hub descriptor\r
+ @retval EFI_SUCCESS The hub descriptor is retrieved.\r
+ @retval Others Failed to retrieve the hub descriptor.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbHubCtrlGetHubDesc (\r
IN USB_DEVICE *HubDev,\r
\r
\r
/**\r
- Usb hub control transfer to get the hub status\r
+ Usb hub control transfer to get the hub status.\r
\r
- @param HubDev The hub device\r
- @param State The variable to return the status\r
+ @param HubDev The hub device.\r
+ @param State The variable to return the status.\r
\r
- @retval EFI_SUCCESS The hub status is returned in State\r
- @retval Others Failed to get the hub status\r
+ @retval EFI_SUCCESS The hub status is returned in State.\r
+ @retval Others Failed to get the hub status.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbHubCtrlGetHubStatus (\r
IN USB_DEVICE *HubDev,\r
\r
\r
/**\r
- Usb hub control transfer to get the port status\r
+ Usb hub control transfer to get the port status.\r
\r
- @param HubDev The hub device\r
- @param Port The port of the hub\r
- @param State Variable to return the hub port state\r
+ @param HubDev The hub device.\r
+ @param Port The port of the hub.\r
+ @param State Variable to return the hub port state.\r
\r
- @retval EFI_SUCCESS The port state is returned in State\r
- @retval Others Failed to retrive the port state\r
+ @retval EFI_SUCCESS The port state is returned in State.\r
+ @retval Others Failed to retrive the port state.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbHubCtrlGetPortStatus (\r
IN USB_DEVICE *HubDev,\r
\r
\r
/**\r
- Usb hub control transfer to reset the TT (Transaction Transaltor)\r
+ Usb hub control transfer to reset the TT (Transaction Transaltor).\r
\r
- @param HubDev The hub device\r
- @param Port The port of the hub\r
+ @param HubDev The hub device.\r
+ @param Port The port of the hub.\r
\r
- @retval EFI_SUCCESS The TT of the hub is reset\r
- @retval Others Failed to reset the port\r
+ @retval EFI_SUCCESS The TT of the hub is reset.\r
+ @retval Others Failed to reset the port.\r
\r
**/\r
EFI_STATUS\r
\r
\r
/**\r
- Usb hub control transfer to set the hub feature\r
+ Usb hub control transfer to set the hub feature.\r
\r
- @param HubDev The hub device\r
- @param Feature The feature to set\r
+ @param HubDev The hub device.\r
+ @param Feature The feature to set.\r
\r
- @retval EFI_SUCESS The feature is set for the hub\r
- @retval Others Failed to set the feature\r
+ @retval EFI_SUCESS The feature is set for the hub.\r
+ @retval Others Failed to set the feature.\r
\r
**/\r
EFI_STATUS\r
\r
\r
/**\r
- Usb hub control transfer to set the port feature\r
+ Usb hub control transfer to set the port feature.\r
\r
- @param HubDev The Usb hub device\r
- @param Port The Usb port to set feature for\r
- @param Feature The feature to set\r
+ @param HubDev The Usb hub device.\r
+ @param Port The Usb port to set feature for.\r
+ @param Feature The feature to set.\r
\r
- @retval EFI_SUCCESS The feature is set for the port\r
- @retval Others Failed to set the feature\r
+ @retval EFI_SUCCESS The feature is set for the port.\r
+ @retval Others Failed to set the feature.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbHubCtrlSetPortFeature (\r
IN USB_DEVICE *HubDev,\r
/**\r
Read the whole usb hub descriptor. It is necessary\r
to do it in two steps because hub descriptor is of\r
- variable length\r
+ variable length.\r
\r
- @param HubDev The hub device\r
- @param HubDesc The variable to return the descriptor\r
+ @param HubDev The hub device.\r
+ @param HubDesc The variable to return the descriptor.\r
\r
- @retval EFI_SUCCESS The hub descriptor is read\r
- @retval Others Failed to read the hub descriptor\r
+ @retval EFI_SUCCESS The hub descriptor is read.\r
+ @retval Others Failed to read the hub descriptor.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbHubReadDesc (\r
IN USB_DEVICE *HubDev,\r
Ack the hub change bits. If these bits are not ACKed, Hub will\r
always return changed bit map from its interrupt endpoint.\r
\r
- @param HubDev The hub device\r
+ @param HubDev The hub device.\r
\r
- @retval EFI_SUCCESS The hub change status is ACKed\r
- @retval Others Failed to ACK the hub status\r
+ @retval EFI_SUCCESS The hub change status is ACKed.\r
+ @retval Others Failed to ACK the hub status.\r
\r
**/\r
EFI_STATUS\r
/**\r
Test whether the interface is a hub interface.\r
\r
- @param UsbIf The interface to test\r
+ @param UsbIf The interface to test.\r
\r
- @retval TRUE The interface is a hub interface\r
- @retval FALSE The interface isn't a hub interface\r
+ @retval TRUE The interface is a hub interface.\r
+ @retval FALSE The interface isn't a hub interface.\r
\r
**/\r
BOOLEAN\r
interrupt endpoint. It is called periodically by\r
the underlying host controller.\r
\r
- @param Data The data read\r
- @param DataLength The length of the data read\r
- @param Context The context\r
- @param Result The result of the last interrupt transfer\r
+ @param Data The data read.\r
+ @param DataLength The length of the data read.\r
+ @param Context The context.\r
+ @param Result The result of the last interrupt transfer.\r
\r
- @retval EFI_SUCCESS The process is OK\r
- @retval EFI_OUT_OF_RESOURCES Failed to allocate resource\r
+ @retval EFI_SUCCESS The process is OK.\r
+ @retval EFI_OUT_OF_RESOURCES Failed to allocate resource.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbOnHubInterrupt (\r
IN VOID *Data,\r
\r
\r
/**\r
- Initialize the device for a non-root hub\r
+ Initialize the device for a non-root hub.\r
\r
- @param HubIf The USB hub interface\r
+ @param HubIf The USB hub interface.\r
\r
- @retval EFI_SUCCESS The hub is initialized\r
- @retval EFI_DEVICE_ERROR Failed to initialize the hub\r
+ @retval EFI_SUCCESS The hub is initialized.\r
+ @retval EFI_DEVICE_ERROR Failed to initialize the hub.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbHubInit (\r
IN USB_INTERFACE *HubIf\r
the port changes in PortState. Bus enumeration code\r
doesn't need to ACK the port change bits.\r
\r
- @param HubIf The hub interface\r
- @param Port The port of the hub to get state\r
- @param PortState Variable to return the port state\r
+ @param HubIf The hub interface.\r
+ @param Port The port of the hub to get state.\r
+ @param PortState Variable to return the port state.\r
\r
- @retval EFI_SUCCESS The port status is successfully returned\r
- @retval Others Failed to return the status\r
+ @retval EFI_SUCCESS The port status is successfully returned.\r
+ @retval Others Failed to return the status.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbHubGetPortStatus (\r
IN USB_INTERFACE *HubIf,\r
/**\r
Clear the port change status.\r
\r
- @param HubIf The hub interface\r
- @param Port The hub port\r
+ @param HubIf The hub interface.\r
+ @param Port The hub port.\r
\r
- @return None\r
+ @return None.\r
\r
**/\r
-STATIC\r
VOID\r
UsbHubClearPortChange (\r
IN USB_INTERFACE *HubIf,\r
\r
\r
/**\r
- Function to set the port feature for non-root hub\r
+ Function to set the port feature for non-root hub.\r
\r
- @param HubIf The hub interface\r
- @param Port The port of the hub\r
- @param Feature The feature of the port to set\r
+ @param HubIf The hub interface.\r
+ @param Port The port of the hub.\r
+ @param Feature The feature of the port to set.\r
\r
- @retval EFI_SUCCESS The hub port feature is set\r
- @retval Others Failed to set the port feature\r
+ @retval EFI_SUCCESS The hub port feature is set.\r
+ @retval Others Failed to set the port feature.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbHubSetPortFeature (\r
IN USB_INTERFACE *HubIf,\r
\r
\r
/**\r
- Interface function to clear the port feature for non-root hub\r
+ Interface function to clear the port feature for non-root hub.\r
\r
- @param HubIf The hub interface\r
- @param Port The port of the hub to clear feature for\r
- @param Feature The feature to clear\r
+ @param HubIf The hub interface.\r
+ @param Port The port of the hub to clear feature for.\r
+ @param Feature The feature to clear.\r
\r
- @retval EFI_SUCCESS The port feature is cleared\r
- @retval Others Failed to clear the port feature\r
+ @retval EFI_SUCCESS The port feature is cleared.\r
+ @retval Others Failed to clear the port feature.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbHubClearPortFeature (\r
IN USB_INTERFACE *HubIf,\r
\r
\r
/**\r
- Interface funtion to reset the port\r
+ Interface funtion to reset the port.\r
\r
- @param HubIf The hub interface\r
- @param Port The port to reset\r
+ @param HubIf The hub interface.\r
+ @param Port The port to reset.\r
\r
- @retval EFI_SUCCESS The hub port is reset\r
- @retval EFI_TIMEOUT Failed to reset the port in time\r
- @retval Others Failed to reset the port\r
+ @retval EFI_SUCCESS The hub port is reset.\r
+ @retval EFI_TIMEOUT Failed to reset the port in time.\r
+ @retval Others Failed to reset the port.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbHubResetPort (\r
IN USB_INTERFACE *HubIf,\r
\r
\r
/**\r
- Release the hub's control of the interface\r
+ Release the hub's control of the interface.\r
\r
- @param HubIf The hub interface\r
+ @param HubIf The hub interface.\r
\r
- @retval EFI_SUCCESS The interface is release of hub control\r
+ @retval EFI_SUCCESS The interface is release of hub control.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbHubRelease (\r
IN USB_INTERFACE *HubIf\r
\r
\r
/**\r
- Initialize the interface for root hub\r
+ Initialize the interface for root hub.\r
\r
- @param HubIf The root hub interface\r
+ @param HubIf The root hub interface.\r
\r
- @retval EFI_SUCCESS The interface is initialied for root hub\r
- @retval Others Failed to initialize the hub\r
+ @retval EFI_SUCCESS The interface is initialied for root hub.\r
+ @retval Others Failed to initialize the hub.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbRootHubInit (\r
IN USB_INTERFACE *HubIf\r
}\r
\r
\r
-\r
/**\r
Get the port status. This function is required to\r
ACK the port change bits although it will return\r
the port changes in PortState. Bus enumeration code\r
doesn't need to ACK the port change bits.\r
\r
- @param HubIf The root hub interface\r
- @param Port The root hub port to get the state\r
- @param PortState Variable to return the port state\r
+ @param HubIf The root hub interface.\r
+ @param Port The root hub port to get the state.\r
+ @param PortState Variable to return the port state.\r
\r
- @retval EFI_SUCCESS The port state is returned\r
- @retval Others Failed to retrieve the port state\r
+ @retval EFI_SUCCESS The port state is returned.\r
+ @retval Others Failed to retrieve the port state.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbRootHubGetPortStatus (\r
IN USB_INTERFACE *HubIf,\r
/**\r
Clear the port change status.\r
\r
- @param HubIf The root hub interface\r
- @param Port The root hub port\r
+ @param HubIf The root hub interface.\r
+ @param Port The root hub port.\r
\r
- @retval EFI_SUCCESS The port state is returned\r
- @retval Others Failed to retrieve the port state\r
+ @retval EFI_SUCCESS The port state is returned.\r
+ @retval Others Failed to retrieve the port state.\r
\r
**/\r
-STATIC\r
VOID\r
UsbRootHubClearPortChange (\r
IN USB_INTERFACE *HubIf,\r
}\r
\r
\r
-\r
/**\r
- Set the root hub port feature\r
+ Set the root hub port feature.\r
\r
- @param HubIf The Usb hub interface\r
- @param Port The hub port\r
- @param Feature The feature to set\r
+ @param HubIf The Usb hub interface.\r
+ @param Port The hub port.\r
+ @param Feature The feature to set.\r
\r
- @retval EFI_SUCCESS The root hub port is set with the feature\r
- @retval Others Failed to set the feature\r
+ @retval EFI_SUCCESS The root hub port is set with the feature.\r
+ @retval Others Failed to set the feature.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbRootHubSetPortFeature (\r
IN USB_INTERFACE *HubIf,\r
\r
\r
/**\r
- Clear the root hub port feature\r
+ Clear the root hub port feature.\r
\r
- @param HubIf The root hub interface\r
- @param Port The root hub port\r
- @param Feature The feature to clear\r
+ @param HubIf The root hub interface.\r
+ @param Port The root hub port.\r
+ @param Feature The feature to clear.\r
\r
- @retval EFI_SUCCESS The root hub port is cleared of the feature\r
- @retval Others Failed to clear the feature\r
+ @retval EFI_SUCCESS The root hub port is cleared of the feature.\r
+ @retval Others Failed to clear the feature.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbRootHubClearPortFeature (\r
IN USB_INTERFACE *HubIf,\r
\r
\r
/**\r
- Interface funtion to reset the root hub port\r
+ Interface funtion to reset the root hub port.\r
\r
- @param RootIf The root hub interface\r
- @param Port The port to reset\r
+ @param RootIf The root hub interface.\r
+ @param Port The port to reset.\r
\r
- @retval EFI_SUCCESS The hub port is reset\r
- @retval EFI_TIMEOUT Failed to reset the port in time\r
- @retval EFI_NOT_FOUND The low/full speed device connected to high speed\r
- root hub is released to the companion UHCI\r
- @retval Others Failed to reset the port\r
+ @retval EFI_SUCCESS The hub port is reset.\r
+ @retval EFI_TIMEOUT Failed to reset the port in time.\r
+ @retval EFI_NOT_FOUND The low/full speed device connected to high speed.\r
+ root hub is released to the companion UHCI.\r
+ @retval Others Failed to reset the port.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbRootHubResetPort (\r
IN USB_INTERFACE *RootIf,\r
\r
\r
/**\r
- Release the root hub's control of the interface\r
+ Release the root hub's control of the interface.\r
\r
- @param HubIf The root hub interface\r
+ @param HubIf The root hub interface.\r
\r
@retval EFI_SUCCESS The root hub's control of the interface is\r
released.\r
\r
**/\r
-STATIC\r
EFI_STATUS\r
UsbRootHubRelease (\r
IN USB_INTERFACE *HubIf\r