public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v1 0/1] PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD
@ 2023-05-22  2:14 Guo, Gua
  2023-05-22  2:14 ` [PATCH v1 1/1] " Guo, Gua
  0 siblings, 1 reply; 2+ messages in thread
From: Guo, Gua @ 2023-05-22  2:14 UTC (permalink / raw)
  To: devel; +Cc: gua.guo

From: Gua Guo <gua.guo@intel.com>

PR: https://github.com/tianocore/edk2/pull/4416

V1: After https://bugzilla.tianocore.org/show_bug.cgi?id=4193
RTC Runtime Services unable to get correct RTC time.
Solution: Cache RTC data, update RTC driver not to use PcdGet after driver init.

Gua Guo (1):
  PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD

 .../PcatRealTimeClockRuntimeDxe/PcRtc.c           | 15 ++++++++-------
 .../PcatRealTimeClockRuntimeDxe/PcRtcEntry.c      |  5 +++++
 2 files changed, 13 insertions(+), 7 deletions(-)

--
2.39.2.windows.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH v1 1/1] PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD
  2023-05-22  2:14 [PATCH v1 0/1] PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD Guo, Gua
@ 2023-05-22  2:14 ` Guo, Gua
  0 siblings, 0 replies; 2+ messages in thread
From: Guo, Gua @ 2023-05-22  2:14 UTC (permalink / raw)
  To: devel; +Cc: gua.guo, Ray Ni, Michael D Kinney

From: Gua Guo <gua.guo@intel.com>

RTC runtime is unable to get dynamic PCD value after booting to
OS using runtime services.

Resolution: Cache the dynamic PCD value in RTC driver entry point

Cc: Ray Ni <ray.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Gua Guo <gua.guo@intel.com>
---
 .../PcatRealTimeClockRuntimeDxe/PcRtc.c           | 15 ++++++++-------
 .../PcatRealTimeClockRuntimeDxe/PcRtcEntry.c      |  5 +++++
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index d8b9fa8376..3f114dce5d 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -13,7 +13,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 extern UINTN  mRtcIndexRegister;
 extern UINTN  mRtcTargetRegister;
-
+extern UINTN  mRtcIndexRegisterIo;
+extern UINTN  mRtcTargetRegisterIo;
 //
 // Days of month.
 //
@@ -72,10 +73,10 @@ IoRtcRead (
   )
 {
   IoWrite8 (
-    PcdGet8 (PcdRtcIndexRegister),
-    (UINT8)(Address | (UINT8)(IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x80))
+    mRtcIndexRegisterIo,
+    (UINT8)(Address | (UINT8)(IoRead8 (mRtcIndexRegisterIo) & 0x80))
     );
-  return IoRead8 (PcdGet8 (PcdRtcTargetRegister));
+  return IoRead8 (mRtcTargetRegisterIo);
 }
 
 /**
@@ -94,10 +95,10 @@ IoRtcWrite (
   )
 {
   IoWrite8 (
-    PcdGet8 (PcdRtcIndexRegister),
-    (UINT8)(Address | (UINT8)(IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x80))
+    mRtcIndexRegisterIo,
+    (UINT8)(Address | (UINT8)(IoRead8 (mRtcIndexRegisterIo) & 0x80))
     );
-  IoWrite8 (PcdGet8 (PcdRtcTargetRegister), Data);
+  IoWrite8 (mRtcTargetRegisterIo, Data);
 }
 
 /**
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
index e6e9458d75..23e87978bf 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
@@ -18,6 +18,8 @@ STATIC EFI_EVENT  mVirtualAddrChangeEvent;
 
 UINTN  mRtcIndexRegister;
 UINTN  mRtcTargetRegister;
+UINTN  mRtcIndexRegisterIo;
+UINTN  mRtcTargetRegisterIo;
 
 /**
   Returns the current time and date information, and the time-keeping capabilities
@@ -164,6 +166,9 @@ InitializePcRtc (
   if (FeaturePcdGet (PcdRtcUseMmio)) {
     mRtcIndexRegister  = (UINTN)PcdGet64 (PcdRtcIndexRegister64);
     mRtcTargetRegister = (UINTN)PcdGet64 (PcdRtcTargetRegister64);
+  } else {
+    mRtcIndexRegisterIo  = (UINTN)PcdGet8 (PcdRtcIndexRegister);
+    mRtcTargetRegisterIo = (UINTN)PcdGet8 (PcdRtcTargetRegister);
   }
 
   Status = PcRtcInit (&mModuleGlobal);
-- 
2.39.2.windows.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-22  2:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-22  2:14 [PATCH v1 0/1] PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD Guo, Gua
2023-05-22  2:14 ` [PATCH v1 1/1] " Guo, Gua

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox