]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcRtc.c
Code scrub:
[mirror_edk2.git] / MdeModulePkg / Universal / PcatRealTimeClockRuntimeDxe / PcRtc.c
index a82f5d133e34ba93187ddc19b91586f7e06bc342..2cba83eef237468636450ef4d031a305cc7e87cd 100644 (file)
@@ -14,88 +14,87 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "PcRtc.h"\r
 \r
+/**\r
+  Compare the Hour, Minute and Second of the From time and the To time.\r
+  \r
+  Only compare H/M/S in EFI_TIME and ignore other fields here.\r
+\r
+  @param From   the first time\r
+  @param To     the second time\r
+\r
+  @return  >0   The H/M/S of the From time is later than those of To time\r
+  @return  ==0  The H/M/S of the From time is same as those of To time\r
+  @return  <0   The H/M/S of the From time is earlier than those of To time\r
+**/\r
 INTN\r
 CompareHMS (\r
   IN EFI_TIME   *From,\r
   IN EFI_TIME   *To\r
   );\r
 \r
+/**\r
+  To check if second date is later than first date within 24 hours.\r
+\r
+  @param  From   the first date\r
+  @param  To     the second date\r
+\r
+  @retval TRUE   From is previous to To within 24 hours.\r
+  @retval FALSE  From is later, or it is previous to To more than 24 hours.\r
+**/\r
 BOOLEAN\r
 IsWithinOneDay (\r
   IN EFI_TIME   *From,\r
   IN EFI_TIME   *To\r
   );\r
 \r
