-/*++\r
-\r
-Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved. <BR>\r
-This software and associated documentation (if any) is furnished\r
-under a license and may only be used or copied in accordance\r
-with the terms of the license. Except as permitted by such\r
-license, no part of this software or documentation may be\r
-reproduced, stored in a retrieval system, or transmitted in any\r
-form or by any means without the express written consent of\r
-Intel Corporation.\r
-\r
-\r
+/** @file\r
+ RTC Architectural Protocol GUID as defined in DxeCis 0.96.\r
\r
-Module Name:\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
+http://opensource.org/licenses/bsd-license.php\r
\r
- PcRtc.c\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
-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
\r
--*/\r
{\r
- UINT8 DayOfMonth[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};\r
- BOOLEAN Adjacent = FALSE;\r
+ UINT8 DayOfMonth[12];\r
+ BOOLEAN Adjacent;\r
+\r
+ DayOfMonth[0] = 31;\r
+ DayOfMonth[1] = 29;\r
+ DayOfMonth[2] = 31;\r
+ DayOfMonth[3] = 30;\r
+ DayOfMonth[4] = 31;\r
+ DayOfMonth[5] = 30;\r
+ DayOfMonth[6] = 31;\r
+ DayOfMonth[7] = 31;\r
+ DayOfMonth[8] = 30;\r
+ DayOfMonth[9] = 31;\r
+ DayOfMonth[10] = 30;\r
+ DayOfMonth[11] = 31;\r
+\r
+ Adjacent = FALSE;\r
\r
if (From->Year == To->Year) {\r
if (From->Month == To->Month) {\r