This patch re-implemented SetTime runtime service for special usage on 
MinnowBoard Max which may have no RTC battery present. While user sets system 
time, SetTime service not only sets the time into RTC, but also saves it in 
UEFI variable. The next time when power failure occurred and RTC system time is 
lost, BIOS will read out the system time form UEFI variable and set it into RTC.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: lushifex <[email protected]>
---
 Vlv2TbltDevicePkg/PlatformDxe/Platform.c           |   7 +-
 Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.h        |   4 +-
 Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf      |   5 +-
 Vlv2TbltDevicePkg/PlatformDxe/Rtc.c                | 176 ++++++++++++---------
 Vlv2TbltDevicePkg/PlatformPei/Platform.c           |   7 +-
 Vlv2TbltDevicePkg/PlatformPei/PlatformPei.inf      |   4 +-
 Vlv2TbltDevicePkg/PlatformPkg.dec                  |   2 +
 Vlv2TbltDevicePkg/PlatformPkg.fdf                  |   3 +-
 Vlv2TbltDevicePkg/PlatformPkgGcc.fdf               |   3 +-
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc            |   5 +
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc              |   5 +
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc               |   6 +
 .../PlatformRtcRuntimeDxe/PlatformRtc.c            | 137 ++++++++++++++++
 .../PlatformRtcRuntimeDxe/PlatformRtc.h            |  33 ++++
 .../PlatformRtcRuntimeDxe/PlatformRtc.uni          | Bin 0 -> 1906 bytes
 .../PlatformRtcRuntimeDxe.inf                      |  60 +++++++
 .../PlatformRtcRuntimeDxe/PlatfromRtcExtra.uni     | Bin 0 -> 1378 bytes
 17 files changed, 376 insertions(+), 81 deletions(-)
 create mode 100644 Vlv2TbltDevicePkg/PlatformRtcRuntimeDxe/PlatformRtc.c
 create mode 100644 Vlv2TbltDevicePkg/PlatformRtcRuntimeDxe/PlatformRtc.h
 create mode 100644 Vlv2TbltDevicePkg/PlatformRtcRuntimeDxe/PlatformRtc.uni
 create mode 100644 
Vlv2TbltDevicePkg/PlatformRtcRuntimeDxe/PlatformRtcRuntimeDxe.inf
 create mode 100644 Vlv2TbltDevicePkg/PlatformRtcRuntimeDxe/PlatfromRtcExtra.uni

diff --git a/Vlv2TbltDevicePkg/PlatformDxe/Platform.c 
b/Vlv2TbltDevicePkg/PlatformDxe/Platform.c
index 6ddc305..439b6d9 100644
--- a/Vlv2TbltDevicePkg/PlatformDxe/Platform.c
+++ b/Vlv2TbltDevicePkg/PlatformDxe/Platform.c
@@ -1,8 +1,8 @@
 /** @file
 
-  Copyright (c) 2004  - 2015, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2004  - 2016, 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 that accompanies this 
distribution.  
@@ -994,16 +994,17 @@ InitializePlatform (
                   &gEfiEventExitBootServicesGuid,
                   &mEfiExitBootServicesEvent
                   );
 
   //
-  // Adjust RTC deafult time to be BIOS-built time.
+  // This callback function adjusts RTC time to a value which was set by user 
in UEFI Shell or Setup browaser and which 
+  // was also saved in UEFI variable. If no UEFI variable "SystemRtcTime" 
found, just set RTC time to BIOS built time.
   //
   Status = gBS->CreateEvent (
                     EVT_NOTIFY_SIGNAL,
                     TPL_CALLBACK,
-                    AdjustDefaultRtcTimeCallback,
+                    AdjustRtcTimeCallback,
                     NULL,
                     &RtcEvent
                     );
   if (!EFI_ERROR (Status)) {
       Status = gBS->RegisterProtocolNotify (
diff --git a/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.h 
b/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.h
index ec69e61..33e3b1d 100644
--- a/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.h
+++ b/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.h
@@ -1,8 +1,8 @@
 /*++
 
-  Copyright (c) 2004  - 2015, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2004  - 2016, 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 that accompanies this 
distribution.  
   The full text of the license may be found at                                 
    
   http://opensource.org/licenses/bsd-license.php.                              
    
@@ -636,11 +636,11 @@ InitializeObservableProtocol();
 EFI_STATUS
 PciBusDriverHook();
 
 VOID
 EFIAPI
-AdjustDefaultRtcTimeCallback (
+AdjustRtcTimeCallback (
   IN EFI_EVENT        Event,
   IN VOID             *Context
   );
 
 typedef struct _GOP_DISPLAY_BRIGHTNESS_PROTOCOL 
GOP_DISPLAY_BRIGHTNESS_PROTOCOL;
diff --git a/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf 
b/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf
index 63ccf03..8fa64a7 100644
--- a/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf
+++ b/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf
@@ -1,8 +1,8 @@
 #/*++
 #
-#  Copyright (c)  1999  - 2015, Intel Corporation. All rights reserved
+#  Copyright (c)  1999  - 2016, Intel Corporation. All rights reserved
 #                                                                              
    
 # This program and the accompanying materials are licensed and made available 
under
 # the terms and conditions of the BSD License that accompanies this 
distribution.  
 # The full text of the license may be found at                                 
    
 # http://opensource.org/licenses/bsd-license.php.                              
    
@@ -81,10 +81,11 @@
   S3BootScriptLib
   ReportStatusCodeLib
   EfiRegTableLib
   BiosIdLib
   BaseCryptLib
+  PcdLib
 
 [Guids]
   gEfiBiosIdGuid
   gEfiPlatformBootModeGuid
   gEfiBoardFeaturesGuid
@@ -95,10 +96,11 @@
   gEfiNormalSetupGuid
   gEfiGlobalVariableGuid
   gEfiEventExitBootServicesGuid
   gEfiVlv2VariableGuid
   gEfiSecureBootEnableDisableGuid
+  gSystemRtcTimeVariableGuid
 
 [Protocols]
   gEfiPciRootBridgeIoProtocolGuid    # CONSUMES  ## GUID
   gEfiVariableArchProtocolGuid
   gEfiVariableWriteArchProtocolGuid
@@ -139,10 +141,11 @@
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdFastPS2Detection
   gPlatformModuleTokenSpaceGuid.PcdFlashFvMainBase
   gPlatformModuleTokenSpaceGuid.PcdFlashFvRecoveryBase
   gPlatformModuleTokenSpaceGuid.PcdFlashFvRecoverySize
   gFspWrapperTokenSpaceGuid.PcdFlashFvFspBase
+  gPlatformModuleTokenSpaceGuid.PcdRtcPowerFailure
   
 
 [Depex]
   gEfiPciRootBridgeIoProtocolGuid     AND
   gEfiVariableArchProtocolGuid        AND
diff --git a/Vlv2TbltDevicePkg/PlatformDxe/Rtc.c 
b/Vlv2TbltDevicePkg/PlatformDxe/Rtc.c
index 9415b7e..d1467a8 100644
--- a/Vlv2TbltDevicePkg/PlatformDxe/Rtc.c
+++ b/Vlv2TbltDevicePkg/PlatformDxe/Rtc.c
@@ -1,9 +1,9 @@
 /** @file
   Adjust Default System Time.
   
-  Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2015 - 2016, 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 that accompanies this 
distribution.  
   The full text of the license may be found at                                 
    
   http://opensource.org/licenses/bsd-license.php.                              
    
@@ -26,10 +26,12 @@
 #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
 
+extern EFI_GUID gSystemRtcTimeVariableGuid;
+
 
  
 CHAR16  mBiosReleaseDate[20];    
   
 /**
@@ -89,88 +91,120 @@ CheckRtcTimeFields (
   @param[in] Context  Pointer to the notification function's context.
 
 **/
 VOID
 EFIAPI
