-/*++\r
+/** @file\r
+ RTC Architectural Protocol GUID as defined in DxeCis 0.96.\r
\r
-Copyright (c) 2006 - 2007 Intel Corporation. <BR>\r
+Copyright (c) 2006 - 2007, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-\r
-\r
-Module Name:\r
-\r
- PcRtc.c\r
-\r
-Abstract:\r
-\r
- RTC Architectural Protocol GUID as defined in DxeCis 0.96\r
-\r
---*/\r
+**/\r
\r
#include "PcRtc.h"\r
\r
RTC_REGISTER_D RegisterD;\r
UINT8 Century;\r
EFI_TIME Time;\r
+ UINTN DataSize;\r
+ UINT32 TimerVar;\r
\r
//\r
// Acquire RTC Lock to make access to RTC atomic\r
\r
//\r
// Set RTC configuration after get original time\r
+ // The value of bit AIE should be reserved.\r
//\r
- RtcWrite (RTC_ADDRESS_REGISTER_B, RTC_INIT_REGISTER_B);\r
+ RtcWrite (RTC_ADDRESS_REGISTER_B, (UINT8)(RTC_INIT_REGISTER_B | (RegisterB.Data & BIT5)));\r
\r
//\r
// Release RTC Lock.\r
Time.Year = RTC_INIT_YEAR;\r
}\r
//\r
+ // Get the data of Daylight saving and time zone, if they have been\r
+ // stored in NV variable during previous boot.\r
+ //\r
+ DataSize = sizeof (UINT32);\r
+ Status = EfiGetVariable (\r
+ L"TimerVar",\r
+ &gEfiGenericPlatformVariableGuid,\r
+ NULL,\r
+ &DataSize,\r
+ (VOID *) &TimerVar\r
+ );\r
+ if (!EFI_ERROR (Status)) {\r
+ Global->SavedTimeZone = (INT16) TimerVar;\r
+ Global->Daylight = (UINT8) (TimerVar >> 16);\r
+\r
+ Time.TimeZone = Global->SavedTimeZone;\r
+ Time.Daylight = Global->Daylight;\r
+ }\r
+ //\r
// Reset time value according to new RTC configuration\r
//\r
PcRtcSetTime (&Time, Global);\r
EFI_TIME RtcTime;\r
RTC_REGISTER_B RegisterB;\r
UINT8 Century;\r
+ UINT32 TimerVar;\r
\r
if (Time == NULL) {\r
return EFI_INVALID_PARAMETER;\r
//\r
Global->SavedTimeZone = Time->TimeZone;\r
Global->Daylight = Time->Daylight;\r
- return Status;\r
+\r
+ TimerVar = Time->Daylight;\r
+ TimerVar = (UINT32) ((TimerVar << 16) | Time->TimeZone);\r
+ Status = EfiSetVariable (\r
+ L"TimerVar",\r
+ &gEfiGenericPlatformVariableGuid,\r
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
+ sizeof (TimerVar),\r
+ &TimerVar\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ return EFI_SUCCESS;\r
}\r
\r
EFI_STATUS\r