]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c
modify coding style to pass ecc tool and provide comments that complied with Doxgen.
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBusDxe / UsbHub.c
index 171a780d0ccba1bf4b144342091187672578fbf6..58e0ef194f85145faca2f58e3c53f199dcf00ca7 100644 (file)
@@ -1,5 +1,7 @@
 /** @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
@@ -9,17 +11,6 @@ http://opensource.org/licenses/bsd-license.php
 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
@@ -32,16 +23,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \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
@@ -67,17 +57,16 @@ UsbHubCtrlClearHubFeature (
 \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
@@ -107,7 +96,6 @@ UsbHubCtrlClearPortFeature (
 }\r
 \r
 \r
-\r
 /**\r
   Clear the transaction translate buffer if full/low\r
   speed control/bulk transfer failed and the transfer\r
@@ -115,14 +103,14 @@ UsbHubCtrlClearPortFeature (
   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
@@ -160,17 +148,16 @@ UsbHubCtrlClearTTBuffer (
 \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
@@ -197,16 +184,15 @@ UsbHubCtrlGetHubDesc (
 \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
@@ -232,17 +218,16 @@ UsbHubCtrlGetHubStatus (
 \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
@@ -275,13 +260,13 @@ UsbHubCtrlGetPortStatus (
 \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
@@ -309,13 +294,13 @@ UsbHubCtrlResetTT (
 \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
@@ -343,17 +328,16 @@ UsbHubCtrlSetHubFeature (
 \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
@@ -386,16 +370,15 @@ UsbHubCtrlSetPortFeature (
 /**\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
@@ -427,10 +410,10 @@ UsbHubReadDesc (
   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
@@ -462,10 +445,10 @@ UsbHubAckHubStatus (
 /**\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
@@ -496,16 +479,15 @@ UsbIsHubInterface (
   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
@@ -624,15 +606,14 @@ USB_CHANGE_FEATURE_MAP  mRootHubFeatureMap[USB_ROOT_HUB_MAP_SIZE] = {
 \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
@@ -760,15 +741,14 @@ UsbHubInit (
   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
@@ -788,13 +768,12 @@ UsbHubGetPortStatus (
 /**\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
@@ -830,17 +809,16 @@ UsbHubClearPortChange (
 \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
@@ -857,17 +835,16 @@ UsbHubSetPortFeature (
 \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
@@ -884,17 +861,16 @@ UsbHubClearPortFeature (
 \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
@@ -939,14 +915,13 @@ UsbHubResetPort (
 \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
@@ -984,15 +959,14 @@ UsbHubRelease (
 \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
@@ -1054,22 +1028,20 @@ UsbRootHubInit (
 }\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
@@ -1090,14 +1062,13 @@ UsbRootHubGetPortStatus (
 /**\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
@@ -1131,19 +1102,17 @@ UsbRootHubClearPortChange (
 }\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
@@ -1160,17 +1129,16 @@ UsbRootHubSetPortFeature (
 \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
@@ -1187,19 +1155,18 @@ UsbRootHubClearPortFeature (
 \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
@@ -1295,15 +1262,14 @@ UsbRootHubResetPort (
 \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