RTC_INIT_YEAR was defined as 2001 so when PcdMinimalValidYear is 2002 the 
RtcTimeFieldsValid() returns failure
resulting the PcRtc driver not work.
The fix is to remove the RTC_INIT_YEAR definition and directly use 
PcdMinimalValidYear as the initial year value.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu...@intel.com>
Cc: Feng Tian <feng.t...@intel.com>
---
 PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 4 ++--
 PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index 23f8d3b..da15146 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -218,7 +218,7 @@ PcRtcInit (
     Time.Hour   = RTC_INIT_HOUR;
     Time.Day    = RTC_INIT_DAY;
     Time.Month  = RTC_INIT_MONTH;
-    Time.Year   = RTC_INIT_YEAR;
+    Time.Year   = PcdGet16 (PcdMinimalValidYear);
     Time.Nanosecond  = 0;
     Time.TimeZone = EFI_UNSPECIFIED_TIMEZONE;
     Time.Daylight = 0;
@@ -251,7 +251,7 @@ PcRtcInit (
   Time.Hour   = RTC_INIT_HOUR;
   Time.Day    = RTC_INIT_DAY;
   Time.Month  = RTC_INIT_MONTH;
-  Time.Year   = RTC_INIT_YEAR;
+  Time.Year   = PcdGet16 (PcdMinimalValidYear);
   Time.Nanosecond  = 0;
   Time.TimeZone = Global->SavedTimeZone;
   Time.Daylight = Global->Daylight;;
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
index 020d715..810d79e 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
@@ -71,7 +71,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
-- 
1.9.5.msysgit.1


------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to