]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c
Clean up to update the reference of the these macros:
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / EhciDxe / EhciReg.c
index b40b0115e9438c863faf40a01460f8275b49a771..87a41e1e889505c8b9e6bbf2ad4f12a5a8145cbc 100644 (file)
@@ -1,5 +1,7 @@
 /** @file\r
 \r
+  The EHCI register operation routines.\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
-    EhciReg.c\r
-\r
-Abstract:\r
-\r
-    The EHCI register operation routines.\r
-\r
-\r
-Revision History\r
-\r
 **/\r
 \r
 \r
@@ -27,12 +18,13 @@ Revision History
 \r
 \r
 /**\r
-  Read  EHCI capability register\r
+  Read EHCI capability register.\r
 \r
-  @param  Ehc          The Ehc device\r
-  @param  Offset       Capability register address\r
+  @param  Ehc          The EHCI device.\r
+  @param  Offset       Capability register address.\r
 \r
-  @return The register content read\r
+  @return The register content read.\r
+  @retval If err, return 0xffff.\r
 \r
 **/\r
 UINT32\r
@@ -63,12 +55,13 @@ EhcReadCapRegister (
 \r
 \r
 /**\r
-  Read  Ehc Operation register\r
+  Read EHCI Operation register.\r
 \r
-  @param  Ehc          The EHCI device\r
-  @param  Offset       The operation register offset\r
+  @param  Ehc          The EHCI device.\r
+  @param  Offset       The operation register offset.\r
 \r
-  @return The register content read\r
+  @return The register content read.\r
+  @retval If err, return 0xffff.\r
 \r
 **/\r
 UINT32\r
@@ -101,13 +94,13 @@ EhcReadOpReg (
 \r
 \r
 /**\r
-  Write  the data to the EHCI operation register\r
+  Write  the data to the EHCI operation register.\r
 \r
-  @param  Ehc          The EHCI device\r
-  @param  Offset       EHCI operation register offset\r
-  @param  Data         The data to write\r
+  @param  Ehc          The EHCI device.\r
+  @param  Offset       EHCI operation register offset.\r
+  @param  Data         The data to write.\r
 \r
-  @return None\r
+  @return None.\r
 \r
 **/\r
 VOID\r
@@ -137,16 +130,15 @@ EhcWriteOpReg (
 \r
 \r
 /**\r
-  Set one bit of the operational register while keeping other bits\r
+  Set one bit of the operational register while keeping other bits.\r
 \r
-  @param  Ehc          The EHCI device\r
-  @param  Offset       The offset of the operational register\r
-  @param  Bit          The bit mask of the register to set\r
+  @param  Ehc          The EHCI device.\r
+  @param  Offset       The offset of the operational register.\r
+  @param  Bit          The bit mask of the register to set.\r
 \r
-  @return None\r
+  @return None.\r
 \r
 **/\r
-STATIC\r
 VOID\r
 EhcSetOpRegBit (\r
   IN USB2_HC_DEV          *Ehc,\r
@@ -163,16 +155,15 @@ EhcSetOpRegBit (
 \r
 \r
 /**\r
-  Clear one bit of the operational register while keeping other bits\r
+  Clear one bit of the operational register while keeping other bits.\r
 \r
-  @param  Ehc          The EHCI device\r
-  @param  Offset       The offset of the operational register\r
-  @param  Bit          The bit mask of the register to clear\r
+  @param  Ehc          The EHCI device.\r
+  @param  Offset       The offset of the operational register.\r
+  @param  Bit          The bit mask of the register to clear.\r
 \r
-  @return None\r
+  @return None.\r
 \r
 **/\r
-STATIC\r
 VOID\r
 EhcClearOpRegBit (\r
   IN USB2_HC_DEV          *Ehc,\r
@@ -190,19 +181,18 @@ EhcClearOpRegBit (
 \r
 /**\r
   Wait the operation register's bit as specified by Bit\r
-  to become set (or clear)\r
+  to become set (or clear).\r
 \r
-  @param  Ehc          The EHCI device\r
-  @param  Offset       The offset of the operation register\r
-  @param  Bit          The bit of the register to wait for\r
-  @param  WaitToSet    Wait the bit to set or clear\r
-  @param  Timeout      The time to wait before abort (in millisecond)\r
+  @param  Ehc          The EHCI device.\r
+  @param  Offset       The offset of the operation register.\r
+  @param  Bit          The bit of the register to wait for.\r
+  @param  WaitToSet    Wait the bit to set or clear.\r
+  @param  Timeout      The time to wait before abort (in millisecond).\r
 \r
-  @retval EFI_SUCCESS  The bit successfully changed by host controller\r
-  @retval EFI_TIMEOUT  The time out occurred\r
+  @retval EFI_SUCCESS  The bit successfully changed by host controller.\r
+  @retval EFI_TIMEOUT  The time out occurred.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EhcWaitOpRegBit (\r
   IN USB2_HC_DEV          *Ehc,\r
@@ -228,11 +218,11 @@ EhcWaitOpRegBit (
 \r
 /**\r
   Add support for UEFI Over Legacy (UoL) feature, stop\r
-  the legacy USB SMI support\r
+  the legacy USB SMI support.\r
 \r
   @param  Ehc          The EHCI device.\r
 \r
-  @return None\r
+  @return None.\r
 \r
 **/\r
 VOID\r
@@ -258,7 +248,7 @@ EhcClearLegacySupport (
   PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, ExtendCap, 1, &Value);\r
 \r
   TimeOut = 40;\r
-  while (TimeOut--) {\r
+  while (TimeOut-- != 0) {\r
     gBS->Stall (500);\r
 \r
     PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, ExtendCap, 1, &Value);\r
@@ -278,11 +268,11 @@ EhcClearLegacySupport (
   Set door bell and wait it to be ACKed by host controller.\r
   This function is used to synchronize with the hardware.\r
 \r
-  @param  Ehc          The EHCI device\r
-  @param  Timeout      The time to wait before abort (in millisecond, ms)\r
+  @param  Ehc          The EHCI device.\r
+  @param  Timeout      The time to wait before abort (in millisecond, ms).\r
 \r
-  @return EFI_SUCCESS : Synchronized with the hardware\r
-  @return EFI_TIMEOUT : Time out happened while waiting door bell to set\r
+  @retval EFI_SUCCESS  Synchronized with the hardware.\r
+  @retval EFI_TIMEOUT  Time out happened while waiting door bell to set.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -314,11 +304,11 @@ EhcSetAndWaitDoorBell (
 \r
 /**\r
   Clear all the interrutp status bits, these bits\r
-  are Write-Clean\r
+  are Write-Clean.\r
 \r
-  @param  Ehc          The EHCI device\r
+  @param  Ehc          The EHCI device.\r
 \r
-  @return None\r
+  @return None.\r
 \r
 **/\r
 VOID\r
@@ -334,14 +324,13 @@ EhcAckAllInterrupt (
   Enable the periodic schedule then wait EHC to\r
   actually enable it.\r
 \r
-  @param  Ehc          The EHCI device\r
-  @param  Timeout      The time to wait before abort (in millisecond, ms)\r
+  @param  Ehc          The EHCI device.\r
+  @param  Timeout      The time to wait before abort (in millisecond, ms).\r
 \r
-  @return EFI_SUCCESS : The periodical schedule is enabled\r
-  @return EFI_TIMEOUT : Time out happened while enabling periodic schedule\r
+  @retval EFI_SUCCESS  The periodical schedule is enabled.\r
+  @retval EFI_TIMEOUT  Time out happened while enabling periodic schedule.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EhcEnablePeriodSchd (\r
   IN USB2_HC_DEV          *Ehc,\r
@@ -357,15 +346,14 @@ EhcEnablePeriodSchd (
 }\r
 \r
 \r
-\r
 /**\r
-  Disable periodic schedule\r
+  Disable periodic schedule.\r
 \r
-  @param  Ehc          The EHCI device\r
-  @param  Timeout      Time to wait before abort (in millisecond, ms)\r
+  @param  Ehc               The EHCI device.\r
+  @param  Timeout           Time to wait before abort (in millisecond, ms).\r
 \r
-  @return EFI_SUCCESS      : Periodic schedule is disabled.\r
-  @return EFI_DEVICE_ERROR : Fail to disable periodic schedule\r
+  @retval EFI_SUCCESS       Periodic schedule is disabled.\r
+  @retval EFI_DEVICE_ERROR  Fail to disable periodic schedule.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -385,16 +373,15 @@ EhcDisablePeriodSchd (
 \r
 \r
 /**\r
-  Enable asynchrounous schedule\r
+  Enable asynchrounous schedule.\r
 \r
-  @param  Ehc          The EHCI device\r
-  @param  Timeout      Time to wait before abort\r
+  @param  Ehc          The EHCI device.\r
+  @param  Timeout      Time to wait before abort.\r
 \r
-  @return EFI_SUCCESS : The EHCI asynchronous schedule is enabled\r
-  @return Others      : Failed to enable the asynchronous scheudle\r
+  @retval EFI_SUCCESS  The EHCI asynchronous schedule is enabled.\r
+  @return Others       Failed to enable the asynchronous scheudle.\r
 \r
 **/\r
-STATIC\r
 EFI_STATUS\r
 EhcEnableAsyncSchd (\r
   IN USB2_HC_DEV          *Ehc,\r
@@ -412,13 +399,13 @@ EhcEnableAsyncSchd (
 \r
 \r
 /**\r
-  Disable asynchrounous schedule\r
+  Disable asynchrounous schedule.\r
 \r
-  @param  Ehc          The EHCI device\r
-  @param  Timeout      Time to wait before abort (in millisecond, ms)\r
+  @param  Ehc          The EHCI device.\r
+  @param  Timeout      Time to wait before abort (in millisecond, ms).\r
 \r
-  @return EFI_SUCCESS : The asynchronous schedule is disabled\r
-  @return Others      : Failed to disable the asynchronous schedule\r
+  @retval EFI_SUCCESS  The asynchronous schedule is disabled.\r
+  @return Others       Failed to disable the asynchronous schedule.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -438,12 +425,12 @@ EhcDisableAsyncSchd (
 \r
 \r
 /**\r
-  Whether Ehc is halted\r
+  Whether Ehc is halted.\r
 \r
-  @param  Ehc          The EHCI device\r
+  @param  Ehc          The EHCI device.\r
 \r
-  @return TRUE  : The controller is halted\r
-  @return FALSE : It isn't halted\r
+  @retval TRUE         The controller is halted.\r
+  @retval FALSE        It isn't halted.\r
 \r
 **/\r
 BOOLEAN\r
@@ -456,12 +443,12 @@ EhcIsHalt (
 \r
 \r
 /**\r
-  Whether system error occurred\r
+  Whether system error occurred.\r
 \r
-  @param  Ehc          The EHCI device\r
+  @param  Ehc          The EHCI device.\r
 \r
-  @return TRUE  : System error happened\r
-  @return FALSE : No system error\r
+  @return TRUE         System error happened.\r
+  @return FALSE        No system error.\r
 \r
 **/\r
 BOOLEAN\r
@@ -474,13 +461,13 @@ EhcIsSysError (
 \r
 \r
 /**\r
-  Reset the host controller\r
+  Reset the host controller.\r
 \r
-  @param  Ehc          The EHCI device\r
-  @param  Timeout      Time to wait before abort (in millisecond, ms)\r
+  @param  Ehc          The EHCI device.\r
+  @param  Timeout      Time to wait before abort (in millisecond, ms).\r
 \r
-  @return EFI_SUCCESS : The host controller is reset\r
-  @return Others      : Failed to reset the host\r
+  @retval EFI_SUCCESS  The host controller is reset.\r
+  @return Others       Failed to reset the host.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -509,13 +496,13 @@ EhcResetHC (
 \r
 \r
 /**\r
-  Halt the host controller\r
+  Halt the host controller.\r
 \r
-  @param  Ehc          The EHCI device\r
-  @param  Timeout      Time to wait before abort\r
+  @param  Ehc          The EHCI device.\r
+  @param  Timeout      Time to wait before abort.\r
 \r
-  @return EFI_SUCCESS : The EHCI is halt\r
-  @return EFI_TIMEOUT : Failed to halt the controller before Timeout\r
+  @retval EFI_SUCCESS  The EHCI is halt.\r
+  @retval EFI_TIMEOUT  Failed to halt the controller before Timeout.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -533,13 +520,13 @@ EhcHaltHC (
 \r
 \r
 /**\r
-  Set the EHCI to run\r
+  Set the EHCI to run.\r
 \r
-  @param  Ehc          The EHCI device\r
-  @param  Timeout      Time to wait before abort\r
+  @param  Ehc          The EHCI device.\r
+  @param  Timeout      Time to wait before abort.\r
 \r
-  @return EFI_SUCCESS : The EHCI is running\r
-  @return Others      : Failed to set the EHCI to run\r
+  @retval EFI_SUCCESS  The EHCI is running.\r
+  @return Others       Failed to set the EHCI to run.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -558,17 +545,17 @@ EhcRunHC (
 \r
 /**\r
   Initialize the HC hardware.\r
-  EHCI spec lists the five things to do to initialize the hardware\r
+  EHCI spec lists the five things to do to initialize the hardware:\r
   1. Program CTRLDSSEGMENT\r
   2. Set USBINTR to enable interrupts\r
   3. Set periodic list base\r
   4. Set USBCMD, interrupt threshold, frame list size etc\r
   5. Write 1 to CONFIGFLAG to route all ports to EHCI\r
 \r
-  @param  Ehc          The EHCI device\r
+  @param  Ehc          The EHCI device.\r
 \r
-  @return EFI_SUCCESS : The EHCI has come out of halt state\r
-  @return EFI_TIMEOUT : Time out happened\r
+  @return EFI_SUCCESS  The EHCI has come out of halt state.\r
+  @return EFI_TIMEOUT  Time out happened.\r
 \r
 **/\r
 EFI_STATUS\r