]> git.proxmox.com Git - mirror_edk2.git/commitdiff
modify coding style to pass ecc tool and provide comments that complied with Doxgen.
authoreric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 9 Jul 2008 10:02:26 +0000 (10:02 +0000)
committereric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 9 Jul 2008 10:02:26 +0000 (10:02 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5436 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Bus/Usb/UsbBusDxe/ComponentName.c
MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.h
MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c
MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.h
MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.h
MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c
MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.h
MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c
MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.h

index ece469f00200f3a396c215d83b59f189cd1fb8b3..529c76c5412b90dabd3c6fbc2910b70deb57d321 100644 (file)
@@ -1,5 +1,7 @@
 /** @file\r
 \r
+  UEFI Component Name(2) protocol implementation for Usb Bus driver.\r
+\r
 Copyright (c) 2004 - 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,13 +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
-  ComponentName.c\r
-\r
-Abstract:\r
-\r
-\r
 **/\r
 \r
 \r
@@ -25,9 +20,6 @@ Abstract:
 #include <Library/UefiLib.h>\r
 \r
 \r
-//\r
-// EFI Component Name Functions\r
-//\r
 /**\r
   Retrieves a Unicode string that is the user readable name of the driver.\r
 \r
index f2b7f8bd9391d4da3b5b500311028119098beabb..13038fa8af163c9a3f372e79f75721844a03c677 100644 (file)
@@ -1,5 +1,7 @@
 /** @file\r
 \r
+    Usb Bus Driver Binding and Bus IO Protocol.\r
+\r
 Copyright (c) 2004 - 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
-    UsbBus.c\r
-\r
-  Abstract:\r
-\r
-    Usb Bus Driver Binding and Bus IO Protocol\r
-\r
-  Revision History\r
-\r
-\r
 **/\r
 \r
 #include "UsbBus.h"\r
@@ -49,7 +40,6 @@ EFI_GUID  mUsbBusProtocolGuid = EFI_USB_BUS_PROTOCOL_GUID;
   @retval Others                 Failed to execute the transfer\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoControlTransfer (\r
@@ -191,22 +181,21 @@ ON_EXIT:
 \r
 \r
 /**\r
-  Execute a bulk transfer to the device endpoint\r
+  Execute a bulk transfer to the device endpoint.\r
 \r
-  @param  This                   The USB IO instance\r
-  @param  Endpoint               The device endpoint\r
-  @param  Data                   The data to transfer\r
-  @param  DataLength             The length of the data to transfer\r
-  @param  Timeout                Time to wait before timeout\r
-  @param  UsbStatus              The result of USB transfer\r
+  @param  This                   The USB IO instance.\r
+  @param  Endpoint               The device endpoint.\r
+  @param  Data                   The data to transfer.\r
+  @param  DataLength             The length of the data to transfer.\r
+  @param  Timeout                Time to wait before timeout.\r
+  @param  UsbStatus              The result of USB transfer.\r
 \r
-  @retval EFI_SUCCESS            The bulk transfer is OK\r
-  @retval EFI_INVALID_PARAMETER  Some parameters are invalid\r
+  @retval EFI_SUCCESS            The bulk transfer is OK.\r
+  @retval EFI_INVALID_PARAMETER  Some parameters are invalid.\r
   @retval Others                 Failed to execute transfer, reason returned in\r
-                                 UsbStatus\r
+                                 UsbStatus.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoBulkTransfer (\r
@@ -286,22 +275,21 @@ ON_EXIT:
 \r
 \r
 /**\r
-  Execute a synchronous interrupt transfer\r
+  Execute a synchronous interrupt transfer.\r
 \r
-  @param  This                   The USB IO instance\r
-  @param  Endpoint               The device endpoint\r
-  @param  Data                   The data to transfer\r
-  @param  DataLength             The length of the data to transfer\r
-  @param  Timeout                Time to wait before timeout\r
-  @param  UsbStatus              The result of USB transfer\r
+  @param  This                   The USB IO instance.\r
+  @param  Endpoint               The device endpoint.\r
+  @param  Data                   The data to transfer.\r
+  @param  DataLength             The length of the data to transfer.\r
+  @param  Timeout                Time to wait before timeout.\r
+  @param  UsbStatus              The result of USB transfer.\r
 \r
-  @retval EFI_SUCCESS            The synchronous interrupt transfer is OK\r
-  @retval EFI_INVALID_PARAMETER  Some parameters are invalid\r
+  @retval EFI_SUCCESS            The synchronous interrupt transfer is OK.\r
+  @retval EFI_INVALID_PARAMETER  Some parameters are invalid.\r
   @retval Others                 Failed to execute transfer, reason returned in\r
-                                 UsbStatus\r
+                                 UsbStatus.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoSyncInterruptTransfer (\r
@@ -363,25 +351,24 @@ ON_EXIT:
 \r
 /**\r
   Queue a new asynchronous interrupt transfer, or remove the old\r
-  request if (IsNewTransfer == FALSE)\r
+  request if (IsNewTransfer == FALSE).\r
 \r
-  @param  This                   The USB_IO instance\r
-  @param  Endpoint               The device endpoint\r
+  @param  This                   The USB_IO instance.\r
+  @param  Endpoint               The device endpoint.\r
   @param  IsNewTransfer          Whether this is a new request, if it's old, remove\r
-                                 the request\r
-  @param  PollInterval           The interval to poll the transfer result, (in ms)\r
-  @param  DataLength             The length of perodic data transfer\r
+                                 the request.\r
+  @param  PollInterval           The interval to poll the transfer result, (in ms).\r
+  @param  DataLength             The length of perodic data transfer.\r
   @param  Callback               The function to call periodicaly when transfer is\r
-                                 ready\r
-  @param  Context                The context to the callback\r
+                                 ready.\r
+  @param  Context                The context to the callback.\r
 \r
-  @retval EFI_SUCCESS            New transfer is queued or old request is removed\r
-  @retval EFI_INVALID_PARAMETER  Some parameters are invalid\r
+  @retval EFI_SUCCESS            New transfer is queued or old request is removed.\r
+  @retval EFI_INVALID_PARAMETER  Some parameters are invalid.\r
   @retval Others                 Failed to queue the new request or remove the old\r
-                                 request\r
+                                 request.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoAsyncInterruptTransfer (\r
@@ -441,18 +428,17 @@ ON_EXIT:
 \r
 \r
 /**\r
-  Execute a synchronous isochronous transfer\r
+  Execute a synchronous isochronous transfer.\r
 \r
-  @param  This                   The USB IO instance\r
-  @param  DeviceEndpoint         The device endpoint\r
-  @param  Data                   The data to transfer\r
-  @param  DataLength             The length of the data to transfer\r
-  @param  UsbStatus              The result of USB transfer\r
+  @param  This                   The USB IO instance.\r
+  @param  DeviceEndpoint         The device endpoint.\r
+  @param  Data                   The data to transfer.\r
+  @param  DataLength             The length of the data to transfer.\r
+  @param  UsbStatus              The result of USB transfer.\r
 \r
-  @retval EFI_UNSUPPORTED        Currently isochronous transfer isn't supported\r
+  @retval EFI_UNSUPPORTED        Currently isochronous transfer isn't supported.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoIsochronousTransfer (\r
@@ -468,19 +454,19 @@ UsbIoIsochronousTransfer (
 \r
 \r
 /**\r
-  Queue an asynchronous isochronous transfer\r
+  Queue an asynchronous isochronous transfer.\r
 \r
-  @param  This                   The USB_IO instance\r
-  @param  DeviceEndpoint         The device endpoint\r
-  @param  DataLength             The length of perodic data transfer\r
+  @param  This                   The USB_IO instance.\r
+  @param  DeviceEndpoint         The device endpoint.\r
+  @param  Data                   The data to transfer.\r
+  @param  DataLength             The length of perodic data transfer.\r
   @param  IsochronousCallBack    The function to call periodicaly when transfer is\r
-                                 ready\r
-  @param  Context                The context to the callback\r
+                                 ready.\r
+  @param  Context                The context to the callback.\r
 \r
-  @retval EFI_UNSUPPORTED        Currently isochronous transfer isn't supported\r
+  @retval EFI_UNSUPPORTED        Currently isochronous transfer isn't supported.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoAsyncIsochronousTransfer (\r
@@ -497,16 +483,15 @@ UsbIoAsyncIsochronousTransfer (
 \r
 \r
 /**\r
-  Retrieve the device descriptor of the device\r
+  Retrieve the device descriptor of the device.\r
 \r
-  @param  This                   The USB IO instance\r
-  @param  Descriptor             The variable to receive the device descriptor\r
+  @param  This                   The USB IO instance.\r
+  @param  Descriptor             The variable to receive the device descriptor.\r
 \r
-  @retval EFI_SUCCESS            The device descriptor is returned\r
-  @retval EFI_INVALID_PARAMETER  The parameter is invalid\r
+  @retval EFI_SUCCESS            The device descriptor is returned.\r
+  @retval EFI_INVALID_PARAMETER  The parameter is invalid.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoGetDeviceDescriptor (\r
@@ -535,17 +520,16 @@ UsbIoGetDeviceDescriptor (
 \r
 \r
 /**\r
-  Return the configuration descriptor of the current active configuration\r
+  Return the configuration descriptor of the current active configuration.\r
 \r
-  @param  This                   The USB IO instance\r
-  @param  Descriptor             The USB configuration descriptor\r
+  @param  This                   The USB IO instance.\r
+  @param  Descriptor             The USB configuration descriptor.\r
 \r
-  @retval EFI_SUCCESS            The active configuration descriptor is returned\r
-  @retval EFI_INVALID_PARAMETER  Some parameter is invalid\r
+  @retval EFI_SUCCESS            The active configuration descriptor is returned.\r
+  @retval EFI_INVALID_PARAMETER  Some parameter is invalid.\r
   @retval EFI_NOT_FOUND          Currently no active configuration is selected.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoGetActiveConfigDescriptor (\r
@@ -582,16 +566,15 @@ ON_EXIT:
 \r
 \r
 /**\r
-  Retrieve the active interface setting descriptor for this USB IO instance\r
+  Retrieve the active interface setting descriptor for this USB IO instance.\r
 \r
-  @param  This                   The USB IO instance\r
-  @param  Descriptor             The variable to receive active interface setting\r
+  @param  This                   The USB IO instance.\r
+  @param  Descriptor             The variable to receive active interface setting.\r
 \r
-  @retval EFI_SUCCESS            The active interface setting is returned\r
-  @retval EFI_INVALID_PARAMETER  Some parameter is invalid\r
+  @retval EFI_SUCCESS            The active interface setting is returned.\r
+  @retval EFI_INVALID_PARAMETER  Some parameter is invalid.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoGetInterfaceDescriptor (\r
@@ -617,18 +600,17 @@ UsbIoGetInterfaceDescriptor (
 \r
 \r
 /**\r
-  Retrieve the endpoint descriptor from this interface setting\r
+  Retrieve the endpoint descriptor from this interface setting.\r
 \r
-  @param  This                   The USB IO instance\r
+  @param  This                   The USB IO instance.\r
   @param  Index                  The index (start from zero) of the endpoint to\r
-                                 retrieve\r
-  @param  Descriptor             The variable to receive the descriptor\r
+                                 retrieve.\r
+  @param  Descriptor             The variable to receive the descriptor.\r
 \r
-  @retval EFI_SUCCESS            The endpoint descriptor is returned\r
-  @retval EFI_INVALID_PARAMETER  Some parameter is invalid\r
+  @retval EFI_SUCCESS            The endpoint descriptor is returned.\r
+  @retval EFI_INVALID_PARAMETER  Some parameter is invalid.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoGetEndpointDescriptor (\r
@@ -666,16 +648,15 @@ UsbIoGetEndpointDescriptor (
 \r
 \r
 /**\r
-  Retrieve the supported language ID table from the device\r
+  Retrieve the supported language ID table from the device.\r
 \r
-  @param  This                   The USB IO instance\r
-  @param  LangIDTable            The table to return the language IDs\r
-  @param  TableSize              The number of supported languanges\r
+  @param  This                   The USB IO instance.\r
+  @param  LangIDTable            The table to return the language IDs.\r
+  @param  TableSize              The number of supported languanges.\r
 \r
-  @retval EFI_SUCCESS            The language ID is return\r
+  @retval EFI_SUCCESS            The language ID is return.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoGetSupportedLanguages (\r
@@ -702,18 +683,17 @@ UsbIoGetSupportedLanguages (
 \r
 \r
 /**\r
-  Retrieve an indexed string in the language of LangID\r
+  Retrieve an indexed string in the language of LangID.\r
 \r
-  @param  This                   The USB IO instance\r
-  @param  LangID                 The language ID of the string to retrieve\r
-  @param  StringIndex            The index of the string\r
-  @param  String                 The variable to receive the string\r
+  @param  This                   The USB IO instance.\r
+  @param  LangID                 The language ID of the string to retrieve.\r
+  @param  StringIndex            The index of the string.\r
+  @param  String                 The variable to receive the string.\r
 \r
-  @retval EFI_SUCCESS            The string is returned\r
-  @retval EFI_NOT_FOUND          No such string existed\r
+  @retval EFI_SUCCESS            The string is returned.\r
+  @retval EFI_NOT_FOUND          No such string existed.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 UsbIoGetStringDescriptor (\r
@@ -793,10 +773,10 @@ ON_EXIT:
   Reset the device, then if that succeeds, reconfigure the\r
   device with its address and current active configuration.\r
 \r
-  @param  This                   The USB IO instance\r
+  @param  This                   The USB IO instance.\r
 \r
-  @retval EFI_SUCCESS            The device is reset and configured\r
-  @retval Others                 Failed to reset the device\r
+  @retval EFI_SUCCESS            The device is reset and configured.\r
+  @retval Others                 Failed to reset the device.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -873,15 +853,15 @@ ON_EXIT:
 \r
 \r
 /**\r
-  Install Usb Bus Protocol on host controller, and start the Usb bus\r
+  Install Usb Bus Protocol on host controller, and start the Usb bus.\r
 \r
-  @param This                    The USB bus driver binding instance\r
-  @param Controller              The controller to check\r
-  @param RemainingDevicePath     The remaining device patch\r
+  @param This                    The USB bus driver binding instance.\r
+  @param Controller              The controller to check.\r
+  @param RemainingDevicePath     The remaining device patch.\r
 \r
-  @retval EFI_SUCCESS            The controller is controlled by the usb bus\r
-  @retval EFI_ALREADY_STARTED    The controller is already controlled by the usb bus\r
-  @retval EFI_OUT_OF_RESOURCES   Failed to allocate resources\r
+  @retval EFI_SUCCESS            The controller is controlled by the usb bus.\r
+  @retval EFI_ALREADY_STARTED    The controller is already controlled by the usb bus.\r
+  @retval EFI_OUT_OF_RESOURCES   Failed to allocate resources.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1074,29 +1054,22 @@ EFI_USB_IO_PROTOCOL mUsbIoProtocol = {
 };\r
 \r
 \r
+/**\r
+  The USB bus driver entry pointer.\r
+\r
+  @param ImageHandle       The driver image handle.\r
+  @param SystemTable       The system table.\r
+\r
+  @return EFI_SUCCESS      The component name protocol is installed.\r
+  @return Others           Failed to init the usb driver.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbBusDriverEntryPoint (\r
   IN EFI_HANDLE           ImageHandle,\r
   IN EFI_SYSTEM_TABLE     *SystemTable\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  The USB bus driver entry pointer\r
-\r
-Arguments:\r
-\r
-  ImageHandle - The driver image handle\r
-  SystemTable - The system table\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS - The component name protocol is installed\r
-  Others      - Failed to init the usb driver\r
-\r
---*/\r
 {\r
   return EfiLibInstallDriverBindingComponentName2 (\r
            ImageHandle,\r
@@ -1110,14 +1083,14 @@ Returns:
 \r
 \r
 /**\r
-  Check whether USB bus driver support this device\r
+  Check whether USB bus driver support this device.\r
 \r
-  @param  This                   The USB bus driver binding protocol\r
-  @param  Controller             The controller handle to test againist\r
-  @param  RemainingDevicePath    The remaining device path\r
+  @param  This                   The USB bus driver binding protocol.\r
+  @param  Controller             The controller handle to test againist.\r
+  @param  RemainingDevicePath    The remaining device path.\r
 \r
   @retval EFI_SUCCESS            The bus supports this controller.\r
-  @retval EFI_UNSUPPORTED        This device isn't supported\r
+  @retval EFI_UNSUPPORTED        This device isn't supported.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1231,16 +1204,16 @@ UsbBusControllerDriverSupported (
 \r
 \r
 /**\r
-  Start to process the controller\r
+  Start to process the controller.\r
 \r
-  @param  This                   The USB bus driver binding instance\r
-  @param  Controller             The controller to check\r
-  @param  RemainingDevicePath    The remaining device patch\r
+  @param  This                   The USB bus driver binding instance.\r
+  @param  Controller             The controller to check.\r
+  @param  RemainingDevicePath    The remaining device patch.\r
 \r
-  @retval EFI_SUCCESS            The controller is controlled by the usb bus\r
+  @retval EFI_SUCCESS            The controller is controlled by the usb bus.\r
   @retval EFI_ALREADY_STARTED    The controller is already controlled by the usb\r
-                                 bus\r
-  @retval EFI_OUT_OF_RESOURCES   Failed to allocate resources\r
+                                 bus.\r
+  @retval EFI_OUT_OF_RESOURCES   Failed to allocate resources.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1312,16 +1285,16 @@ UsbBusControllerDriverStart (
 \r
 \r
 /**\r
-  Stop handle the controller by this USB bus driver\r
+  Stop handle the controller by this USB bus driver.\r
 \r
-  @param  This                   The USB bus driver binding protocol\r
-  @param  Controller             The controller to release\r
+  @param  This                   The USB bus driver binding protocol.\r
+  @param  Controller             The controller to release.\r
   @param  NumberOfChildren       The child of USB bus that opened controller\r
-                                 BY_CHILD\r
-  @param  ChildHandleBuffer      The array of child handle\r
+                                 BY_CHILD.\r
+  @param  ChildHandleBuffer      The array of child handle.\r
 \r
-  @retval EFI_SUCCESS            The controller or children are stopped\r
-  @retval EFI_DEVICE_ERROR       Failed to stop the driver\r
+  @retval EFI_SUCCESS            The controller or children are stopped.\r
+  @retval EFI_DEVICE_ERROR       Failed to stop the driver.\r
 \r
 **/\r
 EFI_STATUS\r
index 21d1b304bf80d36146153957500154c62bd10f55..4bee1836f9abcb9f33f254beeaeaca2f2a03fae0 100644 (file)
@@ -1,4 +1,7 @@
 /** @file\r
+\r
+    Usb Bus Driver Binding and Bus IO Protocol.\r
+\r
 Copyright (c) 2004 - 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
@@ -8,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
-    UsbBus.h\r
-\r
-  Abstract:\r
-\r
-    Usb Bus Driver Binding and Bus IO Protocol\r
-\r
-  Revision History\r
-\r
-\r
 **/\r
 \r
 #ifndef _EFI_USB_BUS_H_\r
@@ -55,7 +47,7 @@ typedef struct _USB_HUB_API    USB_HUB_API;
 #include "UsbHub.h"\r
 #include "UsbEnumer.h"\r
 \r
-enum {\r
+typedef enum {\r
   USB_MAX_LANG_ID           = 16,\r
   USB_MAX_INTERFACE         = 16,\r
   USB_MAX_DEVICES           = 128,\r
@@ -125,17 +117,17 @@ enum {
   //\r
   // Send clear feature request timeout, set by experience\r
   //\r
-  USB_CLEAR_FEATURE_REQUEST_TIMEOUT  = 10 * USB_BUS_1_MILLISECOND,\r
+  USB_CLEAR_FEATURE_REQUEST_TIMEOUT  = 10 * USB_BUS_1_MILLISECOND\r
+}USB_BUS_TIMEOUT_EXPERIENCE_VALUE;\r
 \r
-  //\r
-  // Bus raises TPL to TPL_NOTIFY to serialize all its operations\r
-  // to protect shared data structures.\r
-  //\r
-  USB_BUS_TPL               = TPL_NOTIFY,\r
+//\r
+// Bus raises TPL to TPL_NOTIFY to serialize all its operations\r
+// to protect shared data structures.\r
+//\r
+#define  USB_BUS_TPL               TPL_NOTIFY\r
 \r
-  USB_INTERFACE_SIGNATURE   = EFI_SIGNATURE_32 ('U', 'S', 'B', 'I'),\r
-  USB_BUS_SIGNATURE         = EFI_SIGNATURE_32 ('U', 'S', 'B', 'B')\r
-};\r
+#define  USB_INTERFACE_SIGNATURE   EFI_SIGNATURE_32 ('U', 'S', 'B', 'I')\r
+#define  USB_BUS_SIGNATURE         EFI_SIGNATURE_32 ('U', 'S', 'B', 'B')\r
 \r
 #define USB_BIT(a)                  ((UINTN)(1 << (a)))\r
 #define USB_BIT_IS_SET(Data, Bit)   ((BOOLEAN)(((Data) & (Bit)) == (Bit)))\r
@@ -279,12 +271,32 @@ typedef struct {
   EFI_DEVICE_PATH_PROTOCOL        End;\r
 } USB_CLASS_FORMAT_DEVICE_PATH;\r
 \r
+/**\r
+  Free a DEVICE_PATH_LIST_ITEM list.\r
+\r
+  @param  UsbIoDPList            a DEVICE_PATH_LIST_ITEM list pointer.\r
+\r
+  @retval EFI_INVALID_PARAMETER  If parameters are invalid, return this value.\r
+  @retval EFI_SUCCESS            If free operation is successful, return this value.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbBusFreeUsbDPList (\r
   IN     LIST_ENTRY                                 *UsbIoDPList\r
   );\r
 \r
+/**\r
+  Store a wanted usb child device info (its Usb part of device path) which is indicated by\r
+  RemainingDevicePath in a Usb bus which  is indicated by UsbBusId.\r
+\r
+  @param  UsbBusId               Point to EFI_USB_BUS_PROTOCOL interface.\r
+  @param  RemainingDevicePath    The remaining device patch.\r
+\r
+  @retval EFI_SUCCESS            Add operation is successful.\r
+  @retval EFI_INVALID_PARAMETER  The parameters are invalid.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbBusAddWantedUsbIoDP (\r
@@ -292,6 +304,16 @@ UsbBusAddWantedUsbIoDP (
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
   );\r
 \r
+/**\r
+  Check whether a usb child device is the wanted device in a bus.\r
+\r
+  @param  Bus     The Usb bus's private data pointer.\r
+  @param  UsbIf   The usb child device inferface.\r
+\r
+  @retval True    If a usb child device is the wanted device in a bus.\r
+  @retval False   If a usb child device is *NOT* the wanted device in a bus.\r
+\r
+**/\r
 BOOLEAN\r
 EFIAPI\r
 UsbBusIsWantedUsbIO (\r
@@ -299,6 +321,16 @@ UsbBusIsWantedUsbIO (
   IN USB_INTERFACE           *UsbIf\r
   );\r
 \r
+/**\r
+  Recursively connnect every wanted usb child device to ensure they all fully connected.\r
+  Check all the child Usb IO handles in this bus, recursively connecte if it is wanted usb child device.\r
+\r
+  @param  UsbBusId                  Point to EFI_USB_BUS_PROTOCOL interface.\r
+\r
+  @retval EFI_SUCCESS               Connect is done successfully.\r
+  @retval EFI_INVALID_PARAMETER     The parameter is invalid.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 UsbBusRecursivelyConnectWantedUsbIo (\r
index c9e1755fded79eb2c573d762c02655f54ee13657..269dcbf81bc9aa8ce2a91b18eb0f802d06b916d2 100644 (file)
@@ -1,5 +1,7 @@
 /** @file\r
 \r
+    Manage Usb Descriptor List\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,31 +11,19 @@ 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
-    UsbDesc.c\r
-\r
-  Abstract:\r
-\r
-    Manage Usb Descriptor List\r
-\r
-  Revision History\r
-\r
-\r
 **/\r
 \r
 #include "UsbBus.h"\r
 \r
 \r
 /**\r
-  Free the interface setting descriptor\r
+  Free the interface setting descriptor.\r
 \r
-  @param  Setting               The descriptor to free\r
+  @param  Setting               The descriptor to free.\r
 \r
-  @return None\r
+  @return None.\r
 \r
 **/\r
-STATIC\r
 VOID\r
 UsbFreeInterfaceDesc (\r
   IN USB_INTERFACE_SETTING  *Setting\r
@@ -61,17 +51,15 @@ UsbFreeInterfaceDesc (
 }\r
 \r
 \r
-\r
 /**\r
   Free a configuration descriptor with its interface\r
-  descriptors. It may be initialized partially\r
+  descriptors. It may be initialized partially.\r
 \r
-  @param  Config                The configuration descriptor to free\r
+  @param  Config                The configuration descriptor to free.\r
 \r
-  @return None\r
+  @return None.\r
 \r
 **/\r
-STATIC\r
 VOID\r
 UsbFreeConfigDesc (\r
   IN USB_CONFIG_DESC      *Config\r
@@ -112,13 +100,12 @@ UsbFreeConfigDesc (
 }\r
 \r
 \r
-\r
 /**\r
-  Free a device descriptor with its configurations\r
+  Free a device descriptor with its configurations.\r
 \r
-  @param  DevDesc               The device descriptor\r
+  @param  DevDesc               The device descriptor.\r
 \r
-  @return None\r
+  @return None.\r
 \r
 **/\r
 VOID\r
@@ -143,17 +130,16 @@ UsbFreeDevDesc (
 \r
 \r
 /**\r
-  Create a descriptor\r
+  Create a descriptor.\r
 \r
-  @param  DescBuf               The buffer of raw descriptor\r
-  @param  Len                   The lenght of the raw descriptor buffer\r
-  @param  Type                  The type of descriptor to create\r
-  @param  Consumed              Number of bytes consumed\r
+  @param  DescBuf               The buffer of raw descriptor.\r
+  @param  Len                   The lenght of the raw descriptor buffer.\r
+  @param  Type                  The type of descriptor to create.\r
+  @param  Consumed              Number of bytes consumed.\r
 \r
-  @return Created descriptor or NULL\r
+  @return Created descriptor or NULL.\r
 \r
 **/\r
-STATIC\r
 VOID *\r
 UsbCreateDesc (\r
   IN  UINT8               *DescBuf,\r
@@ -226,16 +212,15 @@ UsbCreateDesc (
 \r
 \r
 /**\r
-  Parse an interface desciptor and its endpoints\r
+  Parse an interface desciptor and its endpoints.\r
 \r
-  @param  DescBuf               The buffer of raw descriptor\r
-  @param  Len                   The lenght of the raw descriptor buffer\r
-  @param  Consumed              The number of raw descriptor consumed\r
+  @param  DescBuf               The buffer of raw descriptor.\r
+  @param  Len                   The lenght of the raw descriptor buffer.\r
+  @param  Consumed              The number of raw descriptor consumed.\r
 \r
-  @return The create interface setting or NULL if failed\r
+  @return The create interface setting or NULL if failed.\r
 \r
 **/\r
-STATIC\r
 USB_INTERFACE_SETTING *\r
 UsbParseInterfaceDesc (\r
   IN  UINT8               *DescBuf,\r
@@ -307,13 +292,12 @@ ON_ERROR:
 /**\r
   Parse the configuration descriptor and its interfaces.\r
 \r
-  @param  DescBuf               The buffer of raw descriptor\r
-  @param  Len                   The lenght of the raw descriptor buffer\r
+  @param  DescBuf               The buffer of raw descriptor.\r
+  @param  Len                   The lenght of the raw descriptor buffer.\r
 \r
-  @return The created configuration descriptor\r
+  @return The created configuration descriptor.\r
 \r
 **/\r
-STATIC\r
 USB_CONFIG_DESC *\r
 UsbParseConfigDesc (\r
   IN UINT8                *DescBuf,\r
@@ -407,25 +391,24 @@ ON_ERROR:
 }\r
 \r
 \r
-\r
 /**\r
   USB standard control transfer support routine. This\r
   function is used by USB device. It is possible that\r
   the device's interfaces are still waiting to be\r
   enumerated.\r
 \r
-  @param  UsbDev                The usb device\r
-  @param  Direction             The direction of data transfer\r
-  @param  Type                  Standard / class specific / vendor specific\r
-  @param  Target                The receiving target\r
-  @param  Request               Which request\r
-  @param  Value                 The wValue parameter of the request\r
-  @param  Index                 The wIndex parameter of the request\r
-  @param  Buf                   The buffer to receive data into / transmit from\r
-  @param  Length                The length of the buffer\r
+  @param  UsbDev                The usb device.\r
+  @param  Direction             The direction of data transfer.\r
+  @param  Type                  Standard / class specific / vendor specific.\r
+  @param  Target                The receiving target.\r
+  @param  Request               Which request.\r
+  @param  Value                 The wValue parameter of the request.\r
+  @param  Index                 The wIndex parameter of the request.\r
+  @param  Buf                   The buffer to receive data into / transmit from.\r
+  @param  Length                The length of the buffer.\r
 \r
-  @retval EFI_SUCCESS           The control request is executed\r
-  @retval EFI_DEVICE_ERROR      Failed to execute the control transfer\r
+  @retval EFI_SUCCESS           The control request is executed.\r
+  @retval EFI_DEVICE_ERROR      Failed to execute the control transfer.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -473,23 +456,21 @@ UsbCtrlRequest (
 }\r
 \r
 \r
-\r
 /**\r
   Get the standard descriptors.\r
 \r
-  @param  UsbDev                The USB device to read descriptor from\r
-  @param  DescType              The type of descriptor to read\r
-  @param  DescIndex             The index of descriptor to read\r
+  @param  UsbDev                The USB device to read descriptor from.\r
+  @param  DescType              The type of descriptor to read.\r
+  @param  DescIndex             The index of descriptor to read.\r
   @param  LangId                Language ID, only used to get string, otherwise set\r
-                                it to 0\r
-  @param  Buf                   The buffer to hold the descriptor read\r
-  @param  Length                The length of the buffer\r
+                                it to 0.\r
+  @param  Buf                   The buffer to hold the descriptor read.\r
+  @param  Length                The length of the buffer.\r
 \r
-  @retval EFI_SUCCESS           The descriptor is read OK\r
-  @retval Others                Failed to retrieve the descriptor\r
+  @retval EFI_SUCCESS           The descriptor is read OK.\r
+  @retval Others                Failed to retrieve the descriptor.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 UsbCtrlGetDesc (\r
   IN  USB_DEVICE          *UsbDev,\r
@@ -518,16 +499,15 @@ UsbCtrlGetDesc (
 }\r
 \r
 \r
-\r
 /**\r
   Return the max packet size for endpoint zero. This function\r
   is the first function called to get descriptors during bus\r
   enumeration.\r
 \r
-  @param  UsbDev                The usb device\r
+  @param  UsbDev                The usb device.\r
 \r
-  @retval EFI_SUCCESS           The max packet size of endpoint zero is retrieved\r
-  @retval EFI_DEVICE_ERROR      Failed to retrieve it\r
+  @retval EFI_SUCCESS           The max packet size of endpoint zero is retrieved.\r
+  @retval EFI_DEVICE_ERROR      Failed to retrieve it.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -561,17 +541,15 @@ UsbGetMaxPacketSize0 (
 }\r
 \r
 \r
-\r
 /**\r
   Get the device descriptor for the device.\r
 \r
-  @param  UsbDev                The Usb device to retrieve descriptor from\r
+  @param  UsbDev                The Usb device to retrieve descriptor from.\r
 \r
-  @retval EFI_SUCCESS           The device descriptor is returned\r
-  @retval EFI_OUT_OF_RESOURCES  Failed to allocate memory\r
+  @retval EFI_SUCCESS           The device descriptor is returned.\r
+  @retval EFI_OUT_OF_RESOURCES  Failed to allocate memory.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 UsbGetDevDesc (\r
   IN USB_DEVICE           *UsbDev\r
@@ -605,17 +583,16 @@ UsbGetDevDesc (
 }\r
 \r
 \r
-\r
 /**\r
   Retrieve the indexed string for the language. It requires two\r
   steps to get a string, first to get the string's length. Then\r
   the string itself.\r
 \r
-  @param  UsbDev                The usb device\r
-  @param  Index                 The index the string to retrieve\r
-  @param  LangId                Language ID\r
+  @param  UsbDev                The usb device.\r
+  @param  Index                 The index the string to retrieve.\r
+  @param  LangId                Language ID.\r
 \r
-  @return The created string descriptor or NULL\r
+  @return The created string descriptor or NULL.\r
 \r
 **/\r
 EFI_USB_STRING_DESCRIPTOR *\r
@@ -662,16 +639,14 @@ UsbGetOneString (
 }\r
 \r
 \r
-\r
 /**\r
-  Build the language ID table for string descriptors\r
+  Build the language ID table for string descriptors.\r
 \r
-  @param  UsbDev                The Usb device\r
+  @param  UsbDev                The Usb device.\r
 \r
-  @retval EFI_UNSUPPORTED       This device doesn't support string table\r
+  @retval EFI_UNSUPPORTED       This device doesn't support string table.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 UsbBuildLangTable (\r
   IN USB_DEVICE           *UsbDev\r
@@ -716,20 +691,18 @@ ON_EXIT:
 }\r
 \r
 \r
-\r
 /**\r
   Retrieve the indexed configure for the device. USB device\r
   returns the configuration togetther with the interfaces for\r
   this configuration. Configuration descriptor is also of\r
-  variable length\r
+  variable length.\r
 \r
-  @param  UsbDev                The Usb interface\r
-  @param  Index                 The index of the configuration\r
+  @param  UsbDev                The Usb interface.\r
+  @param  Index                 The index of the configuration.\r
 \r
-  @return The created configuration descriptor\r
+  @return The created configuration descriptor.\r
 \r
 **/\r
-STATIC\r
 EFI_USB_CONFIG_DESCRIPTOR *\r
 UsbGetOneConfig (\r
   IN USB_DEVICE           *UsbDev,\r
@@ -774,16 +747,15 @@ UsbGetOneConfig (
 }\r
 \r
 \r
-\r
 /**\r
   Build the whole array of descriptors. This function must\r
   be called after UsbGetMaxPacketSize0 returns the max packet\r
   size correctly for endpoint 0.\r
 \r
-  @param  UsbDev                The Usb device\r
+  @param  UsbDev                The Usb device.\r
 \r
-  @retval EFI_SUCCESS           The descriptor table is build\r
-  @retval EFI_OUT_OF_RESOURCES  Failed to allocate resource for the descriptor\r
+  @retval EFI_SUCCESS           The descriptor table is build.\r
+  @retval EFI_OUT_OF_RESOURCES  Failed to allocate resource for the descriptor.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -877,11 +849,11 @@ UsbBuildDescTable (
 /**\r
   Set the device's address.\r
 \r
-  @param  UsbDev                The device to set address to\r
-  @param  Address               The address to set\r
+  @param  UsbDev                The device to set address to.\r
+  @param  Address               The address to set.\r
 \r
-  @retval EFI_SUCCESS           The device is set to the address\r
-  @retval Others                Failed to set the device address\r
+  @retval EFI_SUCCESS           The device is set to the address.\r
+  @retval Others                Failed to set the device address.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -913,11 +885,11 @@ UsbSetAddress (
   the device's internal state. UsbSelectConfig changes\r
   the Usb bus's internal state.\r
 \r
-  @param  UsbDev                The USB device to set configure to\r
-  @param  ConfigIndex           The configure index to set\r
+  @param  UsbDev                The USB device to set configure to.\r
+  @param  ConfigIndex           The configure index to set.\r
 \r
-  @retval EFI_SUCCESS           The device is configured now\r
-  @retval Others                Failed to set the device configure\r
+  @retval EFI_SUCCESS           The device is configured now.\r
+  @retval Others                Failed to set the device configure.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -944,19 +916,18 @@ UsbSetConfig (
 }\r
 \r
 \r
-\r
 /**\r
   Usb UsbIo interface to clear the feature. This is should\r
   only be used by HUB which is considered a device driver\r
   on top of the UsbIo interface.\r
 \r
-  @param  UsbIo                 The UsbIo interface\r
-  @param  Target                The target of the transfer: endpoint/device\r
-  @param  Feature               The feature to clear\r
-  @param  Index                 The wIndex parameter\r
+  @param  UsbIo                 The UsbIo interface.\r
+  @param  Target                The target of the transfer: endpoint/device.\r
+  @param  Feature               The feature to clear.\r
+  @param  Index                 The wIndex parameter.\r
 \r
-  @retval EFI_SUCCESS           The device feature is cleared\r
-  @retval Others                Failed to clear the feature\r
+  @retval EFI_SUCCESS           The device feature is cleared.\r
+  @retval Others                Failed to clear the feature.\r
 \r
 **/\r
 EFI_STATUS\r
index 14f3c7feb0474b0b348feb86031d0847d163426e..dd7868bc1d40cd5de12cc7c8eb327ffed808b983 100644 (file)
@@ -1,5 +1,7 @@
 /** @file\r
 \r
+    Manage Usb Descriptor List\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,25 +11,14 @@ 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
-    UsbDesc.h\r
-\r
-  Abstract:\r
-\r
-    Manage Usb Descriptor List\r
-\r
-  Revision History\r
-\r
-\r
 **/\r
 \r
 #ifndef _USB_DESCRIPTOR_H_\r
 #define _USB_DESCRIPTOR_H_\r
 \r
-enum {\r
+typedef enum {\r
   USB_MAX_INTERFACE_SETTING  = 8\r
-};\r
+}USB_INTERFACE_SETTING_MAX;\r
 \r
 //\r
 // The RequestType in EFI_USB_DEVICE_REQUEST is composed of\r
@@ -89,6 +80,26 @@ typedef struct {
   USB_CONFIG_DESC               **Configs;\r
 } USB_DEVICE_DESC;\r
 \r
+/**\r
+  USB standard control transfer support routine. This\r
+  function is used by USB device. It is possible that\r
+  the device's interfaces are still waiting to be\r
+  enumerated.\r
+\r
+  @param  UsbDev                The usb device.\r
+  @param  Direction             The direction of data transfer.\r
+  @param  Type                  Standard / class specific / vendor specific.\r
+  @param  Target                The receiving target.\r
+  @param  Request               Which request.\r
+  @param  Value                 The wValue parameter of the request.\r
+  @param  Index                 The wIndex parameter of the request.\r
+  @param  Buf                   The buffer to receive data into / transmit from.\r
+  @param  Length                The length of the buffer.\r
+\r
+  @retval EFI_SUCCESS           The control request is executed.\r
+  @retval EFI_DEVICE_ERROR      Failed to execute the control transfer.\r
+\r
+**/\r
 EFI_STATUS\r
 UsbCtrlRequest (\r
   IN USB_DEVICE             *UsbDev,\r
@@ -102,16 +113,47 @@ UsbCtrlRequest (
   IN UINTN                  Length\r
   );\r
 \r
+/**\r
+  Return the max packet size for endpoint zero. This function\r
+  is the first function called to get descriptors during bus\r
+  enumeration.\r
+\r
+  @param  UsbDev                The usb device.\r
+\r
+  @retval EFI_SUCCESS           The max packet size of endpoint zero is retrieved.\r
+  @retval EFI_DEVICE_ERROR      Failed to retrieve it.\r
+\r
+**/\r
 EFI_STATUS\r
 UsbGetMaxPacketSize0 (\r
   IN USB_DEVICE           *UsbDev\r
   );\r
 \r
+/**\r
+  Free a device descriptor with its configurations.\r
+\r
+  @param  DevDesc               The device descriptor.\r
+\r
+  @return None.\r
+\r
+**/\r
 VOID\r
 UsbFreeDevDesc (\r
   IN USB_DEVICE_DESC      *DevDesc\r
   );\r
 \r
+/**\r
+  Retrieve the indexed string for the language. It requires two\r
+  steps to get a string, first to get the string's length. Then\r
+  the string itself.\r
+\r
+  @param  UsbDev                The usb device.\r
+  @param  StringIndex           The index of the string to retrieve.\r
+  @param  LangId                Language ID.\r
+\r
+  @return The created string descriptor or NULL.\r
+\r
+**/\r
 EFI_USB_STRING_DESCRIPTOR*\r
 UsbGetOneString (\r
   IN     USB_DEVICE       *UsbDev,\r
@@ -119,23 +161,70 @@ UsbGetOneString (
   IN     UINT16           LangId\r
   );\r
 \r
+/**\r
+  Build the whole array of descriptors. This function must\r
+  be called after UsbGetMaxPacketSize0 returns the max packet\r
+  size correctly for endpoint 0.\r
+\r
+  @param  UsbDev                The Usb device.\r
+\r
+  @retval EFI_SUCCESS           The descriptor table is build.\r
+  @retval EFI_OUT_OF_RESOURCES  Failed to allocate resource for the descriptor.\r
+\r
+**/\r
 EFI_STATUS\r
 UsbBuildDescTable (\r
   IN USB_DEVICE           *UsbDev\r
   );\r
 \r
+/**\r
+  Set the device's address.\r
+\r
+  @param  UsbDev                The device to set address to.\r
+  @param  Address               The address to set.\r
+\r
+  @retval EFI_SUCCESS           The device is set to the address.\r
+  @retval Others                Failed to set the device address.\r
+\r
+**/\r
 EFI_STATUS\r
 UsbSetAddress (\r
   IN USB_DEVICE           *UsbDev,\r
   IN UINT8                Address\r
   );\r
 \r
+/**\r
+  Set the device's configuration. This function changes\r
+  the device's internal state. UsbSelectConfig changes\r
+  the Usb bus's internal state.\r
+\r
+  @param  UsbDev                The USB device to set configure to.\r
+  @param  ConfigIndex           The configure index to set.\r
+\r
+  @retval EFI_SUCCESS           The device is configured now.\r
+  @retval Others                Failed to set the device configure.\r
+\r
+**/\r
 EFI_STATUS\r
 UsbSetConfig (\r
   IN USB_DEVICE           *UsbDev,\r
   IN UINT8                ConfigIndex\r
   );\r
 \r
+/**\r
+  Usb UsbIo interface to clear the feature. This is should\r
+  only be used by HUB which is considered a device driver\r
+  on top of the UsbIo interface.\r
+\r
+  @param  UsbIo                 The UsbIo interface.\r
+  @param  Target                The target of the transfer: endpoint/device.\r
+  @param  Feature               The feature to clear.\r
+  @param  Index                 The wIndex parameter.\r
+\r
+  @retval EFI_SUCCESS           The device feature is cleared.\r
+  @retval Others                Failed to clear the feature.\r
+\r
+**/\r
 EFI_STATUS\r
 UsbIoClearFeature (\r
   IN  EFI_USB_IO_PROTOCOL *UsbIo,\r
index b7c66fec831cc6917190d74117a56166ab5633f4..3a2b8bc017ba92ba650633ca07ed62c7b029a843 100644 (file)
@@ -1,5 +1,7 @@
 /** @file\r
 \r
+    Usb bus enumeration support.\r
+\r
 Copyright (c) 2007 - 2008, 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,29 +11,18 @@ 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
-    UsbEnumer.c\r
-\r
-  Abstract:\r
-\r
-    Usb bus enumeration support\r
-\r
-  Revision History\r
-\r
-\r
 **/\r
 \r
 #include "UsbBus.h"\r
 \r
 \r
 /**\r
-  Return the endpoint descriptor in this interface\r
+  Return the endpoint descriptor in this interface.\r
 \r
-  @param  UsbIf                 The interface to search in\r
-  @param  EpAddr                The address of the endpoint to return\r
+  @param  UsbIf                 The interface to search in.\r
+  @param  EpAddr                The address of the endpoint to return.\r
 \r
-  @return The endpoint descriptor or NULL\r
+  @return The endpoint descriptor or NULL.\r
 \r
 **/\r
 USB_ENDPOINT_DESC *\r
@@ -56,14 +47,13 @@ UsbGetEndpointDesc (
 \r
 \r
 /**\r
-  Free the resource used by USB interface\r
+  Free the resource used by USB interface.\r
 \r
-  @param  UsbIf                 The USB interface to free\r
+  @param  UsbIf                 The USB interface to free.\r
 \r
-  @return None\r
+  @return None.\r
 \r
 **/\r
-STATIC\r
 VOID\r
 UsbFreeInterface (\r
   IN USB_INTERFACE        *UsbIf\r
@@ -92,13 +82,12 @@ UsbFreeInterface (
   Create an interface for the descriptor IfDesc. Each\r
   device's configuration can have several interfaces.\r
 \r
-  @param  Device                The device has the interface descriptor\r
-  @param  IfDesc                The interface descriptor\r
+  @param  Device                The device has the interface descriptor.\r
+  @param  IfDesc                The interface descriptor.\r
 \r
   @return The created USB interface for the descriptor, or NULL.\r
 \r
 **/\r
-STATIC\r
 USB_INTERFACE *\r
 UsbCreateInterface (\r
   IN USB_DEVICE           *Device,\r
@@ -185,7 +174,7 @@ UsbCreateInterface (
   return UsbIf;\r
 \r
 ON_ERROR:\r
-  if (UsbIf->DevicePath) {\r
+  if (UsbIf->DevicePath != NULL) {\r
     gBS->FreePool (UsbIf->DevicePath);\r
   }\r
 \r
@@ -195,14 +184,13 @@ ON_ERROR:
 \r
 \r
 /**\r
-  Free the resource used by this USB device\r
+  Free the resource used by this USB device.\r
 \r
-  @param  Device                The USB device to free\r
+  @param  Device                The USB device to free.\r
 \r
-  @return None\r
+  @return None.\r
 \r
 **/\r
-STATIC\r
 VOID\r
 UsbFreeDevice (\r
   IN USB_DEVICE           *Device\r
@@ -219,13 +207,12 @@ UsbFreeDevice (
 /**\r
   Create a device which is on the parent's ParentPort port.\r
 \r
-  @param  ParentIf              The parent HUB interface\r
-  @param  ParentPort            The port on the HUB this device is connected to\r
+  @param  ParentIf              The parent HUB interface.\r
+  @param  ParentPort            The port on the HUB this device is connected to.\r
 \r
-  @return Created USB device\r
+  @return Created USB device, Or NULL.\r
 \r
 **/\r
-STATIC\r
 USB_DEVICE *\r
 UsbCreateDevice (\r
   IN USB_INTERFACE        *ParentIf,\r
@@ -255,13 +242,12 @@ UsbCreateDevice (
   Connect the USB interface with its driver. EFI USB bus will\r
   create a USB interface for each seperate interface descriptor.\r
 \r
-  @param  UsbIf                 The interface to connect driver to\r
+  @param  UsbIf             The interface to connect driver to.\r
 \r
-  @return EFI_SUCCESS : Interface is managed by some driver\r
-  @return Others      : Failed to locate a driver for this interface\r
+  @return EFI_SUCCESS       Interface is managed by some driver.\r
+  @return Others            Failed to locate a driver for this interface.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 UsbConnectDriver (\r
   IN USB_INTERFACE        *UsbIf\r
@@ -318,10 +304,10 @@ UsbConnectDriver (
   settings. Only one setting is active. It will\r
   also reset its endpoints' toggle to zero.\r
 \r
-  @param  IfDesc                The interface descriptor to set\r
-  @param  Alternate             The alternate setting number to locate\r
+  @param  IfDesc                The interface descriptor to set.\r
+  @param  Alternate             The alternate setting number to locate.\r
 \r
-  @retval EFI_NOT_FOUND         There is no setting with this alternate index\r
+  @retval EFI_NOT_FOUND         There is no setting with this alternate index.\r
   @retval EFI_SUCCESS           The interface is set to Alternate setting.\r
 \r
 **/\r
@@ -371,11 +357,11 @@ UsbSelectSetting (
   Select a new configuration for the device. Each\r
   device may support several configurations.\r
 \r
-  @param  Device                The device to select configuration\r
-  @param  ConfigValue           The index of the configuration ( != 0)\r
+  @param  Device                The device to select configuration.\r
+  @param  ConfigValue           The index of the configuration ( != 0).\r
 \r
-  @retval EFI_NOT_FOUND         There is no configuration with the index\r
-  @retval EFI_OUT_OF_RESOURCES  Failed to allocate resource\r
+  @retval EFI_NOT_FOUND         There is no configuration with the index.\r
+  @retval EFI_OUT_OF_RESOURCES  Failed to allocate resource.\r
   @retval EFI_SUCCESS           The configuration is selected.\r
 \r
 **/\r
@@ -455,16 +441,14 @@ UsbSelectConfig (
 }\r
 \r
 \r
-\r
 /**\r
   Disconnect the USB interface with its driver.\r
 \r
-  @param  UsbIf                 The interface to disconnect driver from\r
+  @param  UsbIf                 The interface to disconnect driver from.\r
 \r
-  @return None\r
+  @return None.\r
 \r
 **/\r
-STATIC\r
 VOID\r
 UsbDisconnectDriver (\r
   IN USB_INTERFACE        *UsbIf\r
@@ -503,13 +487,12 @@ UsbDisconnectDriver (
 }\r
 \r
 \r
-\r
 /**\r
-  Remove the current device configuration\r
+  Remove the current device configuration.\r
 \r
-  @param  Device                The USB device to remove configuration from\r
+  @param  Device                The USB device to remove configuration from.\r
 \r
-  @return None\r
+  @return None.\r
 \r
 **/\r
 VOID\r
@@ -540,13 +523,12 @@ UsbRemoveConfig (
 }\r
 \r
 \r
-\r
 /**\r
   Remove the device and all its children from the bus.\r
 \r
-  @param  Device                The device to remove\r
+  @param  Device                The device to remove.\r
 \r
-  @retval EFI_SUCCESS           The device is removed\r
+  @retval EFI_SUCCESS           The device is removed.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -592,15 +574,14 @@ UsbRemoveDevice (
 \r
 \r
 /**\r
-  Find the child device on the hub's port\r
+  Find the child device on the hub's port.\r
 \r
-  @param  HubIf                 The hub interface\r
-  @param  Port                  The port of the hub this child is connected to\r
+  @param  HubIf                 The hub interface.\r
+  @param  Port                  The port of the hub this child is connected to.\r
 \r
-  @return The device on the hub's port, or NULL if there is none\r
+  @return The device on the hub's port, or NULL if there is none.\r
 \r
 **/\r
-STATIC\r
 USB_DEVICE *\r
 UsbFindChild (\r
   IN USB_INTERFACE        *HubIf,\r
@@ -630,19 +611,17 @@ UsbFindChild (
 }\r
 \r
 \r
-\r
 /**\r
   Enumerate and configure the new device on the port of this HUB interface.\r
 \r
-  @param  HubIf                 The HUB that has the device connected\r
-  @param  Port                  The port index of the hub (started with zero)\r
+  @param  HubIf                 The HUB that has the device connected.\r
+  @param  Port                  The port index of the hub (started with zero).\r
 \r
-  @retval EFI_SUCCESS           The device is enumerated (added or removed)\r
-  @retval EFI_OUT_OF_RESOURCES  Failed to allocate resource for the device\r
-  @retval Others                Failed to enumerate the device\r
+  @retval EFI_SUCCESS           The device is enumerated (added or removed).\r
+  @retval EFI_OUT_OF_RESOURCES  Failed to allocate resource for the device.\r
+  @retval Others                Failed to enumerate the device.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 UsbEnumerateNewDev (\r
   IN USB_INTERFACE        *HubIf,\r
@@ -832,19 +811,17 @@ ON_ERROR:
 }\r
 \r
 \r
-\r
 /**\r
   Process the events on the port.\r
 \r
-  @param  HubIf                 The HUB that has the device connected\r
-  @param  Port                  The port index of the hub (started with zero)\r
+  @param  HubIf                 The HUB that has the device connected.\r
+  @param  Port                  The port index of the hub (started with zero).\r
 \r
-  @retval EFI_SUCCESS           The device is enumerated (added or removed)\r
-  @retval EFI_OUT_OF_RESOURCES  Failed to allocate resource for the device\r
-  @retval Others                Failed to enumerate the device\r
+  @retval EFI_SUCCESS           The device is enumerated (added or removed).\r
+  @retval EFI_OUT_OF_RESOURCES  Failed to allocate resource for the device.\r
+  @retval Others                Failed to enumerate the device.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 UsbEnumeratePort (\r
   IN USB_INTERFACE        *HubIf,\r
@@ -949,15 +926,16 @@ UsbEnumeratePort (
 \r
 \r
 /**\r
-  Enumerate all the changed hub ports\r
+  Enumerate all the changed hub ports.\r
 \r
-  @param  Event                 The event that is triggered\r
-  @param  Context               The context to the event\r
+  @param  Event                 The event that is triggered.\r
+  @param  Context               The context to the event.\r
 \r
-  @return None\r
+  @return None.\r
 \r
 **/\r
 VOID\r
+EFIAPI\r
 UsbHubEnumeration (\r
   IN EFI_EVENT            Event,\r
   IN VOID                 *Context\r
@@ -999,12 +977,12 @@ UsbHubEnumeration (
 \r
 \r
 /**\r
-  Enumerate all the changed hub ports\r
+  Enumerate all the changed hub ports.\r
 \r
-  @param  Event                 The event that is triggered\r
-  @param  Context               The context to the event\r
+  @param  Event                 The event that is triggered.\r
+  @param  Context               The context to the event.\r
 \r
-  @return None\r
+  @return None.\r
 \r
 **/\r
 VOID\r
index 54f4dd2ca0eeca94870a1ddd308a9057dd1ca457..1b36a6d853720bca6f4d41eb59dfd3a171b8d871 100644 (file)
@@ -1,5 +1,7 @@
 /** @file\r
 \r
+    USB bus enumeration interface.\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
-    UsbEnumer.h\r
-\r
-  Abstract:\r
-\r
-    USB bus enumeration interface\r
-\r
-  Revision History\r
-\r
-\r
 **/\r
 \r
 #ifndef _USB_ENUMERATION_H_\r
@@ -110,35 +101,93 @@ struct _USB_HUB_API{
   USB_HUB_RELEASE             Release;\r
 };\r
 \r
+/**\r
+  Return the endpoint descriptor in this interface.\r
+\r
+  @param  UsbIf                 The interface to search in.\r
+  @param  EpAddr                The address of the endpoint to return.\r
+\r
+  @return The endpoint descriptor or NULL.\r
+\r
+**/\r
 USB_ENDPOINT_DESC*\r
 UsbGetEndpointDesc (\r
   IN USB_INTERFACE        *UsbIf,\r
   IN UINT8                EpAddr\r
   );\r
 \r
+/**\r
+  Select an alternate setting for the interface.\r
+  Each interface can have several mutually exclusive\r
+  settings. Only one setting is active. It will\r
+  also reset its endpoints' toggle to zero.\r
+\r
+  @param  IfDesc                The interface descriptor to set.\r
+  @param  Alternate             The alternate setting number to locate.\r
+\r
+  @retval EFI_NOT_FOUND         There is no setting with this alternate index.\r
+  @retval EFI_SUCCESS           The interface is set to Alternate setting.\r
 \r
+**/\r
 EFI_STATUS\r
 UsbSelectSetting (\r
   IN USB_INTERFACE_DESC   *IfDesc,\r
   IN UINT8                Alternate\r
   );\r
 \r
+/**\r
+  Select a new configuration for the device. Each\r
+  device may support several configurations.\r
+\r
+  @param  Device                The device to select configuration.\r
+  @param  ConfigIndex           The index of the configuration ( != 0).\r
+\r
+  @retval EFI_NOT_FOUND         There is no configuration with the index.\r
+  @retval EFI_OUT_OF_RESOURCES  Failed to allocate resource.\r
+  @retval EFI_SUCCESS           The configuration is selected.\r
+\r
+**/\r
 EFI_STATUS\r
 UsbSelectConfig (\r
   IN USB_DEVICE           *Device,\r
   IN UINT8                ConfigIndex\r
   );\r
 \r
+/**\r
+  Remove the current device configuration.\r
+\r
+  @param  Device                The USB device to remove configuration from.\r
+\r
+  @return None.\r
+\r
+**/\r
 VOID\r
 UsbRemoveConfig (\r
   IN USB_DEVICE           *Device\r
   );\r
 \r
+/**\r
+  Remove the device and all its children from the bus.\r
+\r
+  @param  Device                The device to remove.\r
+\r
+  @retval EFI_SUCCESS           The device is removed.\r
+\r
+**/\r
 EFI_STATUS\r
 UsbRemoveDevice (\r
   IN USB_DEVICE           *Device\r
   );\r
 \r
+/**\r
+  Enumerate all the changed hub ports.\r
+\r
+  @param  Event                 The event that is triggered.\r
+  @param  Context               The context to the event.\r
+\r
+  @return None.\r
+\r
+**/\r
 VOID\r
 EFIAPI\r
 UsbHubEnumeration (\r
@@ -146,6 +195,15 @@ UsbHubEnumeration (
   IN VOID                 *Context\r
   );\r
 \r
+/**\r
+  Enumerate all the changed hub ports.\r
+\r
+  @param  Event                 The event that is triggered.\r
+  @param  Context               The context to the event.\r
+\r
+  @return None.\r
+\r
+**/\r
 VOID\r
 EFIAPI\r
 UsbRootHubEnumeration (\r
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
index e31ba27586b6de7b75ff8904eab84eb04abde155..af4897a74b5dd61b6cb3e9be82c7d56eb6abc6cf 100644 (file)
@@ -1,5 +1,7 @@
 /** @file\r
 \r
+    The definition for USB 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.h\r
-\r
-  Abstract:\r
-\r
-    The definition for USB hub\r
-\r
-  Revision History\r
-\r
-\r
 **/\r
 \r
 #ifndef _USB_HUB_H_\r
@@ -30,7 +21,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define USB_ENDPOINT_ADDR(EpAddr) ((EpAddr) & 0x7F)\r
 #define USB_ENDPOINT_TYPE(Desc)   ((Desc)->Attributes & USB_ENDPOINT_TYPE_MASK)\r
 \r
-enum {\r
+typedef enum {\r
   USB_DESC_TYPE_HUB           = 0x29,\r
 \r
   //\r
@@ -95,7 +86,7 @@ enum {
   // after 500ms(LOOP * STALL = 100 * 5ms), set by experience\r
   //\r
   USB_WAIT_PORT_STS_CHANGE_LOOP   = 100\r
-};\r
+}USB_HUB_FLAGS_VALUE;\r
 \r
 #pragma pack(1)\r
 //\r
@@ -119,6 +110,23 @@ typedef struct {
 } USB_CHANGE_FEATURE_MAP;\r
 \r
 \r
+/**\r
+  Clear the transaction translate buffer if full/low\r
+  speed control/bulk transfer failed and the transfer\r
+  uses this hub as translator.Remember to clear the TT\r
+  buffer of transaction translator, not that of the\r
+  parent.\r
+\r
+  @param  UsbDev                The Usb 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
+\r
+**/\r
 EFI_STATUS\r
 UsbHubCtrlClearTTBuffer (\r
   IN USB_DEVICE           *UsbDev,\r
@@ -129,11 +137,31 @@ UsbHubCtrlClearTTBuffer (
   );\r
 \r
 \r
+/**\r
+  Test whether the interface is a hub interface.\r
+\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
+\r
+**/\r
 BOOLEAN\r
 UsbIsHubInterface (\r
   IN USB_INTERFACE        *UsbIf\r
   );\r
 \r
+\r
+/**\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  UsbDev                The Usb device.\r
+\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
 UsbHubAckHubStatus (\r
   IN  USB_DEVICE         *UsbDev\r
index e7a0c28412324e51d35ff83a9e1c2026b419132d..c9d4f7030caa34a17d53f35b012575d362e587ea 100644 (file)
@@ -1,5 +1,7 @@
 /** @file\r
 \r
+    Wrapper function for usb host controller interface.\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
-    UsbUtility.c\r
-\r
-  Abstract:\r
-\r
-    Wrapper function for usb host controller interface\r
-\r
-  Revision History\r
-\r
-\r
 **/\r
 \r
 \r
@@ -59,14 +50,14 @@ STATIC USB_CLASS_FORMAT_DEVICE_PATH mAllUsbClassDevicePath = {
 \r
 \r
 /**\r
-  Get the capability of the host controller\r
+  Get the capability of the host controller.\r
 \r
-  @param  UsbBus           The usb driver\r
-  @param  MaxSpeed         The maximum speed this host controller supports\r
-  @param  NumOfPort        The number of the root hub port\r
-  @param  Is64BitCapable   Whether this controller support 64 bit addressing\r
+  @param  UsbBus           The usb driver.\r
+  @param  MaxSpeed         The maximum speed this host controller supports.\r
+  @param  NumOfPort        The number of the root hub port.\r
+  @param  Is64BitCapable   Whether this controller support 64 bit addressing.\r
 \r
-  @retval EFI_SUCCESS      The host controller capability is returned\r
+  @retval EFI_SUCCESS      The host controller capability is returned.\r
   @retval Others           Failed to retrieve the host controller capability.\r
 \r
 **/\r
@@ -100,13 +91,16 @@ UsbHcGetCapability (
 \r
 \r
 /**\r
-  Reset the host controller\r
-\r
-  @param  UsbBus           The usb bus driver\r
-  @param  Attributes       The reset type, only global reset is used by this driver\r
+  Reset the host controller.\r
 \r
-  @return GC_TODO: add return values\r
+  @param  UsbBus                The usb bus driver.\r
+  @param  Attributes            The reset type, only global reset is used by this driver.\r
 \r
+  @retval EFI_SUCCESS           The reset operation succeeded.\r
+  @retval EFI_INVALID_PARAMETER Attributes is not valid.\r
+  @retval EFI_UNSUPPOURTED      The type of reset specified by Attributes is\r
+                                not currently supported by the host controller.\r
+  @retval EFI_DEVICE_ERROR      Host controller isn't halted to reset.\r
 **/\r
 EFI_STATUS\r
 UsbHcReset (\r
@@ -127,13 +121,13 @@ UsbHcReset (
 \r
 \r
 /**\r
-  Get the current operation state of the host controller\r
+  Get the current operation state of the host controller.\r
 \r
-  @param  UsbBus           The USB bus driver\r
-  @param  State            The host controller operation state\r
+  @param  UsbBus           The USB bus driver.\r
+  @param  State            The host controller operation state.\r
 \r
-  @retval EFI_SUCCESS      The operation state is returned in State\r
-  @retval Others           Failed to get the host controller state\r
+  @retval EFI_SUCCESS      The operation state is returned in State.\r
+  @retval Others           Failed to get the host controller state.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -155,13 +149,13 @@ UsbHcGetState (
 \r
 \r
 /**\r
-  Set the host controller operation state\r
+  Set the host controller operation state.\r
 \r
-  @param  UsbBus           The USB bus driver\r
-  @param  State            The state to set\r
+  @param  UsbBus           The USB bus driver.\r
+  @param  State            The state to set.\r
 \r
-  @retval EFI_SUCCESS      The host controller is now working at State\r
-  @retval Others           Failed to set operation state\r
+  @retval EFI_SUCCESS      The host controller is now working at State.\r
+  @retval Others           Failed to set operation state.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -183,14 +177,14 @@ UsbHcSetState (
 \r
 \r
 /**\r
-  Get the root hub port state\r
+  Get the root hub port state.\r
 \r
-  @param  UsbBus           The USB bus driver\r
-  @param  PortIndex        The index of port\r
-  @param  PortStatus       The variable to save port state\r
+  @param  UsbBus           The USB bus driver.\r
+  @param  PortIndex        The index of port.\r
+  @param  PortStatus       The variable to save port state.\r
 \r
-  @retval EFI_SUCCESS      The root port state is returned in\r
-  @retval Others           Failed to get the root hub port state\r
+  @retval EFI_SUCCESS      The root port state is returned in.\r
+  @retval Others           Failed to get the root hub port state.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -213,14 +207,14 @@ UsbHcGetRootHubPortStatus (
 \r
 \r
 /**\r
-  Set the root hub port feature\r
+  Set the root hub port feature.\r
 \r
-  @param  UsbBus           The USB bus driver\r
-  @param  PortIndex        The port index\r
-  @param  Feature          The port feature to set\r
+  @param  UsbBus           The USB bus driver.\r
+  @param  PortIndex        The port index.\r
+  @param  Feature          The port feature to set.\r
 \r
-  @retval EFI_SUCCESS      The port feature is set\r
-  @retval Others           Failed to set port feature\r
+  @retval EFI_SUCCESS      The port feature is set.\r
+  @retval Others           Failed to set port feature.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -244,14 +238,14 @@ UsbHcSetRootHubPortFeature (
 \r
 \r
 /**\r
-  Clear the root hub port feature\r
+  Clear the root hub port feature.\r
 \r
-  @param  UsbBus           The USB bus driver\r
-  @param  PortIndex        The port index\r
-  @param  Feature          The port feature to clear\r
+  @param  UsbBus           The USB bus driver.\r
+  @param  PortIndex        The port index.\r
+  @param  Feature          The port feature to clear.\r
 \r
-  @retval EFI_SUCCESS      The port feature is clear\r
-  @retval Others           Failed to clear port feature\r
+  @retval EFI_SUCCESS      The port feature is clear.\r
+  @retval Others           Failed to clear port feature.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -274,22 +268,22 @@ UsbHcClearRootHubPortFeature (
 \r
 \r
 /**\r
-  Execute a control transfer to the device\r
-\r
-  @param  UsbBus           The USB bus driver\r
-  @param  DevAddr          The device address\r
-  @param  DevSpeed         The device speed\r
-  @param  MaxPacket        Maximum packet size of endpoint 0\r
-  @param  Request          The control transfer request\r
-  @param  Direction        The direction of data stage\r
-  @param  Data             The buffer holding data\r
-  @param  DataLength       The length of the data\r
-  @param  TimeOut          Timeout (in ms) to wait until timeout\r
-  @param  Translator       The transaction translator for low/full speed device\r
-  @param  UsbResult        The result of transfer\r
-\r
-  @retval EFI_SUCCESS      The control transfer finished without error\r
-  @retval Others           The control transfer failed, reason returned in UsbReslt\r
+  Execute a control transfer to the device.\r
+\r
+  @param  UsbBus           The USB bus driver.\r
+  @param  DevAddr          The device address.\r
+  @param  DevSpeed         The device speed.\r
+  @param  MaxPacket        Maximum packet size of endpoint 0.\r
+  @param  Request          The control transfer request.\r
+  @param  Direction        The direction of data stage.\r
+  @param  Data             The buffer holding data.\r
+  @param  DataLength       The length of the data.\r
+  @param  TimeOut          Timeout (in ms) to wait until timeout.\r
+  @param  Translator       The transaction translator for low/full speed device.\r
+  @param  UsbResult        The result of transfer.\r
+\r
+  @retval EFI_SUCCESS      The control transfer finished without error.\r
+  @retval Others           The control transfer failed, reason returned in UsbReslt.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -346,25 +340,25 @@ UsbHcControlTransfer (
 \r
 \r
 /**\r
-  Execute a bulk transfer to the device's endpoint\r
+  Execute a bulk transfer to the device's endpoint.\r
 \r
-  @param  UsbBus           The USB bus driver\r
-  @param  DevAddr          The target device address\r
+  @param  UsbBus           The USB bus driver.\r
+  @param  DevAddr          The target device address.\r
   @param  EpAddr           The target endpoint address, with direction encoded in\r
-                           bit 7\r
-  @param  DevSpeed         The device's speed\r
-  @param  MaxPacket        The endpoint's max packet size\r
-  @param  BufferNum        The number of data buffer\r
-  @param  Data             Array of pointers to data buffer\r
-  @param  DataLength       The length of data buffer\r
+                           bit 7.\r
+  @param  DevSpeed         The device's speed.\r
+  @param  MaxPacket        The endpoint's max packet size.\r
+  @param  BufferNum        The number of data buffer.\r
+  @param  Data             Array of pointers to data buffer.\r
+  @param  DataLength       The length of data buffer.\r
   @param  DataToggle       On input, the initial data toggle to use, also  return\r
                            the next toggle on output.\r
-  @param  TimeOut          The time to wait until timeout\r
-  @param  Translator       The transaction translator for low/full speed device\r
-  @param  UsbResult        The result of USB execution\r
+  @param  TimeOut          The time to wait until timeout.\r
+  @param  Translator       The transaction translator for low/full speed device.\r
+  @param  UsbResult        The result of USB execution.\r
 \r
-  @retval EFI_SUCCESS      The bulk transfer is finished without error\r
-  @retval Others           Failed to execute bulk transfer, result in UsbResult\r
+  @retval EFI_SUCCESS      The bulk transfer is finished without error.\r
+  @retval Others           Failed to execute bulk transfer, result in UsbResult.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -419,25 +413,25 @@ UsbHcBulkTransfer (
 \r
 \r
 /**\r
-  Queue or cancel an asynchronous interrupt transfer\r
+  Queue or cancel an asynchronous interrupt transfer.\r
 \r
-  @param  UsbBus           The USB bus driver\r
-  @param  DevAddr          The target device address\r
+  @param  UsbBus           The USB bus driver.\r
+  @param  DevAddr          The target device address.\r
   @param  EpAddr           The target endpoint address, with direction encoded in\r
-                           bit 7\r
-  @param  DevSpeed         The device's speed\r
-  @param  MaxPacket        The endpoint's max packet size\r
+                           bit 7.\r
+  @param  DevSpeed         The device's speed.\r
+  @param  MaxPacket        The endpoint's max packet size.\r
   @param  IsNewTransfer    Whether this is a new request. If not, cancel the old\r
-                           request\r
-  @param  DataToggle       Data toggle to use on input, next toggle on output\r
-  @param  PollingInterval  The interval to poll the interrupt transfer (in ms)\r
-  @param  DataLength       The length of periodical data receive\r
-  @param  Translator       The transaction translator for low/full speed device\r
-  @param  Callback         Function to call when data is received\r
-  @param  Context          The context to the callback\r
+                           request.\r
+  @param  DataToggle       Data toggle to use on input, next toggle on output.\r
+  @param  PollingInterval  The interval to poll the interrupt transfer (in ms).\r
+  @param  DataLength       The length of periodical data receive.\r
+  @param  Translator       The transaction translator for low/full speed device.\r
+  @param  Callback         Function to call when data is received.\r
+  @param  Context          The context to the callback.\r
 \r
-  @retval EFI_SUCCESS      The asynchronous transfer is queued\r
-  @retval Others           Failed to queue the transfer\r
+  @retval EFI_SUCCESS      The asynchronous transfer is queued.\r
+  @retval Others           Failed to queue the transfer.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -497,24 +491,24 @@ UsbHcAsyncInterruptTransfer (
 \r
 \r
 /**\r
-  Execute a synchronous interrupt transfer to the target endpoint\r
+  Execute a synchronous interrupt transfer to the target endpoint.\r
 \r
-  @param  UsbBus           The USB bus driver\r
-  @param  DevAddr          The target device address\r
+  @param  UsbBus           The USB bus driver.\r
+  @param  DevAddr          The target device address.\r
   @param  EpAddr           The target endpoint address, with direction encoded in\r
-                           bit 7\r
-  @param  DevSpeed         The device's speed\r
-  @param  MaxPacket        The endpoint's max packet size\r
-  @param  Data             Pointer to data buffer\r
-  @param  DataLength       The length of data buffer\r
+                           bit 7.\r
+  @param  DevSpeed         The device's speed.\r
+  @param  MaxPacket        The endpoint's max packet size.\r
+  @param  Data             Pointer to data buffer.\r
+  @param  DataLength       The length of data buffer.\r
   @param  DataToggle       On input, the initial data toggle to use, also  return\r
                            the next toggle on output.\r
-  @param  TimeOut          The time to wait until timeout\r
-  @param  Translator       The transaction translator for low/full speed device\r
-  @param  UsbResult        The result of USB execution\r
+  @param  TimeOut          The time to wait until timeout.\r
+  @param  Translator       The transaction translator for low/full speed device.\r
+  @param  UsbResult        The result of USB execution.\r
 \r
-  @retval EFI_SUCCESS      The synchronous interrupt transfer is OK\r
-  @retval Others           Failed to execute the synchronous interrupt transfer\r
+  @retval EFI_SUCCESS      The synchronous interrupt transfer is OK.\r
+  @retval Others           Failed to execute the synchronous interrupt transfer.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -570,21 +564,21 @@ UsbHcSyncInterruptTransfer (
 \r
 \r
 /**\r
-  Execute a synchronous Isochronous USB transfer\r
+  Execute a synchronous Isochronous USB transfer.\r
 \r
-  @param  UsbBus           The USB bus driver\r
-  @param  DevAddr          The target device address\r
+  @param  UsbBus           The USB bus driver.\r
+  @param  DevAddr          The target device address.\r
   @param  EpAddr           The target endpoint address, with direction encoded in\r
-                           bit 7\r
-  @param  DevSpeed         The device's speed\r
-  @param  MaxPacket        The endpoint's max packet size\r
-  @param  BufferNum        The number of data buffer\r
-  @param  Data             Array of pointers to data buffer\r
-  @param  DataLength       The length of data buffer\r
-  @param  Translator       The transaction translator for low/full speed device\r
-  @param  UsbResult        The result of USB execution\r
+                           bit 7.\r
+  @param  DevSpeed         The device's speed.\r
+  @param  MaxPacket        The endpoint's max packet size.\r
+  @param  BufferNum        The number of data buffer.\r
+  @param  Data             Array of pointers to data buffer.\r
+  @param  DataLength       The length of data buffer.\r
+  @param  Translator       The transaction translator for low/full speed device.\r
+  @param  UsbResult        The result of USB execution.\r
 \r
-  @retval EFI_UNSUPPORTED  The isochronous transfer isn't supported now\r
+  @retval EFI_UNSUPPORTED  The isochronous transfer isn't supported now.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -606,22 +600,22 @@ UsbHcIsochronousTransfer (
 \r
 \r
 /**\r
-  Queue an asynchronous isochronous transfer\r
+  Queue an asynchronous isochronous transfer.\r
 \r
-  @param  UsbBus           The USB bus driver\r
-  @param  DevAddr          The target device address\r
+  @param  UsbBus           The USB bus driver.\r
+  @param  DevAddr          The target device address.\r
   @param  EpAddr           The target endpoint address, with direction encoded in\r
-                           bit 7\r
-  @param  DevSpeed         The device's speed\r
-  @param  MaxPacket        The endpoint's max packet size\r
-  @param  BufferNum        The number of data buffer\r
-  @param  Data             Array of pointers to data buffer\r
-  @param  DataLength       The length of data buffer\r
-  @param  Translator       The transaction translator for low/full speed device\r
-  @param  Callback         The function to call when data is transferred\r
-  @param  Context          The context to the callback function\r
-\r
-  @retval EFI_UNSUPPORTED  The asynchronous isochronous transfer isn't supported\r
+                           bit 7.\r
+  @param  DevSpeed         The device's speed.\r
+  @param  MaxPacket        The endpoint's max packet size.\r
+  @param  BufferNum        The number of data buffer.\r
+  @param  Data             Array of pointers to data buffer.\r
+  @param  DataLength       The length of data buffer.\r
+  @param  Translator       The transaction translator for low/full speed device.\r
+  @param  Callback         The function to call when data is transferred.\r
+  @param  Context          The context to the callback function.\r
+\r
+  @retval EFI_UNSUPPORTED  The asynchronous isochronous transfer isn't supported.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -644,12 +638,12 @@ UsbHcAsyncIsochronousTransfer (
 \r
 \r
 /**\r
-  Open the USB host controller protocol BY_CHILD\r
+  Open the USB host controller protocol BY_CHILD.\r
 \r
-  @param  Bus              The USB bus driver\r
-  @param  Child            The child handle\r
+  @param  Bus              The USB bus driver.\r
+  @param  Child            The child handle.\r
 \r
-  @return The open protocol return\r
+  @return The open protocol return.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -688,12 +682,12 @@ UsbOpenHostProtoByChild (
 \r
 \r
 /**\r
-  Close the USB host controller protocol BY_CHILD\r
+  Close the USB host controller protocol BY_CHILD.\r
 \r
-  @param  Bus              The USB bus driver\r
-  @param  Child            The child handle\r
+  @param  Bus              The USB bus driver.\r
+  @param  Child            The child handle.\r
 \r
-  @return None\r
+  @return None.\r
 \r
 **/\r
 VOID\r
@@ -721,13 +715,12 @@ UsbCloseHostProtoByChild (
 }\r
 \r
 \r
-\r
 /**\r
   return the current TPL, copied from the EDKII glue lib.\r
 \r
-  VOID\r
+  @param  VOID.\r
 \r
-  @return Current TPL\r
+  @return Current TPL.\r
 \r
 **/\r
 EFI_TPL\r
@@ -744,11 +737,11 @@ UsbGetCurrentTpl (
 }\r
 \r
 /**\r
-  Create a new device path which only contain the first Usb part of the DevicePath\r
+  Create a new device path which only contain the first Usb part of the DevicePath.\r
 \r
-  @param DevicePath  A full device path which contain the usb nodes\r
+  @param DevicePath  A full device path which contain the usb nodes.\r
 \r
-  @return            A new device path which only contain the Usb part of the DevicePath\r
+  @return            A new device path which only contain the Usb part of the DevicePath.\r
 \r
 **/\r
 EFI_DEVICE_PATH_PROTOCOL *\r
@@ -816,11 +809,11 @@ GetUsbDPFromFullDP (
 /**\r
   Check whether a usb device path is in a DEVICE_PATH_LIST_ITEM list.\r
 \r
-  @param UsbDP       a usb device path of DEVICE_PATH_LIST_ITEM\r
-  @parem UsbIoDPList a DEVICE_PATH_LIST_ITEM list\r
+  @param UsbDP       a usb device path of DEVICE_PATH_LIST_ITEM.\r
+  @param UsbIoDPList a DEVICE_PATH_LIST_ITEM list.\r
 \r
-  @retval TRUE       there is a DEVICE_PATH_LIST_ITEM in UsbIoDPList which contains the passed in UsbDP\r
-  @retval FALSE      there is no DEVICE_PATH_LIST_ITEM in UsbIoDPList which contains the passed in UsbDP\r
+  @retval TRUE       there is a DEVICE_PATH_LIST_ITEM in UsbIoDPList which contains the passed in UsbDP.\r
+  @retval FALSE      there is no DEVICE_PATH_LIST_ITEM in UsbIoDPList which contains the passed in UsbDP.\r
 \r
 **/\r
 BOOLEAN\r
@@ -867,11 +860,11 @@ SearchUsbDPInList (
 /**\r
   Add a usb device path into the DEVICE_PATH_LIST_ITEM list.\r
 \r
-  @param UsbDP        a usb device path of DEVICE_PATH_LIST_ITEM\r
-  @param UsbIoDPList  a DEVICE_PATH_LIST_ITEM list\r
+  @param UsbDP                   a usb device path of DEVICE_PATH_LIST_ITEM.\r
+  @param UsbIoDPList             a DEVICE_PATH_LIST_ITEM list.\r
 \r
-  @retval EFI_INVALID_PARAMETER\r
-  @retval EFI_SUCCESS\r
+  @retval EFI_INVALID_PARAMETER  If parameters are invalid, return this value.\r
+  @retval EFI_SUCCESS            If Add operation is successful, return this value.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -909,13 +902,13 @@ AddUsbDPToList (
 \r
 /**\r
   Check whether usb device, whose interface is UsbIf, matches the usb class which indicated by\r
-  UsbClassDevicePathPtr whose is a short form usb class device path\r
+  UsbClassDevicePathPtr whose is a short form usb class device path.\r
 \r
-  @param UsbClassDevicePathPtr    a short form usb class device path\r
-  @param UsbIf                    a usb device interface\r
+  @param UsbClassDevicePathPtr    a short form usb class device path.\r
+  @param UsbIf                    a usb device interface.\r
 \r
-  @retval TRUE                    the usb device match the usb class\r
-  @retval FALSE                   the usb device does not match the usb class\r
+  @retval TRUE                    the usb device match the usb class.\r
+  @retval FALSE                   the usb device does not match the usb class.\r
 \r
 **/\r
 BOOLEAN\r
@@ -989,16 +982,15 @@ MatchUsbClass (
 \r
 /**\r
   Check whether usb device, whose interface is UsbIf, matches the usb WWID requirement which indicated by\r
-  UsbWWIDDevicePathPtr whose is a short form usb WWID device path\r
+  UsbWWIDDevicePathPtr whose is a short form usb WWID device path.\r
 \r
-  @param UsbClassDevicePathPtr   a short form usb WWID device path\r
-  @param UsbIf                   a usb device interface\r
+  @param UsbWWIDDevicePathPtr    a short form usb WWID device path.\r
+  @param UsbIf                   a usb device interface.\r
 \r
-  @retval TRUE                   the usb device match the usb WWID requirement\r
-  @retval FALSE                  the usb device does not match the usb WWID requirement\r
+  @retval TRUE                   the usb device match the usb WWID requirement.\r
+  @retval FALSE                  the usb device does not match the usb WWID requirement.\r
 \r
 **/\r
-STATIC\r
 BOOLEAN\r
 MatchUsbWwid (\r
   IN USB_WWID_DEVICE_PATH       *UsbWWIDDevicePathPtr,\r
@@ -1047,12 +1039,12 @@ MatchUsbWwid (
 }\r
 \r
 /**\r
-  Free a DEVICE_PATH_LIST_ITEM list\r
+  Free a DEVICE_PATH_LIST_ITEM list.\r
 \r
-  @param UsbIoDPList  a DEVICE_PATH_LIST_ITEM list pointer\r
+  @param  UsbIoDPList            a DEVICE_PATH_LIST_ITEM list pointer.\r
 \r
-  @retval EFI_INVALID_PARAMETER\r
-  @retval EFI_SUCCESS\r
+  @retval EFI_INVALID_PARAMETER  If parameters are invalid, return this value.\r
+  @retval EFI_SUCCESS            If free operation is successful, return this value.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1094,14 +1086,13 @@ UsbBusFreeUsbDPList (
 \r
 /**\r
   Store a wanted usb child device info (its Usb part of device path) which is indicated by\r
-  RemainingDevicePath in a Usb bus which  is indicated by UsbBusId\r
+  RemainingDevicePath in a Usb bus which  is indicated by UsbBusId.\r
 \r
-  @param UsbBusId              Point to EFI_USB_BUS_PROTOCOL interface\r
-  @param RemainingDevicePath   The remaining device patch\r
+  @param  UsbBusId               Point to EFI_USB_BUS_PROTOCOL interface.\r
+  @param  RemainingDevicePath    The remaining device patch.\r
 \r
-  @retval EFI_SUCCESS\r
-  @retval EFI_INVALID_PARAMETER\r
-  @retval EFI_OUT_OF_RESOURCES\r
+  @retval EFI_SUCCESS            Add operation is successful.\r
+  @retval EFI_INVALID_PARAMETER  The parameters are invalid.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1158,14 +1149,13 @@ UsbBusAddWantedUsbIoDP (
 }\r
 \r
 /**\r
-  Check whether a usb child  device is the wanted device in a bus\r
+  Check whether a usb child device is the wanted device in a bus.\r
 \r
-  @param Bus      The Usb bus's private data pointer\r
-  @param UsbIf    The usb child  device inferface\r
+  @param  Bus     The Usb bus's private data pointer.\r
+  @param  UsbIf   The usb child device inferface.\r
 \r
-  @retval EFI_SUCCESS\r
-  @retval EFI_INVALID_PARAMETER\r
-  @retval EFI_OUT_OF_RESOURCES\r
+  @retval True    If a usb child device is the wanted device in a bus.\r
+  @retval False   If a usb child device is *NOT* the wanted device in a bus.\r
 \r
 **/\r
 BOOLEAN\r
@@ -1265,13 +1255,12 @@ UsbBusIsWantedUsbIO (
 \r
 /**\r
   Recursively connnect every wanted usb child device to ensure they all fully connected.\r
-  Check all the child Usb IO handles in this bus, recursively connecte if it is wanted usb child device\r
+  Check all the child Usb IO handles in this bus, recursively connecte if it is wanted usb child device.\r
 \r
-  @param UsbBusId   point to EFI_USB_BUS_PROTOCOL interface\r
+  @param  UsbBusId                  Point to EFI_USB_BUS_PROTOCOL interface.\r
 \r
-  @retval EFI_SUCCESS\r
-  @retval EFI_INVALID_PARAMETER\r
-  @retval EFI_OUT_OF_RESOURCES\r
+  @retval EFI_SUCCESS               Connect is done successfully.\r
+  @retval EFI_INVALID_PARAMETER     The parameter is invalid.\r
 \r
 **/\r
 EFI_STATUS\r
index ee44c6acd0664c9f1abcb816d403046213e8365a..23cf700bf33f31e2cdc5004d418c98674a9c5819 100644 (file)
@@ -1,5 +1,7 @@
 /** @file\r
 \r
+    Manage Usb Port/Hc/Etc.\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,22 +11,23 @@ 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
-    UsbUtility.h\r
+**/\r
 \r
-  Abstract:\r
+#ifndef _EFI_USB_UTILITY_H_\r
+#define _EFI_USB_UTILITY_H_\r
 \r
-    Manage Usb Port/Hc/Etc\r
+/**\r
+  Get the capability of the host controller.\r
 \r
-  Revision History\r
+  @param  UsbBus           The usb driver.\r
+  @param  MaxSpeed         The maximum speed this host controller supports.\r
+  @param  NumOfPort        The number of the root hub port.\r
+  @param  Is64BitCapable   Whether this controller support 64 bit addressing.\r
 \r
+  @retval EFI_SUCCESS      The host controller capability is returned.\r
+  @retval Others           Failed to retrieve the host controller capability.\r
 \r
 **/\r
-\r
-#ifndef _USB_UTILITY_H\r
-#define _USB_UTILITY_H\r
-\r
 EFI_STATUS\r
 UsbHcGetCapability (\r
   IN  USB_BUS             *UsbBus,\r
@@ -33,27 +36,67 @@ UsbHcGetCapability (
   OUT UINT8               *Is64BitCapable\r
   );\r
 \r
+/**\r
+  Reset the host controller.\r
+\r
+  @param  UsbBus                The usb bus driver.\r
+  @param  Attributes            The reset type, only global reset is used by this driver.\r
+\r
+  @retval EFI_SUCCESS           The reset operation succeeded.\r
+  @retval EFI_INVALID_PARAMETER Attributes is not valid.\r
+  @retval EFI_UNSUPPOURTED      The type of reset specified by Attributes is\r
+                                not currently supported by the host controller.\r
+  @retval EFI_DEVICE_ERROR      Host controller isn't halted to reset.\r
+**/\r
 EFI_STATUS\r
 UsbHcReset (\r
   IN USB_BUS              *UsbBus,\r
   IN UINT16               Attributes\r
   );\r
 \r
+/**\r
+  Get the current operation state of the host controller.\r
+\r
+  @param  UsbBus           The USB bus driver.\r
+  @param  State            The host controller operation state.\r
+\r
+  @retval EFI_SUCCESS      The operation state is returned in State.\r
+  @retval Others           Failed to get the host controller state.\r
 \r
+**/\r
 EFI_STATUS\r
 UsbHcGetState (\r
   IN  USB_BUS             *UsbBus,\r
   OUT EFI_USB_HC_STATE    *State\r
   );\r
 \r
+/**\r
+  Set the host controller operation state.\r
+\r
+  @param  UsbBus           The USB bus driver.\r
+  @param  State            The state to set.\r
+\r
+  @retval EFI_SUCCESS      The host controller is now working at State.\r
+  @retval Others           Failed to set operation state.\r
 \r
+**/\r
 EFI_STATUS\r
 UsbHcSetState (\r
   IN  USB_BUS             *UsbBus,\r
   IN EFI_USB_HC_STATE     State\r
   );\r
 \r
+/**\r
+  Get the root hub port state.\r
+\r
+  @param  UsbBus           The USB bus driver.\r
+  @param  PortIndex        The index of port.\r
+  @param  PortStatus       The variable to save port state.\r
 \r
+  @retval EFI_SUCCESS      The root port state is returned in.\r
+  @retval Others           Failed to get the root hub port state.\r
+\r
+**/\r
 EFI_STATUS\r
 UsbHcGetRootHubPortStatus (\r
   IN  USB_BUS             *UsbBus,\r
@@ -61,7 +104,17 @@ UsbHcGetRootHubPortStatus (
   OUT EFI_USB_PORT_STATUS *PortStatus\r
   );\r
 \r
+/**\r
+  Set the root hub port feature.\r
 \r
+  @param  UsbBus           The USB bus driver.\r
+  @param  PortIndex        The port index.\r
+  @param  Feature          The port feature to set.\r
+\r
+  @retval EFI_SUCCESS      The port feature is set.\r
+  @retval Others           Failed to set port feature.\r
+\r
+**/\r
 EFI_STATUS\r
 UsbHcSetRootHubPortFeature (\r
   IN USB_BUS              *UsbBus,\r
@@ -69,7 +122,17 @@ UsbHcSetRootHubPortFeature (
   IN EFI_USB_PORT_FEATURE Feature\r
   );\r
 \r
+/**\r
+  Clear the root hub port feature.\r
 \r
+  @param  UsbBus           The USB bus driver.\r
+  @param  PortIndex        The port index.\r
+  @param  Feature          The port feature to clear.\r
+\r
+  @retval EFI_SUCCESS      The port feature is clear.\r
+  @retval Others           Failed to clear port feature.\r
+\r
+**/\r
 EFI_STATUS\r
 UsbHcClearRootHubPortFeature (\r
   IN USB_BUS              *UsbBus,\r
@@ -77,7 +140,25 @@ UsbHcClearRootHubPortFeature (
   IN EFI_USB_PORT_FEATURE Feature\r
   );\r
 \r
+/**\r
+  Execute a control transfer to the device.\r
 \r
+  @param  UsbBus           The USB bus driver.\r
+  @param  DevAddr          The device address.\r
+  @param  DevSpeed         The device speed.\r
+  @param  MaxPacket        Maximum packet size of endpoint 0.\r
+  @param  Request          The control transfer request.\r
+  @param  Direction        The direction of data stage.\r
+  @param  Data             The buffer holding data.\r
+  @param  DataLength       The length of the data.\r
+  @param  TimeOut          Timeout (in ms) to wait until timeout.\r
+  @param  Translator       The transaction translator for low/full speed device.\r
+  @param  UsbResult        The result of transfer.\r
+\r
+  @retval EFI_SUCCESS      The control transfer finished without error.\r
+  @retval Others           The control transfer failed, reason returned in UsbReslt.\r
+\r
+**/\r
 EFI_STATUS\r
 UsbHcControlTransfer (\r
   IN  USB_BUS                             *UsbBus,\r
@@ -93,7 +174,28 @@ UsbHcControlTransfer (
   OUT UINT32                              *UsbResult\r
   );\r
 \r
+/**\r
+  Execute a bulk transfer to the device's endpoint.\r
+\r
+  @param  UsbBus           The USB bus driver.\r
+  @param  DevAddr          The target device address.\r
+  @param  EpAddr           The target endpoint address, with direction encoded in\r
+                           bit 7.\r
+  @param  DevSpeed         The device's speed.\r
+  @param  MaxPacket        The endpoint's max packet size.\r
+  @param  BufferNum        The number of data buffer.\r
+  @param  Data             Array of pointers to data buffer.\r
+  @param  DataLength       The length of data buffer.\r
+  @param  DataToggle       On input, the initial data toggle to use, also  return\r
+                           the next toggle on output.\r
+  @param  TimeOut          The time to wait until timeout.\r
+  @param  Translator       The transaction translator for low/full speed device.\r
+  @param  UsbResult        The result of USB execution.\r
+\r
+  @retval EFI_SUCCESS      The bulk transfer is finished without error.\r
+  @retval Others           Failed to execute bulk transfer, result in UsbResult.\r
 \r
+**/\r
 EFI_STATUS\r
 UsbHcBulkTransfer (\r
   IN  USB_BUS                             *UsbBus,\r
@@ -110,7 +212,28 @@ UsbHcBulkTransfer (
   OUT UINT32                              *UsbResult\r
   );\r
 \r
+/**\r
+  Queue or cancel an asynchronous interrupt transfer.\r
+\r
+  @param  UsbBus           The USB bus driver.\r
+  @param  DevAddr          The target device address.\r
+  @param  EpAddr           The target endpoint address, with direction encoded in\r
+                           bit 7.\r
+  @param  DevSpeed         The device's speed.\r
+  @param  MaxPacket        The endpoint's max packet size.\r
+  @param  IsNewTransfer    Whether this is a new request. If not, cancel the old\r
+                           request.\r
+  @param  DataToggle       Data toggle to use on input, next toggle on output.\r
+  @param  PollingInterval  The interval to poll the interrupt transfer (in ms).\r
+  @param  DataLength       The length of periodical data receive.\r
+  @param  Translator       The transaction translator for low/full speed device.\r
+  @param  Callback         Function to call when data is received.\r
+  @param  Context          The context to the callback.\r
+\r
+  @retval EFI_SUCCESS      The asynchronous transfer is queued.\r
+  @retval Others           Failed to queue the transfer.\r
 \r
+**/\r
 EFI_STATUS\r
 UsbHcAsyncInterruptTransfer (\r
   IN  USB_BUS                             *UsbBus,\r
@@ -127,7 +250,27 @@ UsbHcAsyncInterruptTransfer (
   IN  VOID                                *Context OPTIONAL\r
   );\r
 \r
+/**\r
+  Execute a synchronous interrupt transfer to the target endpoint.\r
+\r
+  @param  UsbBus           The USB bus driver.\r
+  @param  DevAddr          The target device address.\r
+  @param  EpAddr           The target endpoint address, with direction encoded in\r
+                           bit 7.\r
+  @param  DevSpeed         The device's speed.\r
+  @param  MaxPacket        The endpoint's max packet size.\r
+  @param  Data             Pointer to data buffer.\r
+  @param  DataLength       The length of data buffer.\r
+  @param  DataToggle       On input, the initial data toggle to use, also  return\r
+                           the next toggle on output.\r
+  @param  TimeOut          The time to wait until timeout.\r
+  @param  Translator       The transaction translator for low/full speed device.\r
+  @param  UsbResult        The result of USB execution.\r
+\r
+  @retval EFI_SUCCESS      The synchronous interrupt transfer is OK.\r
+  @retval Others           Failed to execute the synchronous interrupt transfer.\r
 \r
+**/\r
 EFI_STATUS\r
 UsbHcSyncInterruptTransfer (\r
   IN  USB_BUS                             *UsbBus,\r
@@ -143,7 +286,24 @@ UsbHcSyncInterruptTransfer (
   OUT UINT32                              *UsbResult\r
   );\r
 \r
+/**\r
+  Execute a synchronous Isochronous USB transfer.\r
+\r
+  @param  UsbBus           The USB bus driver.\r
+  @param  DevAddr          The target device address.\r
+  @param  EpAddr           The target endpoint address, with direction encoded in\r
+                           bit 7.\r
+  @param  DevSpeed         The device's speed.\r
+  @param  MaxPacket        The endpoint's max packet size.\r
+  @param  BufferNum        The number of data buffer.\r
+  @param  Data             Array of pointers to data buffer.\r
+  @param  DataLength       The length of data buffer.\r
+  @param  Translator       The transaction translator for low/full speed device.\r
+  @param  UsbResult        The result of USB execution.\r
 \r
+  @retval EFI_UNSUPPORTED  The isochronous transfer isn't supported now.\r
+\r
+**/\r
 EFI_STATUS\r
 UsbHcIsochronousTransfer (\r
   IN  USB_BUS                             *UsbBus,\r
@@ -158,7 +318,25 @@ UsbHcIsochronousTransfer (
   OUT UINT32                              *UsbResult\r
   );\r
 \r
+/**\r
+  Queue an asynchronous isochronous transfer.\r
+\r
+  @param  UsbBus           The USB bus driver.\r
+  @param  DevAddr          The target device address.\r
+  @param  EpAddr           The target endpoint address, with direction encoded in\r
+                           bit 7.\r
+  @param  DevSpeed         The device's speed.\r
+  @param  MaxPacket        The endpoint's max packet size.\r
+  @param  BufferNum        The number of data buffer.\r
+  @param  Data             Array of pointers to data buffer.\r
+  @param  DataLength       The length of data buffer.\r
+  @param  Translator       The transaction translator for low/full speed device.\r
+  @param  Callback         The function to call when data is transferred.\r
+  @param  Context          The context to the callback function.\r
 \r
+  @retval EFI_UNSUPPORTED  The asynchronous isochronous transfer isn't supported.\r
+\r
+**/\r
 EFI_STATUS\r
 UsbHcAsyncIsochronousTransfer (\r
   IN  USB_BUS                             *UsbBus,\r
@@ -174,37 +352,47 @@ UsbHcAsyncIsochronousTransfer (
   IN  VOID                                *Context\r
   );\r
 \r
+/**\r
+  Open the USB host controller protocol BY_CHILD.\r
+\r
+  @param  Bus              The USB bus driver.\r
+  @param  Child            The child handle.\r
 \r
+  @return The open protocol return.\r
+\r
+**/\r
 EFI_STATUS\r
 UsbOpenHostProtoByChild (\r
   IN USB_BUS              *Bus,\r
   IN EFI_HANDLE           Child\r
   );\r
 \r
+/**\r
+  Close the USB host controller protocol BY_CHILD.\r
+\r
+  @param  Bus              The USB bus driver.\r
+  @param  Child            The child handle.\r
 \r
+  @return None.\r
+\r
+**/\r
 VOID\r
 UsbCloseHostProtoByChild (\r
   IN USB_BUS              *Bus,\r
   IN EFI_HANDLE           Child\r
   );\r
 \r
+/**\r
+  return the current TPL, copied from the EDKII glue lib.\r
+\r
+  @param  VOID.\r
 \r
+  @return Current TPL.\r
+\r
+**/\r
 EFI_TPL\r
 UsbGetCurrentTpl (\r
   VOID\r
   );\r
 \r
-\r
-VOID\r
-UsbDebug (\r
-  IN  CHAR8               *Format,\r
-  ...\r
-  );\r
-\r
-\r
-VOID\r
-UsbError (\r
-  IN  CHAR8               *Format,\r
-  ...\r
-  );\r
 #endif\r