]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c
ArmPlatformPkg/PL031RealTimeClockLib: drop ArmPlatformSysConfigLib reference
[mirror_edk2.git] / ArmPlatformPkg / Library / PL031RealTimeClockLib / PL031RealTimeClockLib.c
index 459dcc0a0519277f3f921d5ee170d87d895bbb70..1334ad446cd9fea0912869357ea13e4560a33aa8 100644 (file)
@@ -23,7 +23,6 @@
 #include <Library/RealTimeClockLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/PcdLib.h>\r
-#include <Library/ArmPlatformSysConfigLib.h>\r
 #include <Library/DxeServicesTableLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/UefiRuntimeServicesTableLib.h>\r
@@ -38,8 +37,6 @@
 \r
 #include <Library/TimeBaseLib.h>\r
 \r
-#include <ArmPlatform.h>\r
-\r
 STATIC BOOLEAN                mPL031Initialized = FALSE;\r
 STATIC EFI_EVENT              mRtcVirtualAddrChangeEvent;\r
 STATIC UINTN                  mPL031RtcBase;\r
@@ -133,6 +130,11 @@ LibGetTime (
   EFI_STATUS  Status = EFI_SUCCESS;\r
   UINT32      EpochSeconds;\r
 \r
+  // Ensure Time is a valid pointer\r
+  if (Time == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
   // Initialize the hardware if not already done\r
   if (!mPL031Initialized) {\r
     Status = InitializePL031 ();\r
@@ -141,27 +143,7 @@ LibGetTime (
     }\r
   }\r
 \r
-  // Snapshot the time as early in the function call as possible\r
-  // On some platforms we may have access to a battery backed up hardware clock.\r
-  // If such RTC exists try to use it first.\r
-  Status = ArmPlatformSysConfigGet (SYS_CFG_RTC, &EpochSeconds);\r
-  if (Status == EFI_UNSUPPORTED) {\r
-    // Battery backed up hardware RTC does not exist, revert to PL031\r
-    EpochSeconds = MmioRead32 (mPL031RtcBase + PL031_RTC_DR_DATA_REGISTER);\r
-    Status = EFI_SUCCESS;\r
-  } else if (EFI_ERROR (Status)) {\r
-    // Battery backed up hardware RTC exists but could not be read due to error. Abort.\r
-    return Status;\r
-  } else {\r
-    // Battery backed up hardware RTC exists and we read the time correctly from it.\r
-    // Now sync the PL031 to the new time.\r
-    MmioWrite32 (mPL031RtcBase + PL031_RTC_LR_LOAD_REGISTER, EpochSeconds);\r
-  }\r
-\r
-  // Ensure Time is a valid pointer\r
-  if (Time == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
+  EpochSeconds = MmioRead32 (mPL031RtcBase + PL031_RTC_DR_DATA_REGISTER);\r
 \r
   // Adjust for the correct time zone\r
   // The timezone setting also reflects the DST setting of the clock\r
@@ -235,19 +217,6 @@ LibSetTime (
     EpochSeconds -= SEC_PER_HOUR;\r
   }\r
 \r
-  // On some platforms we may have access to a battery backed up hardware clock.\r
-  //\r
-  // If such RTC exists then it must be updated first, before the PL031,\r
-  // to minimise any time drift. This is important because the battery backed-up\r
-  // RTC maintains the master time for the platform across reboots.\r
-  //\r
-  // If such RTC does not exist then the following function returns UNSUPPORTED.\r
-  Status = ArmPlatformSysConfigSet (SYS_CFG_RTC, EpochSeconds);\r
-  if ((EFI_ERROR (Status)) && (Status != EFI_UNSUPPORTED)){\r
-    // Any status message except SUCCESS and UNSUPPORTED indicates a hardware failure.\r
-    return Status;\r
-  }\r
-\r
   // Set the PL031\r
   MmioWrite32 (mPL031RtcBase + PL031_RTC_LR_LOAD_REGISTER, EpochSeconds);\r
 \r