summaryrefslogtreecommitdiffstats
path: root/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2015-06-11 07:14:18 +0000
committerniruiyu <niruiyu@Edk2>2015-06-11 07:14:18 +0000
commitfe32096778cf248e36d6d00cd958d73fb903126f (patch)
treefd68eb64acfe87dcc681e7b686a57ddb2406c897 /PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
parente63ec1beac46991176b18c859372f0f16fb97b13 (diff)
downloadedk2-fe32096778cf248e36d6d00cd958d73fb903126f.tar.gz
edk2-fe32096778cf248e36d6d00cd958d73fb903126f.tar.bz2
edk2-fe32096778cf248e36d6d00cd958d73fb903126f.zip
PcAtChipsetPkg/PcRtc: Fix a Y2K bug
The original driver cannot handle the case when system time runs from 1999/12/31 23:59:59 to 2000/1/1 0:0:0. A simple test to set system time to 1999/12/31 23:59:59 can expose this bug. The patch limits the driver to only support year in 100 range and decide the century value based on the supporting range: Century either equals to PcdMinimalYear / 100 or equals to PcdMinimalYear / 100 + 1. The patch passed the Y2K test. However with year range [1998, 2097], when system time is 2097/12/31 23:59:59, the next second system time will become 1998/1/1 0:0:0. I think it's a acceptable limitation. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17624 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h')
-rw-r--r--PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h11
1 files changed, 2 insertions, 9 deletions
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
index 020d7153a5..026c1086b2 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
@@ -1,7 +1,7 @@
/** @file
Header file for real time clock driver.
-Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -61,7 +61,6 @@ typedef struct {
#define RTC_ADDRESS_REGISTER_B 11 // R/W
#define RTC_ADDRESS_REGISTER_C 12 // RO
#define RTC_ADDRESS_REGISTER_D 13 // RO
-#define RTC_ADDRESS_CENTURY 50 // R/W Range 19..20 Bit 8 is R/W
//
// Date and time initial values.
// They are used if the RTC values are invalid during driver initialization
@@ -71,7 +70,6 @@ typedef struct {
#define RTC_INIT_HOUR 0
#define RTC_INIT_DAY 1
#define RTC_INIT_MONTH 1
-#define RTC_INIT_YEAR 2001
//
// Register initial values
@@ -287,14 +285,11 @@ RtcTimeFieldsValid (
@param Time On input, the time data read from UEFI to convert
On output, the time converted to RTC format
@param RegisterB Value of Register B of RTC, indicating data mode
- @param Century It is set according to EFI_TIME Time.
-
**/
VOID
ConvertEfiTimeToRtcTime (
IN OUT EFI_TIME *Time,
- IN RTC_REGISTER_B RegisterB,
- OUT UINT8 *Century
+ IN RTC_REGISTER_B RegisterB
);
@@ -308,7 +303,6 @@ ConvertEfiTimeToRtcTime (
@param Time On input, the time data read from RTC to convert
On output, the time converted to UEFI format
- @param Century Value of century read from RTC.
@param RegisterB Value of Register B of RTC, indicating data mode
and hour format.
@@ -319,7 +313,6 @@ ConvertEfiTimeToRtcTime (
EFI_STATUS
ConvertRtcTimeToEfiTime (
IN OUT EFI_TIME *Time,
- IN UINT8 Century,
IN RTC_REGISTER_B RegisterB
);