+/**\r
+  Read RTC content through its registers.\r
+\r
+  @param  Address  Address offset of RTC. It is recommended to use macros such as\r
+                   RTC_ADDRESS_SECONDS.\r
+\r
+  @return The data of UINT8 type read from RTC.\r
+**/\r
 UINT8\r
 RtcRead (\r
   IN  UINT8 Address\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
-  Address - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
-  GC_TODO: add return values\r
-\r
---*/\r
 {\r
   IoWrite8 (PCAT_RTC_ADDRESS_REGISTER, (UINT8) (Address | (UINT8) (IoRead8 (PCAT_RTC_ADDRESS_REGISTER) & 0x80)));\r
   return IoRead8 (PCAT_RTC_DATA_REGISTER);\r
 }\r
 \r
+/**\r
+  Write RTC through its registers.\r
+\r
+  @param  Address  Address offset of RTC. It is recommended to use macros such as\r
+                   RTC_ADDRESS_SECONDS.\r
+  @param  Data     The content you want to write into RTC.\r
+\r
+**/\r
 VOID\r
 RtcWrite (\r
   IN  UINT8   Address,\r
   IN  UINT8   Data\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
-  Address - GC_TODO: add argument description\r
-  Data    - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
-  GC_TODO: add return values\r
-\r
---*/\r
 {\r
   IoWrite8 (PCAT_RTC_ADDRESS_REGISTER, (UINT8) (Address | (UINT8) (IoRead8 (PCAT_RTC_ADDRESS_REGISTER) & 0x80)));\r
   IoWrite8 (PCAT_RTC_DATA_REGISTER, Data);\r
 }\r
 \r
+/**\r
+  Initialize RTC.\r
+\r
+  @param  Global            For global use inside this module.\r
+\r
+  @retval EFI_DEVICE_ERROR  Initialization failed due to device error.\r
+  @retval EFI_SUCCESS       Initialization successful.\r
+\r
+**/\r
 EFI_STATUS\r
 PcRtcInit (\r
   IN PC_RTC_MODULE_GLOBALS  *Global\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
-  Global  - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
-  EFI_DEVICE_ERROR - GC_TODO: Add description for return value\r
-  EFI_SUCCESS - GC_TODO: Add description for return value\r
-\r
---*/\r
 {\r
   EFI_STATUS      Status;\r
   RTC_REGISTER_A  RegisterA;\r
@@ -112,7 +111,7 @@ Returns:
   //BugBug: the EfiAtRuntime should be encapsulated in EfiAcquireLock or\r
   //        provide a new instance for EfiAcquireLock, say, RtEfiAcquireLock\r
   if (!EfiAtRuntime ()) {\r
-  EfiAcquireLock (&Global->RtcLock);\r
+    EfiAcquireLock (&Global->RtcLock);\r
   }\r
   //\r
   // Initialize RTC Register\r
@@ -147,7 +146,7 @@ Returns:
        //BugBug: the EfiAtRuntime should be encapsulated in EfiAcquireLock or\r
     //        provide a new instance for EfiAcquireLock, say, RtEfiAcquireLock\r
     if (!EfiAtRuntime ()) {\r
-    EfiReleaseLock (&Global->RtcLock);\r
+      EfiReleaseLock (&Global->RtcLock);\r
     }\r
     return EFI_DEVICE_ERROR;\r
   }\r
@@ -180,7 +179,7 @@ Returns:
   //        provide a new instance for EfiAcquireLock, say, RtEfiAcquireLock\r
   //\r
   if (!EfiAtRuntime ()) {\r
-  EfiReleaseLock (&Global->RtcLock);\r
+    EfiReleaseLock (&Global->RtcLock);\r
   }\r
  \r
   //\r
@@ -225,26 +224,26 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
-EFI_STATUS\r
-PcRtcGetTime (\r
-  OUT EFI_TIME              *Time,\r
-  IN  EFI_TIME_CAPABILITIES *Capabilities,\r
-  IN  PC_RTC_MODULE_GLOBALS *Global\r
-  )\r
-/*++\r
+/**\r
+  Returns the current time and date information, and the time-keeping capabilities\r
+  of the hardware platform.\r
 \r
-Routine Description:\r
+  @param  Time          A pointer to storage to receive a snapshot of the current time.\r
+  @param  Capabilities  An optional pointer to a buffer to receive the real time clock\r
+                        device's capabilities.\r
+  @param  Global        For global use inside this module.\r
 \r
-  Arguments:\r
+  @retval EFI_SUCCESS            The operation completed successfully.\r
+  @retval EFI_INVALID_PARAMETER  Time is NULL.\r
+  @retval EFI_DEVICE_ERROR       The time could not be retrieved due to hardware error.\r
 \r
-  Returns:\r
---*/\r
-// GC_TODO:    Time - add argument and description to function comment\r
-// GC_TODO:    Capabilities - add argument and description to function comment\r
-// GC_TODO:    Global - add argument and description to function comment\r
-// GC_TODO:    EFI_INVALID_PARAMETER - add return value to function comment\r
-// GC_TODO:    EFI_DEVICE_ERROR - add return value to function comment\r
-// GC_TODO:    EFI_SUCCESS - add return value to function comment\r
+**/\r
+EFI_STATUS\r
+PcRtcGetTime (\r
+  OUT  EFI_TIME               *Time,\r
+  OUT  EFI_TIME_CAPABILITIES  *Capabilities,  OPTIONAL\r
+  IN   PC_RTC_MODULE_GLOBALS  *Global\r
+  )\r
 {\r
   EFI_STATUS      Status;\r
   RTC_REGISTER_B  RegisterB;\r
@@ -263,7 +262,7 @@ Routine Description:
   //BugBug: the EfiAtRuntime should be encapsulated in EfiAcquireLock or\r
   //        provide a new instance for EfiAcquireLock, say, RtEfiAcquireLock\r
   if (!EfiAtRuntime ()) {\r
-  EfiAcquireLock (&Global->RtcLock);\r
+    EfiAcquireLock (&Global->RtcLock);\r
   }\r
   //\r
   // Wait for up to 0.1 seconds for the RTC to be updated\r
@@ -273,7 +272,7 @@ Routine Description:
          //BugBug: the EfiAtRuntime should be encapsulated in EfiReleaseLock or\r
       //        provide a new instance for EfiReleaseLock, say, RtEfiReleaseLock\r
       if (!EfiAtRuntime ()) {\r
-    EfiReleaseLock (&Global->RtcLock);\r
+        EfiReleaseLock (&Global->RtcLock);\r
       }\r
     return Status;\r
   }\r
@@ -304,7 +303,7 @@ Routine Description:
   //BugBug: the EfiAtRuntime should be encapsulated in EfiReleaseLock or\r
   //        provide a new instance for EfiReleaseLock, say, RtEfiReleaseLock\r
   if (!EfiAtRuntime ()) {\r
-  EfiReleaseLock (&Global->RtcLock);\r
+    EfiReleaseLock (&Global->RtcLock);\r
   }\r
   //\r
   // Get the variable that containts the TimeZone and Daylight fields\r
@@ -325,7 +324,7 @@ Routine Description:
   //\r
   //  Fill in Capabilities if it was passed in\r
   //\r
-  if (Capabilities) {\r
+  if (Capabilities != NULL) {\r
     Capabilities->Resolution = 1;\r
     //\r
     // 1 hertz\r
@@ -340,22 +339,22 @@ Routine Description:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Sets the current local time and date information.\r
+\r
+  @param  Time                  A pointer to the current time.\r
+  @param  Global                For global use inside this module.\r
+\r
+  @retval EFI_SUCCESS           The operation completed successfully.\r
+  @retval EFI_INVALID_PARAMETER A time field is out of range.\r
+  @retval EFI_DEVICE_ERROR      The time could not be set due due to hardware error.\r
+\r
+**/\r
 EFI_STATUS\r
 PcRtcSetTime (\r
   IN EFI_TIME                *Time,\r
   IN PC_RTC_MODULE_GLOBALS   *Global\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Arguments:\r
-\r
-  Returns:\r
---*/\r
-// GC_TODO:    Time - add argument and description to function comment\r
-// GC_TODO:    Global - add argument and description to function comment\r
-// GC_TODO:    EFI_INVALID_PARAMETER - add return value to function comment\r
 {\r
   EFI_STATUS      Status;\r
   EFI_TIME        RtcTime;\r
@@ -382,7 +381,7 @@ Routine Description:
   //BugBug: the EfiAtRuntime should be encapsulated in EfiAcquireLock or\r
   //        provide a new instance for EfiAcquireLock, say, RtEfiAcquireLock\r
   if (!EfiAtRuntime ()) {\r
-  EfiAcquireLock (&Global->RtcLock);\r
+    EfiAcquireLock (&Global->RtcLock);\r
   }\r
   //\r
   // Wait for up to 0.1 seconds for the RTC to be updated\r
@@ -429,7 +428,7 @@ Routine Description:
   //BugBug: the EfiAtRuntime should be encapsulated in EfiReleaseLock or\r
   //        provide a new instance for EfiReleaseLock, say, RtEfiReleaseLock\r
   if (!EfiAtRuntime ()) {\r
-  EfiReleaseLock (&Global->RtcLock);\r
+    EfiReleaseLock (&Global->RtcLock);\r
   }\r
   //\r
   // Set the variable that containts the TimeZone and Daylight fields\r
@@ -451,31 +450,29 @@ Routine Description:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Returns the current wakeup alarm clock setting.\r
+\r
+  @param  Enabled  Indicates if the alarm is currently enabled or disabled.\r
+  @param  Pending  Indicates if the alarm signal is pending and requires acknowledgement.\r
+  @param  Time     The current alarm setting.\r
+  @param  Global   For global use inside this module.\r
+\r
+  @retval EFI_SUCCESS           The alarm settings were returned.\r
+  @retval EFI_INVALID_PARAMETER Enabled is NULL.\r
+  @retval EFI_INVALID_PARAMETER Pending is NULL.\r
+  @retval EFI_INVALID_PARAMETER Time is NULL.\r
+  @retval EFI_DEVICE_ERROR      The wakeup time could not be retrieved due to a hardware error.\r
+  @retval EFI_UNSUPPORTED       A wakeup timer is not supported on this platform.\r
+\r
+**/\r
 EFI_STATUS\r
 PcRtcGetWakeupTime (\r
   OUT BOOLEAN                *Enabled,\r
   OUT BOOLEAN                *Pending,\r
   OUT EFI_TIME               *Time,\r
-  IN PC_RTC_MODULE_GLOBALS   *Global\r
+  IN  PC_RTC_MODULE_GLOBALS  *Global\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Arguments:\r
-\r
-\r
-\r
-Returns:\r
---*/\r
-// GC_TODO:    Enabled - add argument and description to function comment\r
-// GC_TODO:    Pending - add argument and description to function comment\r
-// GC_TODO:    Time - add argument and description to function comment\r
-// GC_TODO:    Global - add argument and description to function comment\r
-// GC_TODO:    EFI_INVALID_PARAMETER - add return value to function comment\r
-// GC_TODO:    EFI_DEVICE_ERROR - add return value to function comment\r
-// GC_TODO:    EFI_DEVICE_ERROR - add return value to function comment\r
-// GC_TODO:    EFI_SUCCESS - add return value to function comment\r
 {\r
   EFI_STATUS      Status;\r
   RTC_REGISTER_B  RegisterB;\r
@@ -495,7 +492,7 @@ Returns:
   //BugBug: the EfiAtRuntime should be encapsulated in EfiAcquireLock or\r
   //        provide a new instance for EfiAcquireLock, say, RtEfiAcquireLock\r
   if (!EfiAtRuntime ()) {\r
-  EfiAcquireLock (&Global->RtcLock);\r
+    EfiAcquireLock (&Global->RtcLock);\r
   }\r
   //\r
   // Wait for up to 0.1 seconds for the RTC to be updated\r
@@ -547,7 +544,7 @@ Returns:
   //BugBug: the EfiAtRuntime should be encapsulated in EfiReleaseLock or\r
   //        provide a new instance for EfiReleaseLock, say, RtEfiReleaseLock\r
   if (!EfiAtRuntime ()) {\r
-  EfiReleaseLock (&Global->RtcLock);\r
+    EfiReleaseLock (&Global->RtcLock);\r
   }\r
   //\r
   // Make sure all field values are in correct range\r
@@ -565,30 +562,27 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Sets the system wakeup alarm clock time.\r
+\r
+  @param  Enabled  Enable or disable the wakeup alarm.\r
+  @param  Time     If Enable is TRUE, the time to set the wakeup alarm for.\r
+                   If Enable is FALSE, then this parameter is optional, and may be NULL.\r
+  @param  Global   For global use inside this module.\r
+\r
+  @retval EFI_SUCCESS           If Enable is TRUE, then the wakeup alarm was enabled.\r
+                                If Enable is FALSE, then the wakeup alarm was disabled.\r
+  @retval EFI_INVALID_PARAMETER A time field is out of range.\r
+  @retval EFI_DEVICE_ERROR      The wakeup time could not be set due to a hardware error.\r
+  @retval EFI_UNSUPPORTED       A wakeup timer is not supported on this platform.\r
+\r
+**/\r
 EFI_STATUS\r
 PcRtcSetWakeupTime (\r
   IN BOOLEAN                Enable,\r
-  OUT EFI_TIME              *Time,\r
+  IN EFI_TIME               *Time,   OPTIONAL\r
   IN PC_RTC_MODULE_GLOBALS  *Global\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Arguments:\r
-\r
-\r
-\r
-Returns:\r
---*/\r
-// GC_TODO:    Enable - add argument and description to function comment\r
-// GC_TODO:    Time - add argument and description to function comment\r
-// GC_TODO:    Global - add argument and description to function comment\r
-// GC_TODO:    EFI_INVALID_PARAMETER - add return value to function comment\r
-// GC_TODO:    EFI_INVALID_PARAMETER - add return value to function comment\r
-// GC_TODO:    EFI_UNSUPPORTED - add return value to function comment\r
-// GC_TODO:    EFI_DEVICE_ERROR - add return value to function comment\r
-// GC_TODO:    EFI_SUCCESS - add return value to function comment\r
 {\r
   EFI_STATUS            Status;\r
   EFI_TIME              RtcTime;\r
@@ -627,7 +621,7 @@ Returns:
   //BugBug: the EfiAtRuntime should be encapsulated in EfiAcquireLock or\r
   //        provide a new instance for EfiAcquireLock, say, RtEfiAcquireLock\r
   if (!EfiAtRuntime ()) {\r
-  EfiAcquireLock (&Global->RtcLock);\r
+    EfiAcquireLock (&Global->RtcLock);\r
   }\r
   //\r
   // Wait for up to 0.1 seconds for the RTC to be updated\r
@@ -676,35 +670,26 @@ Returns:
   //BugBug: the EfiAtRuntime should be encapsulated in EfiReleaseLock or\r
   //        provide a new instance for EfiReleaseLock, say, RtEfiReleaseLock\r
   if (!EfiAtRuntime ()) {\r
-  EfiReleaseLock (&Global->RtcLock);\r
+    EfiReleaseLock (&Global->RtcLock);\r
   }\r
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  See if centry register of RTC is valid.\r
+\r
+  @retval  EFI_SUCCESS       Century register is valid.\r
+  @retval  EFI_DEVICE_ERROR  Century register is NOT valid.\r
+**/\r
 EFI_STATUS\r
 RtcTestCenturyRegister (\r
   VOID\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Arguments:\r
-\r
-\r
-\r
-Returns:\r
---*/\r
-// GC_TODO:    EFI_SUCCESS - add return value to function comment\r
-// GC_TODO:    EFI_DEVICE_ERROR - add return value to function comment\r
 {\r
   UINT8 Century;\r
   UINT8 Temp;\r
 \r
   Century = RtcRead (RTC_ADDRESS_CENTURY);\r
-  //\r
-  //  RtcWrite (RTC_ADDRESS_CENTURY, 0x00);\r
-  //\r
   Temp = (UINT8) (RtcRead (RTC_ADDRESS_CENTURY) & 0x7f);\r
   RtcWrite (RTC_ADDRESS_CENTURY, Century);\r
   if (Temp == 0x19 || Temp == 0x20) {\r
@@ -721,10 +706,9 @@ Returns:
   If valid, the function converts it to an 8-bit value and returns it.\r
   Otherwise, return 0xff.\r
 \r
-  @param  Value The 8-bit BCD value to check and convert\r
+  @param   Value The 8-bit BCD value to check and convert\r
 \r
-  @return The 8-bit value converted.\r
-          0xff if Value is invalid.\r
+  @return  The 8-bit value converted. Or 0xff if Value is invalid.\r
 \r
 **/\r
 UINT8\r
@@ -753,6 +737,9 @@ CheckAndConvertBcd8ToDecimal8 (
   @param   RegisterB  Value of Register B of RTC, indicating data mode\r
                       and hour format.\r
 \r
+  @retval  EFI_INVALID_PARAMETER  Parameters passed in are invalid.\r
+  @retval  EFI_SUCCESS            Convert RTC time to EFI time successfully.\r
+\r
 **/\r
 EFI_STATUS\r
 ConvertRtcTimeToEfiTime (\r
@@ -761,12 +748,12 @@ ConvertRtcTimeToEfiTime (
   IN     RTC_REGISTER_B  RegisterB\r
   )\r
 {\r
-  BOOLEAN PM;\r
+  BOOLEAN IsPM;\r
 \r
   if ((Time->Hour) & 0x80) {\r
-    PM = TRUE;\r
+    IsPM = TRUE;\r
   } else {\r
-    PM = FALSE;\r
+    IsPM = FALSE;\r
   }\r
 \r
   Time->Hour = (UINT8) (Time->Hour & 0x7f);\r
@@ -793,11 +780,11 @@ ConvertRtcTimeToEfiTime (
   // If time is in 12 hour format, convert it to 24 hour format\r
   //\r
   if (RegisterB.Bits.MIL == 0) {\r
-    if (PM && Time->Hour < 12) {\r
+    if (IsPM && Time->Hour < 12) {\r
       Time->Hour = (UINT8) (Time->Hour + 12);\r
     }\r
 \r
-    if (!PM && Time->Hour == 12) {\r
+    if (!IsPM && Time->Hour == 12) {\r
       Time->Hour = 0;\r
     }\r
   }\r
@@ -809,23 +796,18 @@ ConvertRtcTimeToEfiTime (
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Wait for a period for the RTC to be ready.\r
+\r
+  @param    Timeout  Tell how long it should take to wait.\r
+\r
+  @retval   EFI_DEVICE_ERROR   RTC device error.\r
+  @retval   EFI_SUCCESS        RTC is updated and ready.  \r
+**/\r
 EFI_STATUS\r
 RtcWaitToUpdate (\r
   UINTN Timeout\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Arguments:\r
-\r
-\r
-Returns:\r
---*/\r
-// GC_TODO:    Timeout - add argument and description to function comment\r
-// GC_TODO:    EFI_DEVICE_ERROR - add return value to function comment\r
-// GC_TODO:    EFI_DEVICE_ERROR - add return value to function comment\r
-// GC_TODO:    EFI_SUCCESS - add return value to function comment\r
 {\r
   RTC_REGISTER_A  RegisterA;\r
   RTC_REGISTER_D  RegisterD;\r
@@ -857,21 +839,19 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  See if all fields of a variable of EFI_TIME type is correct.\r
+\r
+  @param   Time   The time to be checked.\r
+\r
+  @retval  EFI_INVALID_PARAMETER  Some fields of Time are not correct.\r
+  @retval  EFI_SUCCESS            Time is a valid EFI_TIME variable.\r
+\r
+**/\r
 EFI_STATUS\r
 RtcTimeFieldsValid (\r
   IN EFI_TIME *Time\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Arguments:\r
-\r
-  Returns:\r
---*/\r
-// GC_TODO:    Time - add argument and description to function comment\r
-// GC_TODO:    EFI_INVALID_PARAMETER - add return value to function comment\r
-// GC_TODO:    EFI_SUCCESS - add return value to function comment\r
 {\r
   if (Time->Year < 1998 ||\r
       Time->Year > 2099 ||\r
@@ -891,25 +871,18 @@ Routine Description:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  See if field Day of an EFI_TIME is correct.\r
+\r
+  @param    Time   Its Day field is to be checked.\r
+\r
+  @retval   TRUE   Day field of Time is correct.\r
+  @retval   FALSE  Day field of Time is NOT correct.\r
+**/\r
 BOOLEAN\r
 DayValid (\r
   IN  EFI_TIME  *Time\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
-  Time  - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
-  GC_TODO: add return values\r
-\r
---*/\r
 {\r
   INTN  DayOfMonth[12];\r
 \r
@@ -936,25 +909,18 @@ Returns:
   return TRUE;\r
 }\r
 \r
+/**\r
+  Check if it is a leapyear.\r
+\r
+  @param    Time   The time to be checked.\r
+\r
+  @retval   TRUE   It is a leapyear.\r
+  @retval   FALSE  It is NOT a leapyear.\r
+**/\r
 BOOLEAN\r
 IsLeapYear (\r
   IN EFI_TIME   *Time\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
-  Time  - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
-  GC_TODO: add return values\r
-\r
---*/\r
 {\r
   if (Time->Year % 4 == 0) {\r
     if (Time->Year % 100 == 0) {\r
@@ -971,34 +937,35 @@ Returns:
   }\r
 }\r
 \r
-VOID\r
-ConvertEfiTimeToRtcTime (\r
-  IN EFI_TIME       *Time,\r
-  IN RTC_REGISTER_B RegisterB,\r
-  IN UINT8          *Century\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
+  Converts time from EFI_TIME format defined by UEFI spec to RTC's.\r
 \r
-  Arguments:\r
+  This function converts time from EFI_TIME format defined by UEFI spec to RTC's.\r
+  If data mode of RTC is BCD, then converts EFI_TIME to it.\r
+  If RTC is in 12-hour format, then converts EFI_TIME to it.\r
 \r
+  @param   Time       On input, the time data read from UEFI to convert\r
+                      On output, the time converted to RTC format\r
+  @param   RegisterB  Value of Register B of RTC, indicating data mode\r
+  @param   Century    It is set according to EFI_TIME Time.\r
 \r
-Returns:\r
---*/\r
-// GC_TODO:    Time - add argument and description to function comment\r
-// GC_TODO:    RegisterB - add argument and description to function comment\r
-// GC_TODO:    Century - add argument and description to function comment\r
+**/\r
+VOID\r
+ConvertEfiTimeToRtcTime (\r
+  IN OUT EFI_TIME        *Time,\r
+  IN     RTC_REGISTER_B  RegisterB,\r
+     OUT UINT8           *Century\r
+  )\r
 {\r
-  BOOLEAN PM;\r
+  BOOLEAN IsPM;\r
 \r
-  PM = TRUE;\r
+  IsPM = TRUE;\r
   //\r
-  // Adjust hour field if RTC in in 12 hour mode\r
+  // Adjust hour field if RTC is in 12 hour mode\r
   //\r
   if (RegisterB.Bits.MIL == 0) {\r
     if (Time->Hour < 12) {\r
-      PM = FALSE;\r
+      IsPM = FALSE;\r
     }\r
 \r
     if (Time->Hour >= 13) {\r
@@ -1025,35 +992,28 @@ Returns:
   //\r
   // If we are in 12 hour mode and PM is set, then set bit 7 of the Hour field.\r
   //\r
-  if (RegisterB.Bits.MIL == 0 && PM) {\r
+  if (RegisterB.Bits.MIL == 0 && IsPM) {\r
     Time->Hour = (UINT8) (Time->Hour | 0x80);\r
   }\r
 }\r
 \r
+/**\r
+  Compare the Hour, Minute and Second of the From time and the To time.\r
+  \r
+  Only compare H/M/S in EFI_TIME and ignore other fields here.\r
+\r
+  @param From   the first time\r
+  @param To     the second time\r
+\r
+  @return  >0   The H/M/S of the From time is later than those of To time\r
+  @return  ==0  The H/M/S of the From time is same as those of To time\r
+  @return  <0   The H/M/S of the From time is earlier than those of To time\r
+**/\r
 INTN\r
 CompareHMS (\r
   IN EFI_TIME   *From,\r
   IN EFI_TIME   *To\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Compare the Hour, Minute and Second of the 'From' time and the 'To' time.\r
-  Only compare H/M/S in EFI_TIME and ignore other fields here.\r
-\r
-Arguments:\r
-\r
-  From  -   the first time\r
-  To    -   the second time\r
-\r
-Returns:\r
-\r
-  >0   : The H/M/S of the 'From' time is later than those of 'To' time\r
-  ==0  : The H/M/S of the 'From' time is same as those of 'To' time\r
-  <0   : The H/M/S of the 'From' time is earlier than those of 'To' time\r
-\r
---*/\r
 {\r
   if ((From->Hour > To->Hour) ||\r
      ((From->Hour == To->Hour) && (From->Minute > To->Minute)) ||\r
@@ -1066,28 +1026,20 @@ Returns:
   }\r
 }\r
 \r
+/**\r
+  To check if second date is later than first date within 24 hours.\r
+\r
+  @param  From   the first date\r
+  @param  To     the second date\r
+\r
+  @retval TRUE   From is previous to To within 24 hours.\r
+  @retval FALSE  From is later, or it is previous to To more than 24 hours.\r
+**/\r
 BOOLEAN\r
 IsWithinOneDay (\r
   IN EFI_TIME  *From,\r
   IN EFI_TIME  *To\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Judge whether two days are adjacent.\r
-\r
-Arguments:\r
-\r
-  From  -   the first day\r
-  To    -   the second day\r
-\r
-Returns:\r
-\r
-  TRUE  -   The interval of two days are within one day.\r
-  FALSE -   The interval of two days exceed ony day or parameter error.\r
-\r
---*/\r
 {\r
   UINT8   DayOfMonth[12];\r
   BOOLEAN Adjacent;\r