]> git.proxmox.com Git - mirror_edk2.git/blobdiff - PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
Revert the changes made in 14403 because it incorrectly changed the EOL.
[mirror_edk2.git] / PcAtChipsetPkg / PcatRealTimeClockRuntimeDxe / PcRtc.c
index 35eb60ade486e265387c303d296a00d7513205a5..ab4ea8206a10d5dce81bc8fb325a9b78e33e1454 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   RTC Architectural Protocol GUID as defined in DxeCis 0.96.\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -141,6 +141,11 @@ PcRtcInit (
   //\r
   Status = RtcWaitToUpdate (PcdGet32 (PcdRealTimeClockUpdateTimeout));\r
   if (EFI_ERROR (Status)) {\r
+    //\r
+    // Set the variable with default value if the RTC is functioning incorrectly.\r
+    //\r
+    Global->SavedTimeZone = EFI_UNSPECIFIED_TIMEZONE;\r
+    Global->Daylight      = 0;\r
     if (!EfiAtRuntime ()) {\r
       EfiReleaseLock (&Global->RtcLock);\r
     }\r
@@ -199,6 +204,13 @@ PcRtcInit (
     Status = RtcTimeFieldsValid (&Time);\r
   }\r
   if (EFI_ERROR (Status)) {\r
+    //\r
+    // Report Status Code to indicate that the RTC has bad date and time\r
+    //\r
+    REPORT_STATUS_CODE (\r
+      EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
+      (EFI_SOFTWARE_DXE_RT_DRIVER | EFI_SW_EC_BAD_DATE_TIME)\r
+      );\r
     Time.Second = RTC_INIT_SECOND;\r
     Time.Minute = RTC_INIT_MINUTE;\r
     Time.Hour   = RTC_INIT_HOUR;\r
@@ -206,6 +218,8 @@ PcRtcInit (
     Time.Month  = RTC_INIT_MONTH;\r
     Time.Year   = RTC_INIT_YEAR;\r
     Time.Nanosecond  = 0;\r
+    Time.TimeZone = EFI_UNSPECIFIED_TIMEZONE;\r
+    Time.Daylight = 0;\r
   }\r
 \r
   //\r
@@ -234,7 +248,6 @@ PcRtcInit (
 \r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 PcRtcGetTime (\r
   OUT  EFI_TIME               *Time,\r
   OUT  EFI_TIME_CAPABILITIES  *Capabilities,  OPTIONAL\r
@@ -339,7 +352,6 @@ PcRtcGetTime (
 \r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 PcRtcSetTime (\r
   IN EFI_TIME                *Time,\r
   IN PC_RTC_MODULE_GLOBALS   *Global\r
@@ -416,7 +428,7 @@ PcRtcSetTime (
   Global->Daylight      = Time->Daylight;\r
 \r
   TimerVar = Time->Daylight;\r
-  TimerVar = (UINT32) ((TimerVar << 16) | Time->TimeZone);\r
+  TimerVar = (UINT32) ((TimerVar << 16) | (UINT16)(Time->TimeZone));\r
   Status =  EfiSetVariable (\r
               L"RTC",\r
               &gEfiCallerIdGuid,\r
@@ -509,6 +521,7 @@ PcRtcGetWakeupTime (
   //\r
   // Get the alarm info from variable\r
   //\r
+  DataSize = sizeof (EFI_TIME);\r
   Status = EfiGetVariable (\r
               L"RTCALARM",\r
               &gEfiCallerIdGuid,\r
@@ -562,7 +575,6 @@ PcRtcGetWakeupTime (
 \r
 **/\r
 EFI_STATUS\r
-EFIAPI\r
 PcRtcSetWakeupTime (\r
   IN BOOLEAN                Enable,\r
   IN EFI_TIME               *Time,   OPTIONAL\r
@@ -575,7 +587,7 @@ PcRtcSetWakeupTime (
   UINT8                 Century;\r
   EFI_TIME_CAPABILITIES Capabilities;\r
 \r
-  ZeroMem (RtcTime);\r
+  ZeroMem (&RtcTime, sizeof (RtcTime));\r
 \r
   if (Enable) {\r
 \r