summaryrefslogtreecommitdiffstats
path: root/PcAtChipsetPkg
diff options
context:
space:
mode:
Diffstat (limited to 'PcAtChipsetPkg')
-rw-r--r--PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index 0fbfa4bcee..9242a2e826 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -270,13 +270,6 @@ PcRtcInit (
Time.Year = RtcRead (RTC_ADDRESS_YEAR);
//
- // Set RTC configuration after get original time
- // The value of bit AIE should be reserved.
- //
- RegisterB.Data = FixedPcdGet8 (PcdInitialValueRtcRegisterB) | (RegisterB.Data & BIT5);
- RtcWrite (RTC_ADDRESS_REGISTER_B, RegisterB.Data);
-
- //
// Release RTC Lock.
//
if (!EfiAtRuntime ()) {
@@ -331,6 +324,13 @@ PcRtcInit (
}
//
+ // Set RTC configuration after get original time
+ // The value of bit AIE should be reserved.
+ //
+ RegisterB.Data = FixedPcdGet8 (PcdInitialValueRtcRegisterB) | (RegisterB.Data & BIT5);
+ RtcWrite (RTC_ADDRESS_REGISTER_B, RegisterB.Data);
+
+ //
// Reset time value according to new RTC configuration
//
Status = PcRtcSetTime (&Time, Global);
@@ -995,13 +995,16 @@ ConvertRtcTimeToEfiTime (
BOOLEAN IsPM;
UINT8 Century;
- if ((Time->Hour & 0x80) != 0) {
- IsPM = TRUE;
- } else {
- IsPM = FALSE;
- }
+ // IsPM only makes sense for 12-hour format.
+ if (RegisterB.Bits.Mil == 0) {
+ if ((Time->Hour & 0x80) != 0) {
+ IsPM = TRUE;
+ } else {
+ IsPM = FALSE;
+ }
- Time->Hour = (UINT8)(Time->Hour & 0x7f);
+ Time->Hour = (UINT8)(Time->Hour & 0x7f);
+ }
if (RegisterB.Bits.Dm == 0) {
Time->Year = CheckAndConvertBcd8ToDecimal8 ((UINT8)Time->Year);