-AdjustDefaultRtcTimeCallback (
+AdjustRtcTimeCallback (
   IN EFI_EVENT        Event,
   IN VOID             *Context
   )
 {
   EFI_STATUS      Status;
   EFI_TIME        EfiTime;
+  EFI_TIME        RtcTime;
   UINT8           Century;
   CHAR16          BiosVersion[60];    
-  CHAR16          BiosReleaseTime[20];    
-  //
-  // Get BIOS built time from Bios-ID. 
-  //
-  
-  SetMem(BiosVersion, sizeof(BiosVersion), 0);
-  SetMem(mBiosReleaseDate, sizeof(mBiosReleaseDate), 0);
-  SetMem(BiosReleaseTime, sizeof(BiosReleaseTime), 0);
-    
-  Status = GetBiosVersionDateTime (BiosVersion, mBiosReleaseDate, 
BiosReleaseTime);
-  ASSERT_EFI_ERROR(Status);
-  if (EFI_ERROR (Status)) {
-    return; 
-  }
-  
-  //
-  // Get current RTC time.
-  // 
-  Status = gRT->GetTime (&EfiTime, NULL);
- 
-  //
-  // Validate RTC time fields
-  //
-  Status = CheckRtcTimeFields (&EfiTime);
-  
-  if (EFI_ERROR (Status)) {
-    //
-    // Date such as Dec 28th of 2015
-    //
-    // Month
-    // BiosReleaseDate[0] = '1';
-    // BiosReleaseDate[1] = '2';
-    //
-    // Day
-    // BiosReleaseDate[3] = '2';
-    // BiosReleaseDate[4] = '8';
-    //  
-    //
-    // Year
-    //
-    // BiosReleaseDate[6] = '2';
-    // BiosReleaseDate[7] = '0';
-    // BiosReleaseDate[8] = '1'
-    // BiosReleaseDate[9] = '5';
-    
-    EfiTime.Second = RTC_INIT_SECOND;
-    EfiTime.Minute = RTC_INIT_MINUTE;
-    EfiTime.Hour   = RTC_INIT_HOUR;
-    EfiTime.Day    = (UINT8)(CharToUint(mBiosReleaseDate[3])*10 + 
CharToUint(mBiosReleaseDate[4]));
-    EfiTime.Month  = (UINT8)(CharToUint(mBiosReleaseDate[0])*10 + 
CharToUint(mBiosReleaseDate[1]));
-    EfiTime.Year   = (UINT16)(CharToUint(mBiosReleaseDate[8])*10 + 
CharToUint(mBiosReleaseDate[9]) + 2000);
-    EfiTime.Nanosecond  = 0;
-    EfiTime.TimeZone = EFI_UNSPECIFIED_TIMEZONE;
-    EfiTime.Daylight = 1; 
-
-    DEBUG ((EFI_D_INFO, "Day:%d Month:%d Year:%d \n", (UINT32)EfiTime.Day, 
(UINT32)EfiTime.Month, (UINT32)EfiTime.Year));
-
-    //
-    // Reset time value according to new RTC configuration
-    //
-    Status = gRT->SetTime (&EfiTime);
-    ASSERT_EFI_ERROR(Status);
+  CHAR16          BiosReleaseTime[20];
+  UINTN           DataSize;
 
+  if (PcdGetBool(PcdRtcPowerFailure)) {
     //
-    // Set the RTC century in case that UEFI SetTime sevice does not set this 
register.
+    // If Rtc Power failure occured, get the valid RTC time from UEFI 
variable, 
+    // which was saved by UEFI SetTime servie when user set system time in 
UEFI Shell
+    // or Setup browser.
     //
-    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);
-
+    
+    PcdSetBool(PcdRtcPowerFailure, FALSE);
+
+    DataSize = sizeof (EFI_TIME);
+    Status = gRT->GetVariable(
+                    L"SystemRtcTime",
+                    &gSystemRtcTimeVariableGuid,
+                    NULL,
+                    &DataSize,
+                    &RtcTime
+                    );
+    if (!EFI_ERROR(Status)) {
+      DEBUG ((EFI_D_INFO, "Day:%d Month:%d Year:%d \n", (UINT32)RtcTime.Day, 
(UINT32)RtcTime.Month, (UINT32)RtcTime.Year));
+      DEBUG ((EFI_D_INFO, "Second:%d Minute:%d Hour:%d \n", 
(UINT32)RtcTime.Second, (UINT32)RtcTime.Minute, (UINT32)RtcTime.Hour));
+      Status = gRT->SetTime (&RtcTime);
+      //
+      // Set the RTC century in case that UEFI SetTime sevice does not set 
this register.
+      //
+      Century    = DecimalToBcd8 ((UINT8) (RtcTime.Year / 100));
+      IoWrite8 (RTC_ADDRESS_REGISTER, (UINT8) (RTC_ADDRESS_CENTURY | (UINT8) 
(IoRead8 (PCAT_RTC_ADDRESS_REGISTER) & 0x80)));
+      IoWrite8 (RTC_DATA_REGISTER, Century);
+
+    } else {
+      //
+      // Get BIOS built time from Bios-ID. 
+      //
+
+      SetMem(BiosVersion, sizeof(BiosVersion), 0);
+      SetMem(mBiosReleaseDate, sizeof(mBiosReleaseDate), 0);
+      SetMem(BiosReleaseTime, sizeof(BiosReleaseTime), 0);
+  
+      Status = GetBiosVersionDateTime (BiosVersion, mBiosReleaseDate, 
BiosReleaseTime);
+      ASSERT_EFI_ERROR(Status);
+      if (EFI_ERROR (Status)) {
+        return; 
+      }
+
+      //
+      // Get current RTC time.
+      // 
+      Status = gRT->GetTime (&EfiTime, NULL);
+
+      //
+      // Validate RTC time fields
+      //
+      Status = CheckRtcTimeFields (&EfiTime);
+
+      if (EFI_ERROR (Status)) {
+        //
+        // Date such as Dec 28th of 2015
+        //
+        // Month
+        // BiosReleaseDate[0] = '1';
+        // BiosReleaseDate[1] = '2';
+        //
+        // Day
+        // BiosReleaseDate[3] = '2';
+        // BiosReleaseDate[4] = '8';
+        //  
+        //
+        // Year
+        //
+        // BiosReleaseDate[6] = '2';
+        // BiosReleaseDate[7] = '0';
+        // BiosReleaseDate[8] = '1'
+        // BiosReleaseDate[9] = '5';
+  
+        EfiTime.Second = RTC_INIT_SECOND;
+        EfiTime.Minute = RTC_INIT_MINUTE;
+        EfiTime.Hour   = RTC_INIT_HOUR;
+        EfiTime.Day    = (UINT8)(CharToUint(mBiosReleaseDate[3])*10 + 
CharToUint(mBiosReleaseDate[4]));
+        EfiTime.Month  = (UINT8)(CharToUint(mBiosReleaseDate[0])*10 + 
CharToUint(mBiosReleaseDate[1]));
+        EfiTime.Year   = (UINT16)(CharToUint(mBiosReleaseDate[8])*10 + 
CharToUint(mBiosReleaseDate[9]) + 2000);
+        EfiTime.Nanosecond  = 0;
+        EfiTime.TimeZone = EFI_UNSPECIFIED_TIMEZONE;
+        EfiTime.Daylight = 1; 
+
+        DEBUG ((EFI_D_INFO, "Day:%d Month:%d Year:%d \n", (UINT32)EfiTime.Day, 
(UINT32)EfiTime.Month, (UINT32)EfiTime.Year));
+
+        //
+        // Reset time value according to new RTC configuration
+        //
+        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;
+   return;
 }
diff --git a/Vlv2TbltDevicePkg/PlatformPei/Platform.c 
b/Vlv2TbltDevicePkg/PlatformPei/Platform.c
index 493c096..dcfb7f6 100644
--- a/Vlv2TbltDevicePkg/PlatformPei/Platform.c
+++ b/Vlv2TbltDevicePkg/PlatformPei/Platform.c
@@ -1,8 +1,8 @@
 /** @file
 
-  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2004  - 2016, 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 that accompanies this 
distribution.  

   The full text of the license may be found at                                 
    

   http://opensource.org/licenses/bsd-license.php.                              
    

@@ -28,10 +28,11 @@ Module Name:
 #include <Ppi/MfgMemoryTest.h>
 #include <Guid/SetupVariable.h>
 #include <Guid/Vlv2Variable.h>
 #include <Ppi/fTPMPolicy.h>
 #include <Library/PchPlatformLib.h>
+#include <Library/PcdLib.h>
 
 //
 // Start::Alpine Valley platform
 //
 enum {
@@ -473,10 +474,14 @@ RtcPowerFailureHandler (
     // Step 1.
     // BIOS clears this bit by writing a '0' to it.
     //
     if (DataUint16 & B_PCH_PMC_GEN_PMCON_RTC_PWR_STS) {
       //
+      // Rtc Power failure occurs, save RtcPowerFailure Flag.
+      //
+      PcdSetBool(PcdRtcPowerFailure, TRUE);
+      //
       // Set to invalid date in order to reset the time to
       // BIOS build time later in the boot (SBRUN.c file).
       //
       IoWrite8 (R_PCH_RTC_INDEX2, R_PCH_RTC_YEAR);
       IoWrite8 (R_PCH_RTC_TARGET2, 0x0FF);
diff --git a/Vlv2TbltDevicePkg/PlatformPei/PlatformPei.inf 
b/Vlv2TbltDevicePkg/PlatformPei/PlatformPei.inf
index 9b95a9b..97c8dfb 100644
--- a/Vlv2TbltDevicePkg/PlatformPei/PlatformPei.inf
+++ b/Vlv2TbltDevicePkg/PlatformPei/PlatformPei.inf
@@ -1,8 +1,8 @@
 #
 #
-# Copyright (c)  1999  - 2014, Intel Corporation. All rights reserved
+# Copyright (c)  1999  - 2016, Intel Corporation. All rights reserved
 #                                                                              
    

 # This program and the accompanying materials are licensed and made available 
under

 # the terms and conditions of the BSD License that accompanies this 
distribution.  

 # The full text of the license may be found at                                 
    

 # http://opensource.org/licenses/bsd-license.php.                              
    

@@ -86,10 +86,11 @@
   PerformanceLib
   MonoStatusCodeLib
   BaseCryptLib
   PciLib
   PchPlatformLib
+  PcdLib
 
 [Ppis]
   gEfiPeiStallPpiGuid
   gPeiSpeakerInterfacePpiGuid
   gEfiPeiMemoryDiscoveredPpiGuid
@@ -131,8 +132,9 @@
   gPlatformModuleTokenSpaceGuid.PcdFlashFvRecovery2Base
   gPlatformModuleTokenSpaceGuid.PcdFlashFvRecovery2Size
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
   gPlatformModuleTokenSpaceGuid.PcdFlashAreaBaseAddress
   gPlatformModuleTokenSpaceGuid.PcdFlashAreaSize
+  gPlatformModuleTokenSpaceGuid.PcdRtcPowerFailure
 [Depex]
   TRUE
 
diff --git a/Vlv2TbltDevicePkg/PlatformPkg.dec 
b/Vlv2TbltDevicePkg/PlatformPkg.dec
index ea84a93..015a630 100644
--- a/Vlv2TbltDevicePkg/PlatformPkg.dec
+++ b/Vlv2TbltDevicePkg/PlatformPkg.dec
@@ -64,10 +64,11 @@
   gFirmwareIdGuid                         = { 0x5e559c23, 0x1faa, 0x4ae1, { 
0x8d, 0x4a, 0xc6, 0xcf, 0x02, 0x6c, 0x76, 0x6f } }
   gBmpImageGuid                           = { 0x878AC2CC, 0x5343, 0x46F2, { 
0xB5, 0x63, 0x51, 0xF8, 0x9D, 0xAF, 0x56, 0xBA } }
   gOsSelectionVariableGuid                = { 0x86843f56, 0x675d, 0x40a5, { 
0x95, 0x30, 0xbc, 0x85, 0x83, 0x72, 0xf1, 0x03 } }
   gFMPSampleUpdateImageInfoGuid           = { 0xb9847c4e, 0xf5b6, 0x42dc, { 
0xb6, 0xf4, 0xed, 0x44, 0x7, 0xb0, 0x67, 0x4c }}
   gSystemFwClassGuid                      = { 0x819b858e, 0xc52c, 0x402f, { 
0x80, 0xe1, 0x5b, 0x31, 0x1b, 0x6c, 0x19, 0x59 } }
+  gSystemRtcTimeVariableGuid              = { 0x64c9937c, 0x2c8f, 0x4bd7, { 
0xbf, 0x25, 0x83, 0x22, 0x34, 0xa2, 0xaf, 0xa1 } }
 
 [Protocols]
   gEfiActiveBiosProtocolGuid              = { 0xebbe2d1b, 0x1647, 0x4bda, { 
0xab, 0x9a, 0x78, 0x63, 0xe3, 0x96, 0xd4, 0x1a } }
   gEfiPlatformCpuProtocolGuid             = { 0xbd26cdc9, 0xa092, 0x462a, { 
0x87, 0x7a, 0x5a, 0xb6, 0xad, 0xce, 0x48, 0x12 } }
   gDxePchPlatformPolicyProtocolGuid       = { 0x4b0165a9, 0x61d6, 0x4e23, { 
0xa0, 0xb5, 0x3e, 0xc7, 0x9c, 0x2e, 0x30, 0xd5 } }
@@ -181,10 +182,11 @@
   gPlatformModuleTokenSpaceGuid.PcdInConfigMode|FALSE|BOOLEAN|0x80000001
   
gPlatformModuleTokenSpaceGuid.PcdConnectUSBKeyboardonWaitForKeyStroke|FALSE|BOOLEAN|0x80000002
   
gPlatformModuleTokenSpaceGuid.PcdEnableWatchdogSwSmiInputValue|0|UINT8|0x80000003
     ## Indicates platform to sync ESRT repository from FMP instances
   gPlatformModuleTokenSpaceGuid.PcdEsrtSyncFmp|TRUE|BOOLEAN|0x80000004
+  gPlatformModuleTokenSpaceGuid.PcdRtcPowerFailure|FALSE|BOOLEAN|0x80000005
   
 #
 #device firmware update support
 #
 #I2C and SPI support
diff --git a/Vlv2TbltDevicePkg/PlatformPkg.fdf 
b/Vlv2TbltDevicePkg/PlatformPkg.fdf
index 143164a..592df42 100644
--- a/Vlv2TbltDevicePkg/PlatformPkg.fdf
+++ b/Vlv2TbltDevicePkg/PlatformPkg.fdf
@@ -340,10 +340,11 @@ INF IntelFspWrapperPkg/FspInitPei/FspInitPei.inf
 !endif
 INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/CpuPeim.inf
 INF MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf
 INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
 
+INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
 INF $(PLATFORM_PACKAGE)/PlatformPei/PlatformPei.inf
 
 !if $(MINNOW2_FSP_BUILD) == FALSE
 INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/SeCUma.inf
 !endif
@@ -371,11 +372,10 @@ INF  MdeModulePkg/Universal/CapsulePei/CapsulePei.inf
 INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/PchEarlyInitPeim.inf
 !endif
 INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/MemoryInit.inf
 !endif
 
-INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
 
 [FV.FVMAIN]
 BlockSize          = $(FLASH_BLOCK_SIZE)
 FvAlignment        = 16
 ERASE_POLARITY     = 1
@@ -523,10 +523,11 @@ INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET
 #
 INF $(PLATFORM_PACKAGE)/PlatformSmm/PlatformSmm.inf
 INF $(PLATFORM_PACKAGE)/PlatformInfoDxe/PlatformInfoDxe.inf
 INF $(PLATFORM_PACKAGE)/PlatformCpuInfoDxe/PlatformCpuInfoDxe.inf
 INF $(PLATFORM_PACKAGE)/PlatformDxe/PlatformDxe.inf
+INF $(PLATFORM_PACKAGE)/PlatformRtcRuntimeDxe/PlatformRtcRuntimeDxe.inf
 INF $(PLATFORM_PACKAGE)/PciPlatform/PciPlatform.inf
 INF $(PLATFORM_PACKAGE)/SaveMemoryConfig/SaveMemoryConfig.inf
 INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/PlatformCpuPolicy.inf
 INF $(PLATFORM_PACKAGE)/PpmPolicy/PpmPolicy.inf
 INF $(PLATFORM_PACKAGE)/SmramSaveInfoHandlerSmm/SmramSaveInfoHandlerSmm.inf
diff --git a/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf 
b/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
index 166d8be..9738eb8 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
+++ b/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
@@ -297,10 +297,11 @@ INF IntelFspWrapperPkg/FspInitPei/FspInitPei.inf
 !endif
 INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/CpuPeim.inf
 INF MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf
 INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
 
+INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
 INF $(PLATFORM_PACKAGE)/PlatformPei/PlatformPei.inf
 
 !if $(MINNOW2_FSP_BUILD) == FALSE
 INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/SeCUma.inf
 !endif
@@ -324,11 +325,10 @@ INF  MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf
 INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/PchEarlyInitPeim.inf
 !endif
 INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/MemoryInit.inf
 !endif
 
-INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
 
 [FV.FVMAIN]
 BlockSize          = $(FLASH_BLOCK_SIZE)
 FvAlignment        = 16
 ERASE_POLARITY     = 1
@@ -476,10 +476,11 @@ INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET
 #
 INF $(PLATFORM_PACKAGE)/PlatformSmm/PlatformSmm.inf
 INF $(PLATFORM_PACKAGE)/PlatformInfoDxe/PlatformInfoDxe.inf
 INF $(PLATFORM_PACKAGE)/PlatformCpuInfoDxe/PlatformCpuInfoDxe.inf
 INF $(PLATFORM_PACKAGE)/PlatformDxe/PlatformDxe.inf
+INF $(PLATFORM_PACKAGE)/PlatformRtcRuntimeDxe/PlatformRtcRuntimeDxe.inf
 INF $(PLATFORM_PACKAGE)/PciPlatform/PciPlatform.inf
 INF $(PLATFORM_PACKAGE)/SaveMemoryConfig/SaveMemoryConfig.inf
 INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/PlatformCpuPolicy.inf
 INF $(PLATFORM_PACKAGE)/PpmPolicy/PpmPolicy.inf
 INF $(PLATFORM_PACKAGE)/SmramSaveInfoHandlerSmm/SmramSaveInfoHandlerSmm.inf
diff --git a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
index bee20a8..d29fb28 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
@@ -876,10 +876,12 @@ 
gEfiMdeModulePkgTokenSpaceGuid.PcdSystemRebootAfterCapsuleProcessFlag|0x0001
 !if $(TPM_ENABLED) == TRUE
   gEfiSecurityPkgTokenSpaceGuid.PcdTpmInitializationPolicy|1
   gEfiSecurityPkgTokenSpaceGuid.PcdTpmScrtmPolicy|1
 !endif
 
+  gPlatformModuleTokenSpaceGuid.PcdRtcPowerFailure|FALSE
+
 [PcdsDynamicExDefault.common.DEFAULT]
   gEfiVLVTokenSpaceGuid.PcdTCSmbaIoBaseAddress|0x1040
   gEfiVLVTokenSpaceGuid.PcdEmmcManufacturerId|0
   gEfiVLVTokenSpaceGuid.PcdProductSerialNumber|0
   gEfiVLVTokenSpaceGuid.PcdMeasuredBootEnable|TRUE
@@ -963,10 +965,12 @@ 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/fTPMInitPeim.inf
       *_*_IA32_CC_FLAGS      = -DRC_BINARY_RELEASE
   !if $(TARGET) == DEBUG
       <PcdsFixedAtBuild>
         gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2E
   !endif
+   <LibraryClasses>
+      PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
   }
 !endif
 
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
   SourceLevelDebugPkg/DebugAgentPei/DebugAgentPei.inf{
@@ -1325,10 +1329,11 @@ 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/fTPMInitPeim.inf
           PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
   }
   $(PLATFORM_PACKAGE)/PlatformInfoDxe/PlatformInfoDxe.inf
   $(PLATFORM_PACKAGE)/PlatformCpuInfoDxe/PlatformCpuInfoDxe.inf
   $(PLATFORM_PACKAGE)/PlatformDxe/PlatformDxe.inf
+  $(PLATFORM_PACKAGE)/PlatformRtcRuntimeDxe/PlatformRtcRuntimeDxe.inf
 
   $(PLATFORM_PACKAGE)/PciPlatform/PciPlatform.inf
   $(PLATFORM_PACKAGE)/SaveMemoryConfig/SaveMemoryConfig.inf
   
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/PlatformCpuPolicy.inf
   $(PLATFORM_PACKAGE)/PpmPolicy/PpmPolicy.inf
diff --git a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
index 70ff2e0..e8d8256 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
@@ -885,10 +885,12 @@ 
gEfiMdeModulePkgTokenSpaceGuid.PcdSystemRebootAfterCapsuleProcessFlag|0x0001
 !if $(TPM_ENABLED) == TRUE
   gEfiSecurityPkgTokenSpaceGuid.PcdTpmInitializationPolicy|1
   gEfiSecurityPkgTokenSpaceGuid.PcdTpmScrtmPolicy|1
 !endif
 
+  gPlatformModuleTokenSpaceGuid.PcdRtcPowerFailure|FALSE
+
 [PcdsDynamicExDefault.common.DEFAULT]
   gEfiVLVTokenSpaceGuid.PcdTCSmbaIoBaseAddress|0x1040
   gEfiVLVTokenSpaceGuid.PcdEmmcManufacturerId|0
   gEfiVLVTokenSpaceGuid.PcdProductSerialNumber|0
   gEfiVLVTokenSpaceGuid.PcdMeasuredBootEnable|TRUE
@@ -967,10 +969,12 @@ 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/fTPMInitPeim.inf
       *_*_IA32_CC_FLAGS      = /DRC_BINARY_RELEASE
   !if $(TARGET) == DEBUG
       <PcdsFixedAtBuild>
         gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2E
   !endif
+   <LibraryClasses>
+      PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
   }
 !endif
 
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
   SourceLevelDebugPkg/DebugAgentPei/DebugAgentPei.inf{
@@ -1335,10 +1339,11 @@ 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/fTPMInitPeim.inf
           PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
   }
   $(PLATFORM_PACKAGE)/PlatformInfoDxe/PlatformInfoDxe.inf
   $(PLATFORM_PACKAGE)/PlatformCpuInfoDxe/PlatformCpuInfoDxe.inf
   $(PLATFORM_PACKAGE)/PlatformDxe/PlatformDxe.inf
+  $(PLATFORM_PACKAGE)/PlatformRtcRuntimeDxe/PlatformRtcRuntimeDxe.inf
 
   $(PLATFORM_PACKAGE)/PciPlatform/PciPlatform.inf
   $(PLATFORM_PACKAGE)/SaveMemoryConfig/SaveMemoryConfig.inf
   
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/PlatformCpuPolicy.inf
   $(PLATFORM_PACKAGE)/PpmPolicy/PpmPolicy.inf
diff --git a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
index a031208..9569bfc 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
@@ -885,10 +885,12 @@ 
gEfiMdeModulePkgTokenSpaceGuid.PcdSystemRebootAfterCapsuleProcessFlag|0x0001
 !if $(TPM_ENABLED) == TRUE
   gEfiSecurityPkgTokenSpaceGuid.PcdTpmInitializationPolicy|1
   gEfiSecurityPkgTokenSpaceGuid.PcdTpmScrtmPolicy|1
 !endif
 
+  gPlatformModuleTokenSpaceGuid.PcdRtcPowerFailure|FALSE
+
 [PcdsDynamicExDefault.common.DEFAULT]
   gEfiVLVTokenSpaceGuid.PcdTCSmbaIoBaseAddress|0x1040
   gEfiVLVTokenSpaceGuid.PcdEmmcManufacturerId|0
   gEfiVLVTokenSpaceGuid.PcdProductSerialNumber|0
   gEfiVLVTokenSpaceGuid.PcdMeasuredBootEnable|TRUE
@@ -967,10 +969,12 @@ 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/fTPMInitPeim.inf
       *_*_IA32_CC_FLAGS      = /DRC_BINARY_RELEASE
   !if $(TARGET) == DEBUG
       <PcdsFixedAtBuild>
         gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2E
   !endif
+   <LibraryClasses>
+      PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
   }
 !endif
 
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
   SourceLevelDebugPkg/DebugAgentPei/DebugAgentPei.inf{
@@ -1336,10 +1340,12 @@ 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/IA32/fTPMInitPeim.inf
           PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
   }
   $(PLATFORM_PACKAGE)/PlatformInfoDxe/PlatformInfoDxe.inf
   $(PLATFORM_PACKAGE)/PlatformCpuInfoDxe/PlatformCpuInfoDxe.inf
   $(PLATFORM_PACKAGE)/PlatformDxe/PlatformDxe.inf
+  $(PLATFORM_PACKAGE)/PlatformRtcRuntimeDxe/PlatformRtcRuntimeDxe.inf
+  
 
   $(PLATFORM_PACKAGE)/PciPlatform/PciPlatform.inf
   $(PLATFORM_PACKAGE)/SaveMemoryConfig/SaveMemoryConfig.inf
   
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/PlatformCpuPolicy.inf
   $(PLATFORM_PACKAGE)/PpmPolicy/PpmPolicy.inf
diff --git a/Vlv2TbltDevicePkg/PlatformRtcRuntimeDxe/PlatformRtc.c 
b/Vlv2TbltDevicePkg/PlatformRtcRuntimeDxe/PlatformRtc.c
new file mode 100644
index 0000000..f38c4db
--- /dev/null
+++ b/Vlv2TbltDevicePkg/PlatformRtcRuntimeDxe/PlatformRtc.c
@@ -0,0 +1,137 @@
+/** @file
+  Platform Real Time Clock Set Time driver.
+
+  Copyright (c) 2016, 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
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "PlatformRtc.h"
+
+EFI_SET_TIME mOriginalSetTime;
+
+
+/**
+  Save RTC Time to UEFI variable, and Sets the current local time and date 
information.
+
+  @param  Time                  A pointer to the current time.
+
+  @retval EFI_SUCCESS           The operation completed successfully.
+
+**/
+EFI_STATUS
+PlatformRtcSetTime (
+  IN EFI_TIME                *Time
+  )
+{
+  EFI_STATUS      Status;
+  EFI_TIME        RtcTime;
+  EFI_TIME        RtcTime2;
+  UINTN           DataSize;
+
+  if (Time == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  RtcTime = *Time;
+  //
+  // Save user setting time to variable.
+  //
+  if (RtcTime.Year != PcdGet16 (PcdMinimalValidYear)) {
+    DataSize = sizeof (EFI_TIME);
+    Status = gRT->GetVariable(
+                    L"SystemRtcTime",
+                    &gSystemRtcTimeVariableGuid,
+                    NULL,
+                    &DataSize,
+                    &RtcTime2
+                    );
+    if (EFI_ERROR(Status)) {
+      Status =  EfiSetVariable (
+                  SYSTEM_TIME_NAME,
+                  &gSystemRtcTimeVariableGuid,
+                  EFI_VARIABLE_BOOTSERVICE_ACCESS | 
EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+                  sizeof (RtcTime),
+                  &RtcTime
+                  );
+      ASSERT(Status == EFI_SUCCESS);
+    } else {
+        if (~(((RtcTime.Year == RtcTime2.Year) && (RtcTime.Month == 
RtcTime2.Month) && (RtcTime.Day == RtcTime2.Day)) &&
+            ((RtcTime.Hour == RtcTime2.Hour) && (RtcTime.Minute == 
RtcTime2.Minute) && (RtcTime.Second == RtcTime2.Second)))) {
+          //
+          // If the time to be set is the same as the saved RTC time, we do 
not need save the RTC time again.
+          //
+          Status =  EfiSetVariable (
+                      SYSTEM_TIME_NAME,
+                      &gSystemRtcTimeVariableGuid,
+                      EFI_VARIABLE_BOOTSERVICE_ACCESS | 
EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+                      sizeof (RtcTime),
+                      &RtcTime
+                      );
+          ASSERT(Status == EFI_SUCCESS);
+        }
+    }
+  }
+  
+  return mOriginalSetTime(Time);
+}
+
+VOID
+EFIAPI
+PlatformRtcSetTimeVirtualAddressChangeEvent (
+  IN  EFI_EVENT   Event,
+  IN  VOID        *Context
+  )
+{
+  gRT->ConvertPointer (0, (VOID **) &mOriginalSetTime);
+}
+
+/**
+  The User Entry Point for Platform RTC module.
+
+  This is the entry point for Platform RTC module. It installs the UEFI 
runtime service
+  including Platform SetTime().
+
+  @param  ImageHandle    The firmware allocated handle for the EFI image.
+  @param  SystemTable    A pointer to the EFI System Table.
+
+  @retval EFI_SUCCESS    The entry point is executed successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+InitializePlatformRtc (
+  IN EFI_HANDLE                            ImageHandle,
+  IN EFI_SYSTEM_TABLE                      *SystemTable
+  )
+{
+  EFI_STATUS     Status;
+  EFI_EVENT      Event;
+
+  //
+  // Make sure we can handle virtual address changes.
+  //
+  Event = NULL;
+  Status = gBS->CreateEventEx (
+                  EVT_NOTIFY_SIGNAL,
+                  TPL_NOTIFY,
+                  PlatformRtcSetTimeVirtualAddressChangeEvent,
+                  NULL,
+                  &gEfiEventVirtualAddressChangeGuid,
+                  &Event
+                  );
+  ASSERT_EFI_ERROR (Status);
+
+  mOriginalSetTime = gRT->SetTime;
+
+  gRT->SetTime = PlatformRtcSetTime;
+
+  return EFI_SUCCESS;
+}
+
diff --git a/Vlv2TbltDevicePkg/PlatformRtcRuntimeDxe/PlatformRtc.h 
b/Vlv2TbltDevicePkg/PlatformRtcRuntimeDxe/PlatformRtc.h
new file mode 100644
index 0000000..b065c7a
--- /dev/null
+++ b/Vlv2TbltDevicePkg/PlatformRtcRuntimeDxe/PlatformRtc.h
@@ -0,0 +1,33 @@
+/** @file
+  Header file for Platform Real Time Clock driver.
+
+  Copyright (c) 2016, 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
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+
+#ifndef _PLATFORM_RTC_H_
+#define _PLATFORM_RTC_H_
+
+
+#include <Uefi.h>
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/UefiLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/PcdLib.h>
+#include <Library/ReportStatusCodeLib.h>
+
+#define   SYSTEM_TIME_NAME                  L"SystemRtcTime"
+
+#endif
diff --git a/Vlv2TbltDevicePkg/PlatformRtcRuntimeDxe/PlatformRtc.uni 
b/Vlv2TbltDevicePkg/PlatformRtcRuntimeDxe/PlatformRtc.uni
new file mode 100644
index 
0000000000000000000000000000000000000000..935ab55fbb725a6bc8009076e0b7aa758d6767b9
GIT binary patch
literal 1906
zcmc(gOK%fF5QO`T#D5q$7eI*(95^6^$YTi>A+{V_fm7ti##xcrk+Vt2p9j9`$?n(=
z2qX?@wL6dQt*)u=nfdX(Wi1Q5&v=5pvr{YV+;V$tkC>IM%XnxdmboqLf|(wpG3|tL
zVK;a$7?s$A9Wg3t`&cgMH<yqSX5Y@RUp>IM1ZfUp0e0^8htXq%3P0eb`1)sj|4(Gn
zvum5dCGv>OlAjn3ZRBfB923J`cwE|@uW$-mt?3C7p3=Uw=k~&0*(UwA$H>76rhgXv
zrLPn#=*>_d*fw@~NUw;dwJ)4+WS_I*roFKp)O}lPmiQ#aqDE7Xp==C^F`+GCnfrJQ
z&pGN}y6ujbGol7&#7glBdgmyY@Q2POFdKE8xvs*k@b$N{qL~|B)k&pbaIIyHl@OW4
zSQnnh3PsGsx2W}z5_766tzd^L+GBjM!X<IN_39b(6_?f37H|-v)Tk;<ZRx8X!E-q;
zs)ES%6idvJSbxK7oz<!`QO!HNMy`o=hw3dVRxT;4+9}D!Yu`_*svN&7_g{F;Ht8?O
zP-{*7D`rM`PHbz<(gfv<H))c3efwY;yt-6U$M*Sd+b70tR1N5=w$E&vS{u;IT<d`y
z(q_y{lZcS=(5ALCJdPZ>Lr*oWZ-Z92LT%9Q_*kROC3eTyh1&6m!H)6jIkQ9N+n@@g
z<I#JJ#9ecW*~eEtiW<G%<E!XjXg^{RbM3|KK1y6gW}j=Egx*GrE|sO2drPNN(oZL0
z%eiY#??zoeaUVtfPC)8_F#s*I6BtP^DZ7nYefa$D+3=kstZV9b>h+_V*aAyT8!-Hr
zGq+K*|2yW&`w^T~6Wv<tU$Or)^K?$F-VXokWLITsFW>rkr88KkRNRBwt2&JWW8FKt
vH*`M9Oa3}T0{O}OR_yVgPR;7(*`+W4ujE_%_zdk<QTEBNZn7pBt!n8fM4BxM

literal 0
HcmV?d00001

diff --git a/Vlv2TbltDevicePkg/PlatformRtcRuntimeDxe/PlatformRtcRuntimeDxe.inf 
b/Vlv2TbltDevicePkg/PlatformRtcRuntimeDxe/PlatformRtcRuntimeDxe.inf
new file mode 100644
index 0000000..301ad53
--- /dev/null
+++ b/Vlv2TbltDevicePkg/PlatformRtcRuntimeDxe/PlatformRtcRuntimeDxe.inf
@@ -0,0 +1,60 @@
+## @file
+# Platform RTC SetTime driver.
+#
+# This driver provides Platform SetTime services to Runtime Service Table.
+#
+# Copyright (c) 2016, 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
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = PlatformRtc
+  MODULE_UNI_FILE                = PlatformRtc.uni
+  FILE_GUID                      = 3C060B94-7E09-4c42-8DF4-7B0037FE8D33
+  MODULE_TYPE                    = DXE_RUNTIME_DRIVER
+  VERSION_STRING                 = 1.0
+  ENTRY_POINT                    = InitializePlatformRtc
+
+
+[Sources]
+  PlatformRtc.c
+  PlatformRtc.h
+
+[Packages]
+  MdePkg/MdePkg.dec
+  PcAtChipsetPkg/PcAtChipsetPkg.dec
+  Vlv2TbltDevicePkg/PlatformPkg.dec
+
+[LibraryClasses]
+  UefiRuntimeServicesTableLib
+  UefiRuntimeLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+  TimerLib
+  UefiLib
+  DebugLib
+  BaseLib
+  PcdLib
+  ReportStatusCodeLib
+
+[Guids]
+  gSystemRtcTimeVariableGuid
+
+[Protocols]
+
+[Depex]
+  gEfiRealTimeClockArchProtocolGuid
+
+[Pcd]
+  gPcAtChipsetPkgTokenSpaceGuid.PcdMinimalValidYear             ## CONSUMES
+
+[UserExtensions.TianoCore."ExtraFiles"]
+  PlatformRtcExtra.uni
diff --git a/Vlv2TbltDevicePkg/PlatformRtcRuntimeDxe/PlatfromRtcExtra.uni 
b/Vlv2TbltDevicePkg/PlatformRtcRuntimeDxe/PlatfromRtcExtra.uni
new file mode 100644
index 
0000000000000000000000000000000000000000..cc7e6d66600073dfdde294c8186314aba9a133ed
GIT binary patch
literal 1378
zcmZ9MTW=Ck6ovP*iT`0jU(~dqKKNja5z43&TObsoJ~iA*CjvtTY^6WG`mKHDQVHRl
zvoB}uwJ&r2KDMl75&u{GBKu@FmfFe|_S~MKm2H4Lu|1Z|a$BPrBF)(6$f@1oog-af
zpW(Se_keDW?g~%&Y;0*e<OwI~&+*-0TliYWD)(UD+QIKG?H13-UV#3R{jI&WH}=j>
zIVT0ms=&-`>nz1L^%zYoZ8*t8Oahv?<V4>&cV#fQrhTvuxqYm1ulbDNka`AN?q#6l
z<f2-X8SU{{xIBYrhHdM%Ly>)iMyyn;l+y~d8h_$!BCp*HpN%t9rAmC=o);1BIIBw&
zo3bkEZ*It{K9o#CthKW)QN&E1X;mLpBBQtUy$)ULB46NDbE&!Bdo5<HV)uWxDIA0-
z4xwI(wL@0cQ+Ph@OJu66_}^d&Jre6bcpbCSRMl)kH4k`Ai~Cto1993vsjOyaPcPp4
zG-sSbb>*KsVw3!HI@&s_{tnF)?sGdkvNS=t<zLpM+?CH)i(xfjj{5e6wQZNk2{nzV
zs`e4ugh?B7ioMcf>#@h^YlONB313T$$CV@ZIccJ`HrRzL)CPOUWl5(Mx5&O@7q7lY
zl-wqgnDx*npbDe!(T7OlE}deI@RE<B2CvWf>gG@OZ&<`!Ut(ND30cJUqr$1t6KXMF
zt`xJ&_g2=e+#`R5TCSJwq?#PPA9_txyX&I515k!l2G?NsK^=o1<I{uXC8x;IPUxV%
zfhAp^uxjQs2WR+;pQ1IuEnhl)<Kd-S;IFr1#Qd%O-Z`>fx?gC!<f#~4pYQMzHY)x?
F{ReE?)q?;4

literal 0
HcmV?d00001

-- 
2.6.2.windows.1


_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to