]> git.proxmox.com Git - mirror_edk2.git/blobdiff - PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
BaseTools/BinToPcd: Fix Python 2.7.x compatibility issue
[mirror_edk2.git] / PcAtChipsetPkg / PcatRealTimeClockRuntimeDxe / PcRtc.c
index c032e16217c3d858b93186a5cf49eae8bd21833e..2105acf35f7b78f75172a18ea14f49e0e1fbd461 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   RTC Architectural Protocol GUID as defined in DxeCis 0.96.\r
 \r
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 Copyright (c) 2017, AMD Inc. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
@@ -28,7 +28,7 @@ CHAR16 mTimeZoneVariableName[] = L"RTC";
 \r
 /**\r
   Compare the Hour, Minute and Second of the From time and the To time.\r
-  \r
+\r
   Only compare H/M/S in EFI_TIME and ignore other fields here.\r
 \r
   @param From   the first time\r
@@ -72,8 +72,8 @@ RtcRead (
   IN  UINT8 Address\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
+  IoWrite8 (PcdGet8 (PcdRtcIndexRegister), (UINT8) (Address | (UINT8) (IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x80)));\r
+  return IoRead8 (PcdGet8 (PcdRtcTargetRegister));\r
 }\r
 \r
 /**\r
@@ -90,8 +90,8 @@ RtcWrite (
   IN  UINT8   Data\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
+  IoWrite8 (PcdGet8 (PcdRtcIndexRegister), (UINT8) (Address | (UINT8) (IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x80)));\r
+  IoWrite8 (PcdGet8 (PcdRtcTargetRegister), Data);\r
 }\r
 \r
 /**\r
@@ -187,7 +187,7 @@ PcRtcInit (
   if (!EfiAtRuntime ()) {\r
     EfiReleaseLock (&Global->RtcLock);\r
   }\r
\r
+\r
   //\r
   // Get the data of Daylight saving and time zone, if they have been\r
   // stored in NV variable during previous boot.\r
@@ -205,7 +205,7 @@ PcRtcInit (
     Time.Daylight = (UINT8) (TimerVar >> 16);\r
   } else {\r
     Time.TimeZone = EFI_UNSPECIFIED_TIMEZONE;\r
-    Time.Daylight = 0;  \r
+    Time.Daylight = 0;\r
   }\r
 \r
   //\r
@@ -241,7 +241,7 @@ PcRtcInit (
   if (EFI_ERROR (Status)) {\r
     return EFI_DEVICE_ERROR;\r
   }\r
-  \r
+\r
   //\r
   // Reset wakeup time value to valid state when wakeup alarm is disabled and wakeup time is invalid.\r
   // Global variable has already had valid SavedTimeZone and Daylight,\r
@@ -251,9 +251,9 @@ PcRtcInit (
   if ((Enabled) || (!EFI_ERROR (Status))) {\r
     return EFI_SUCCESS;\r
   }\r
-  \r
+\r
   //\r
-  // When wakeup time is disabled and invalid, reset wakeup time register to valid state \r
+  // When wakeup time is disabled and invalid, reset wakeup time register to valid state\r
   // but keep wakeup alarm disabled.\r
   //\r
   Time.Second = RTC_INIT_SECOND;\r
@@ -301,13 +301,13 @@ PcRtcInit (
     }\r
     return EFI_DEVICE_ERROR;\r
   }\r
-  \r
+\r
   //\r
   // Inhibit updates of the RTC\r
   //\r
   RegisterB.Bits.Set  = 1;\r
   RtcWrite (RTC_ADDRESS_REGISTER_B, RegisterB.Data);\r
\r
+\r
   //\r
   // Set RTC alarm time registers\r
   //\r
@@ -320,7 +320,7 @@ PcRtcInit (
   //\r
   RegisterB.Bits.Set = 0;\r
   RtcWrite (RTC_ADDRESS_REGISTER_B, RegisterB.Data);\r
\r
+\r
   //\r
   // Release RTC Lock.\r
   //\r
@@ -485,7 +485,7 @@ PcRtcSetTime (
      }\r
     return Status;\r
   }\r
-  \r
+\r
   //\r
   // Write timezone and daylight to RTC variable\r
   //\r
@@ -789,7 +789,7 @@ PcRtcSetWakeupTime (
     }\r
     return EFI_DEVICE_ERROR;\r
   }\r
-  \r
+\r
   //\r
   // Inhibit updates of the RTC\r
   //\r
@@ -932,7 +932,7 @@ ConvertRtcTimeToEfiTime (
   @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
+  @retval   EFI_SUCCESS        RTC is updated and ready.\r
 **/\r
 EFI_STATUS\r
 RtcWaitToUpdate (\r
@@ -1113,7 +1113,7 @@ ConvertEfiTimeToRtcTime (
 \r
 /**\r
   Compare the Hour, Minute and Second of the From time and the To time.\r
-  \r
+\r
   Only compare H/M/S in EFI_TIME and ignore other fields here.\r
 \r
   @param From   the first time\r
@@ -1164,7 +1164,7 @@ IsWithinOneDay (
   //\r
   ASSERT (From->Month >=1);\r
   ASSERT (From->Month <=12);\r
-  \r
+\r
   if (From->Year == To->Year) {\r
     if (From->Month == To->Month) {\r
       if ((From->Day + 1) == To->Day) {\r