+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2005, 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
-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
-Module Name:\r
- IpfPcRtc.c\r
-\r
-Abstract:\r
- Register the extended SAL infrastructure.\r
-\r
- Make the EFI RT APIs call extended SAL calls via the RT lib wrappers.\r
- We can not do this on IA-32 as RT lib wrappers call via rRT.\r
-\r
---*/\r
-\r
-#include "RealTimeClock.h"\r
-\r
-//\r
-// Don't use directly after virtual address have been registered.\r
-//\r
-PC_RTC_MODULE_GLOBALS mModuleGlobal;\r
-\r
-SAL_RETURN_REGS\r
-PcRtcEsalServicesClassCommonEntry (\r
- IN UINT64 FunctionId,\r
- IN UINT64 Arg2,\r
- IN UINT64 Arg3,\r
- IN UINT64 Arg4,\r
- IN UINT64 Arg5,\r
- IN UINT64 Arg6,\r
- IN UINT64 Arg7,\r
- IN UINT64 Arg8,\r
- IN SAL_EXTENDED_SAL_PROC ExtendedSalProc,\r
- IN BOOLEAN VirtualMode,\r
- IN PC_RTC_MODULE_GLOBALS *Global\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Main entry for Extended SAL Reset Services\r
-\r
-Arguments:\r
-\r
- FunctionId Function Id which needed to be called.\r
- Arg2 EFI_RESET_TYPE, whether WARM of COLD reset\r
- Arg3 Last EFI_STATUS \r
- Arg4 Data Size of UNICODE STRING passed in ARG5\r
- Arg5 Unicode String which CHAR16*\r
-\r
-Returns:\r
-\r
- SAL_RETURN_REGS\r
-\r
---*/\r
-// TODO: Arg6 - add argument and description to function comment\r
-// TODO: Arg7 - add argument and description to function comment\r
-// TODO: Arg8 - add argument and description to function comment\r
-// TODO: ExtendedSalProc - add argument and description to function comment\r
-// TODO: VirtualMode - add argument and description to function comment\r
-// TODO: Global - add argument and description to function comment\r
-{\r
- EFI_STATUS EfiStatus;\r
- SAL_RETURN_REGS ReturnVal;\r
-\r
- switch (FunctionId) {\r
- case GetTime:\r
- EfiStatus = PcRtcGetTime ((EFI_TIME *) Arg2, (EFI_TIME_CAPABILITIES *) Arg3, Global);\r
- break;\r
-\r
- case SetTime:\r
- EfiStatus = PcRtcSetTime ((EFI_TIME *) Arg2, Global);\r
- break;\r
-\r
- case GetWakeupTime:\r
- EfiStatus = PcRtcGetWakeupTime ((BOOLEAN *) Arg2, (BOOLEAN *) Arg3, (EFI_TIME *) Arg4, Global);\r
- break;\r
-\r
- case SetWakeupTime:\r
- EfiStatus = PcRtcSetWakeupTime ((BOOLEAN) Arg2, (EFI_TIME *) Arg3, Global);\r
- break;\r
-\r
- case InitializeThreshold:\r
- EfiStatus = EFI_SAL_NOT_IMPLEMENTED;\r
- break;\r
-\r
- case BumpThresholdCount:\r
- EfiStatus = EFI_SAL_NOT_IMPLEMENTED;\r
- break;\r
-\r
- case GetThresholdCount:\r
- EfiStatus = EFI_SAL_NOT_IMPLEMENTED;\r
- break;\r
-\r
- case GetRtcFreq:\r
- EfiStatus = EFI_SAL_NOT_IMPLEMENTED;\r
- break;\r
-\r
- default:\r
- EfiStatus = EFI_SAL_INVALID_ARGUMENT;\r
- break;;\r
- }\r
-\r
- ReturnVal.Status = EfiStatus;\r
- return ReturnVal;\r
-}\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-InitializePcRtc (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Arguments:\r
-\r
- \r
-\r
-Returns: \r
---*/\r
-// TODO: ImageHandle - add argument and description to function comment\r
-// TODO: SystemTable - add argument and description to function comment\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
-{\r
- EFI_TIME Time;\r
- EFI_TIME_CAPABILITIES Capabilities;\r
- EFI_STATUS EfiStatus;\r
-\r
- EfiInitializeRuntimeDriverLib (ImageHandle, SystemTable, NULL);\r
-\r
- EfiInitializeLock (&mModuleGlobal.RtcLock, EFI_TPL_HIGH_LEVEL);\r
-\r
- EfiStatus = PcRtcInit (&mModuleGlobal);\r
- if (EFI_ERROR (EfiStatus)) {\r
- return EfiStatus;\r
- }\r
-\r
- RegisterEsalClass (\r
- &gEfiExtendedSalRtcServicesProtocolGuid,\r
- &mModuleGlobal,\r
- PcRtcEsalServicesClassCommonEntry,\r
- GetTime,\r
- PcRtcEsalServicesClassCommonEntry,\r
- SetTime,\r
- PcRtcEsalServicesClassCommonEntry,\r
- GetWakeupTime,\r
- PcRtcEsalServicesClassCommonEntry,\r
- SetWakeupTime,\r
- PcRtcEsalServicesClassCommonEntry,\r
- GetRtcFreq,\r
- PcRtcEsalServicesClassCommonEntry,\r
- InitializeThreshold,\r
- PcRtcEsalServicesClassCommonEntry,\r
- BumpThresholdCount,\r
- PcRtcEsalServicesClassCommonEntry,\r
- GetThresholdCount,\r
- NULL\r
- );\r
- //\r
- // the following code is to initialize the RTC fields in case the values read\r
- // back from CMOS are invalid at the first time.\r
- //\r
- EfiStatus = PcRtcGetTime (&Time, &Capabilities, &mModuleGlobal);\r
- if (EFI_ERROR (EfiStatus)) {\r
- Time.Second = RTC_INIT_SECOND;\r
- Time.Minute = RTC_INIT_MINUTE;\r
- Time.Hour = RTC_INIT_HOUR;\r
- Time.Day = RTC_INIT_DAY;\r
- Time.Month = RTC_INIT_MONTH;\r
- Time.Year = RTC_INIT_YEAR;\r
- PcRtcSetTime (&Time, &mModuleGlobal);\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\r