summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorgikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524>2009-06-05 06:42:00 +0000
committergikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524>2009-06-05 06:42:00 +0000
commita47b308ad40334e12c90d1f11c6b5e9847a4ad7a (patch)
treefd5cb29f7bdfe19db61ae81741fc919644e00a3d /MdeModulePkg
parentd616bf75930500e43219777f8388d26bdc2afefe (diff)
downloadedk2-a47b308ad40334e12c90d1f11c6b5e9847a4ad7a.zip
edk2-a47b308ad40334e12c90d1f11c6b5e9847a4ad7a.tar.gz
edk2-a47b308ad40334e12c90d1f11c6b5e9847a4ad7a.tar.bz2
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
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcRtc.c45
-rw-r--r--MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcRtc.h10
2 files changed, 3 insertions, 52 deletions
diff --git a/MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcRtc.c b/MdeModulePkg/Universal/PcatRealTimeClockRuntimeDxe/PcRtc.c
index e9367fb..c6b58b3 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 5beb075..90cfa39 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.