summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzwei4 <david.wei@intel.com>2016-04-13 15:43:25 +0800
committerzwei4 <david.wei@intel.com>2016-04-13 15:43:25 +0800
commit875495a84ad6d9ad08816feaa35b39da1f35319c (patch)
treea3f94cfdf3de94ce072c8837960d822e0167403f
parentb5e2221f60257a0ec316e98a0d59a01b9de85d25 (diff)
downloadedk2-platforms-875495a84ad6d9ad08816feaa35b39da1f35319c.tar.xz
Initialize century of RTC CMOS.
Initialize century of RTC CMOS, in case that SetTime service does not set it.
-rw-r--r--Vlv2TbltDevicePkg/PlatformDxe/Rtc.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/Vlv2TbltDevicePkg/PlatformDxe/Rtc.c b/Vlv2TbltDevicePkg/PlatformDxe/Rtc.c
index caa042ff4f..9415b7e2ad 100644
--- a/Vlv2TbltDevicePkg/PlatformDxe/Rtc.c
+++ b/Vlv2TbltDevicePkg/PlatformDxe/Rtc.c
@@ -22,6 +22,13 @@
#define RTC_INIT_SECOND 0
#define RTC_INIT_MINUTE 0
#define RTC_INIT_HOUR 0
+
+#define RTC_ADDRESS_CENTURY 50 // R/W Range 19..20 Bit 8 is R/W
+
+#define RTC_ADDRESS_REGISTER 0x70
+#define RTC_DATA_REGISTER 0x71
+
+
CHAR16 mBiosReleaseDate[20];
@@ -91,6 +98,7 @@ AdjustDefaultRtcTimeCallback (
{
EFI_STATUS Status;
EFI_TIME EfiTime;
+ UINT8 Century;
CHAR16 BiosVersion[60];
CHAR16 BiosReleaseTime[20];
//
@@ -154,6 +162,14 @@ AdjustDefaultRtcTimeCallback (
//
Status = gRT->SetTime (&EfiTime);
ASSERT_EFI_ERROR(Status);
+
+ //
+ // Set the RTC century in case that UEFI SetTime sevice does not set this register.
+ //
+ Century = DecimalToBcd8 ((UINT8) (EfiTime.Year / 100));
+ IoWrite8 (RTC_ADDRESS_REGISTER, (UINT8) (RTC_ADDRESS_CENTURY | (UINT8) (IoRead8 (PCAT_RTC_ADDRESS_REGISTER) & 0x80)));
+ IoWrite8 (RTC_DATA_REGISTER, Century);
+
}
return;