From a47b308ad40334e12c90d1f11c6b5e9847a4ad7a Mon Sep 17 00:00:00 2001 From: gikidy Date: Fri, 5 Jun 2009 06:42:00 +0000 Subject: [PATCH] Enhance the RTC driver to not reserve the CMOS century register MSB. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8476 6f19259b-4bc3-4df7-8a09-765794883524 --- .../PcatRealTimeClockRuntimeDxe/PcRtc.c | 45 ++----------------- .../PcatRealTimeClockRuntimeDxe/PcRtc.h | 10 ----- 2 files changed, 3 insertions(+), 52 deletions(-) diff --git a/MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcRtc.c b/MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcRtc.c index e9367fb737..c6b58b394e 100644 --- a/MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcRtc.c +++ b/MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcRtc.c @@ -158,11 +158,7 @@ PcRtcInit ( Time.Month = RtcRead (RTC_ADDRESS_MONTH); Time.Year = RtcRead (RTC_ADDRESS_YEAR); - if (RtcTestCenturyRegister () == EFI_SUCCESS) { - Century = (UINT8) (RtcRead (RTC_ADDRESS_CENTURY) & 0x7f); - } else { - Century = RtcRead (RTC_ADDRESS_CENTURY); - } + Century = BcdToDecimal8 (RtcRead (RTC_ADDRESS_CENTURY)); // // Set RTC configuration after get original time @@ -285,11 +281,7 @@ PcRtcGetTime ( Time->Month = RtcRead (RTC_ADDRESS_MONTH); Time->Year = RtcRead (RTC_ADDRESS_YEAR); - if (RtcTestCenturyRegister () == EFI_SUCCESS) { - Century = (UINT8) (RtcRead (RTC_ADDRESS_CENTURY) & 0x7f); - } else { - Century = RtcRead (RTC_ADDRESS_CENTURY); - } + Century = BcdToDecimal8 (RtcRead (RTC_ADDRESS_CENTURY)); // // Release RTC Lock. @@ -401,10 +393,6 @@ PcRtcSetTime ( RtcWrite (RTC_ADDRESS_DAY_OF_THE_MONTH, RtcTime.Day); RtcWrite (RTC_ADDRESS_MONTH, RtcTime.Month); RtcWrite (RTC_ADDRESS_YEAR, (UINT8) RtcTime.Year); - if (RtcTestCenturyRegister () == EFI_SUCCESS) { - Century = (UINT8) ((Century & 0x7f) | (RtcRead (RTC_ADDRESS_CENTURY) & 0x80)); - } - RtcWrite (RTC_ADDRESS_CENTURY, Century); // @@ -520,11 +508,7 @@ PcRtcGetWakeupTime ( Time->Year = RtcRead (RTC_ADDRESS_YEAR); } - if (RtcTestCenturyRegister () == EFI_SUCCESS) { - Century = (UINT8) (RtcRead (RTC_ADDRESS_CENTURY) & 0x7f); - } else { - Century = RtcRead (RTC_ADDRESS_CENTURY); - } + Century = BcdToDecimal8 (RtcRead (RTC_ADDRESS_CENTURY)); // // Release RTC Lock. @@ -663,29 +647,6 @@ PcRtcSetWakeupTime ( return EFI_SUCCESS; } -/** - See if century register of RTC is valid. - - @retval EFI_SUCCESS Century register is valid. - @retval EFI_DEVICE_ERROR Century register is NOT valid. -**/ -EFI_STATUS -RtcTestCenturyRegister ( - VOID - ) -{ - UINT8 Century; - UINT8 Temp; - - Century = RtcRead (RTC_ADDRESS_CENTURY); - Temp = (UINT8) (RtcRead (RTC_ADDRESS_CENTURY) & 0x7f); - RtcWrite (RTC_ADDRESS_CENTURY, Century); - if (Temp == 0x19 || Temp == 0x20) { - return EFI_SUCCESS; - } - - return EFI_DEVICE_ERROR; -} /** Checks an 8-bit BCD value, and converts to an 8-bit value if valid. diff --git a/MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcRtc.h b/MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcRtc.h index 5beb075691..90cfa39634 100644 --- a/MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcRtc.h +++ b/MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcRtc.h @@ -296,16 +296,6 @@ ConvertEfiTimeToRtcTime ( OUT UINT8 *Century ); -/** - See if centry register of RTC is valid. - - @retval EFI_SUCCESS Century register is valid. - @retval EFI_DEVICE_ERROR Century register is NOT valid. -**/ -EFI_STATUS -RtcTestCenturyRegister ( - VOID - ); /** Converts time read from RTC to EFI_TIME format defined by UEFI spec. -- 2.39.2