]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/PL031RealTimeClockLib: drop ArmPlatformSysConfigLib reference
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 15 Nov 2017 13:04:46 +0000 (13:04 +0000)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 16 Nov 2017 16:22:12 +0000 (16:22 +0000)
The PL031 driver implements a VExpress/Juno specific hack to set the
battery backed clock in addition to the PL031. However, none of the
remaining VExpress based hardware we support in EDK2 actuall implements
this feature so we can just remove it, and get rid of the cumbersome
dependency on ArmPlatform.h.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c
ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf

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
index aa06a41d0b2ad1f782d6244fd31f0b6618ce1647..a3e4f73e7d055aebeae6d68aa4566f4f241d2c9a 100644 (file)
@@ -34,7 +34,6 @@
   UefiLib\r
   DebugLib\r
   PcdLib\r
-  ArmPlatformSysConfigLib\r
   DxeServicesTableLib\r
   TimeBaseLib\r
   UefiRuntimeLib\r