summaryrefslogtreecommitdiffstats
path: root/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
diff options
context:
space:
mode:
Diffstat (limited to 'PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c')
-rw-r--r--PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index d8b9fa8376..ff1b019ce2 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -11,9 +11,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "PcRtc.h"
-extern UINTN mRtcIndexRegister;
-extern UINTN mRtcTargetRegister;
-
+extern UINTN mRtcIndexRegister;
+extern UINTN mRtcTargetRegister;
+extern UINT16 mRtcDefaultYear;
+extern UINT16 mMinimalValidYear;
+extern UINT16 mMaximalValidYear;
//
// Days of month.
//
@@ -72,10 +74,10 @@ IoRtcRead (
)
{
IoWrite8 (
- PcdGet8 (PcdRtcIndexRegister),
- (UINT8)(Address | (UINT8)(IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x80))
+ mRtcIndexRegister,
+ (UINT8)(Address | (UINT8)(IoRead8 (mRtcIndexRegister) & 0x80))
);
- return IoRead8 (PcdGet8 (PcdRtcTargetRegister));
+ return IoRead8 (mRtcTargetRegister);
}
/**
@@ -94,10 +96,10 @@ IoRtcWrite (
)
{
IoWrite8 (
- PcdGet8 (PcdRtcIndexRegister),
- (UINT8)(Address | (UINT8)(IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x80))
+ mRtcIndexRegister,
+ (UINT8)(Address | (UINT8)(IoRead8 (mRtcIndexRegister) & 0x80))
);
- IoWrite8 (PcdGet8 (PcdRtcTargetRegister), Data);
+ IoWrite8 (mRtcTargetRegister, Data);
}
/**
@@ -317,8 +319,8 @@ PcRtcInit (
Time.Hour = RTC_INIT_HOUR;
Time.Day = RTC_INIT_DAY;
Time.Month = RTC_INIT_MONTH;
- Time.Year = MAX (PcdGet16 (PcdRtcDefaultYear), PcdGet16 (PcdMinimalValidYear));
- Time.Year = MIN (Time.Year, PcdGet16 (PcdMaximalValidYear));
+ Time.Year = MAX (mRtcDefaultYear, mMinimalValidYear);
+ Time.Year = MIN (Time.Year, mMaximalValidYear);
Time.Nanosecond = 0;
Time.TimeZone = EFI_UNSPECIFIED_TIMEZONE;
Time.Daylight = 0;
@@ -358,8 +360,8 @@ PcRtcInit (
Time.Hour = RTC_INIT_HOUR;
Time.Day = RTC_INIT_DAY;
Time.Month = RTC_INIT_MONTH;
- Time.Year = MAX (PcdGet16 (PcdRtcDefaultYear), PcdGet16 (PcdMinimalValidYear));
- Time.Year = MIN (Time.Year, PcdGet16 (PcdMaximalValidYear));
+ Time.Year = MAX (mRtcDefaultYear, mMinimalValidYear);
+ Time.Year = MIN (Time.Year, mMaximalValidYear);
Time.Nanosecond = 0;
Time.TimeZone = Global->SavedTimeZone;
Time.Daylight = Global->Daylight;
@@ -1031,8 +1033,8 @@ ConvertRtcTimeToEfiTime (
// Century is 19 if RTC year >= 70,
// Century is 20 otherwise.
//
- Century = (UINT8)(PcdGet16 (PcdMinimalValidYear) / 100);
- if (Time->Year < PcdGet16 (PcdMinimalValidYear) % 100) {
+ Century = (UINT8)(mMinimalValidYear / 100);
+ if (Time->Year < mMinimalValidYear % 100) {
Century++;
}
@@ -1114,8 +1116,8 @@ RtcTimeFieldsValid (
IN EFI_TIME *Time
)
{
- if ((Time->Year < PcdGet16 (PcdMinimalValidYear)) ||
- (Time->Year > PcdGet16 (PcdMaximalValidYear)) ||
+ if ((Time->Year < mMinimalValidYear) ||
+ (Time->Year > mMaximalValidYear) ||
(Time->Month < 1) ||
(Time->Month > 12) ||
(!DayValid (Time)) ||