PcAtChipsetPkg: RTC Runtime unable to get correct IO port by PCD

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>
Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
Gua Guo
2023-05-22 10:07:24 +08:00
committed by mergify[bot]
parent 0f8323b44b
commit ba2300f97b
2 changed files with 31 additions and 19 deletions

View File

@@ -16,8 +16,11 @@ EFI_HANDLE mHandle = NULL;
STATIC EFI_EVENT mVirtualAddrChangeEvent;
UINTN mRtcIndexRegister;
UINTN mRtcTargetRegister;
UINTN mRtcIndexRegister;
UINTN mRtcTargetRegister;
UINT16 mRtcDefaultYear;
UINT16 mMinimalValidYear;
UINT16 mMaximalValidYear;
/**
Returns the current time and date information, and the time-keeping capabilities
@@ -164,8 +167,15 @@ InitializePcRtc (
if (FeaturePcdGet (PcdRtcUseMmio)) {
mRtcIndexRegister = (UINTN)PcdGet64 (PcdRtcIndexRegister64);
mRtcTargetRegister = (UINTN)PcdGet64 (PcdRtcTargetRegister64);
} else {
mRtcIndexRegister = (UINTN)PcdGet8 (PcdRtcIndexRegister);
mRtcTargetRegister = (UINTN)PcdGet8 (PcdRtcTargetRegister);
}
mRtcDefaultYear = PcdGet16 (PcdRtcDefaultYear);
mMinimalValidYear = PcdGet16 (PcdMinimalValidYear);
mMaximalValidYear = PcdGet16 (PcdMaximalValidYear);
Status = PcRtcInit (&mModuleGlobal);
ASSERT_EFI_ERROR (Status);