X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=PcAtChipsetPkg%2FPcatRealTimeClockRuntimeDxe%2FPcRtc.c;h=52af17941786ef81c3911512ee64551724e67209;hp=0fbfa4bcee934173a9f51cb2f34e6510d7ddb43c;hb=HEAD;hpb=5220bd211df890f2672c23c050082862cd1e82d6 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 @@ -269,13 +269,6 @@ PcRtcInit ( Time.Month = RtcRead (RTC_ADDRESS_MONTH); 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. // @@ -330,6 +323,13 @@ PcRtcInit ( Time.Daylight = 0; } + // + // 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 // @@ -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);