3 Copyright (c) 2005, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 Register the extended SAL infrastructure.
18 Make the EFI RT APIs call extended SAL calls via the RT lib wrappers.
19 We can not do this on IA-32 as RT lib wrappers call via rRT.
23 #include "RealTimeClock.h"
26 // Don't use directly after virtual address have been registered.
28 static PC_RTC_MODULE_GLOBALS mModuleGlobal
;
31 PcRtcEsalServicesClassCommonEntry (
40 IN SAL_EXTENDED_SAL_PROC ExtendedSalProc
,
41 IN BOOLEAN VirtualMode
,
42 IN PC_RTC_MODULE_GLOBALS
*Global
48 Main entry for Extended SAL Reset Services
52 FunctionId Function Id which needed to be called.
53 Arg2 EFI_RESET_TYPE, whether WARM of COLD reset
55 Arg4 Data Size of UNICODE STRING passed in ARG5
56 Arg5 Unicode String which CHAR16*
63 // TODO: Arg6 - add argument and description to function comment
64 // TODO: Arg7 - add argument and description to function comment
65 // TODO: Arg8 - add argument and description to function comment
66 // TODO: ExtendedSalProc - add argument and description to function comment
67 // TODO: VirtualMode - add argument and description to function comment
68 // TODO: Global - add argument and description to function comment
71 SAL_RETURN_REGS ReturnVal
;
75 EfiStatus
= PcRtcGetTime ((EFI_TIME
*) Arg2
, (EFI_TIME_CAPABILITIES
*) Arg3
, Global
);
79 EfiStatus
= PcRtcSetTime ((EFI_TIME
*) Arg2
, Global
);
83 EfiStatus
= PcRtcGetWakeupTime ((BOOLEAN
*) Arg2
, (BOOLEAN
*) Arg3
, (EFI_TIME
*) Arg4
, Global
);
87 EfiStatus
= PcRtcSetWakeupTime ((BOOLEAN
) Arg2
, (EFI_TIME
*) Arg3
, Global
);
90 case InitializeThreshold
:
91 EfiStatus
= EFI_SAL_NOT_IMPLEMENTED
;
94 case BumpThresholdCount
:
95 EfiStatus
= EFI_SAL_NOT_IMPLEMENTED
;
98 case GetThresholdCount
:
99 EfiStatus
= EFI_SAL_NOT_IMPLEMENTED
;
103 EfiStatus
= EFI_SAL_NOT_IMPLEMENTED
;
107 EfiStatus
= EFI_SAL_INVALID_ARGUMENT
;
111 ReturnVal
.Status
= EfiStatus
;
118 IN EFI_HANDLE ImageHandle
,
119 IN EFI_SYSTEM_TABLE
*SystemTable
131 // TODO: ImageHandle - add argument and description to function comment
132 // TODO: SystemTable - add argument and description to function comment
133 // TODO: EFI_SUCCESS - add return value to function comment
136 EFI_TIME_CAPABILITIES Capabilities
;
137 EFI_STATUS EfiStatus
;
139 EfiInitializeRuntimeDriverLib (ImageHandle
, SystemTable
, NULL
);
141 EfiInitializeLock (&mModuleGlobal
.RtcLock
, EFI_TPL_HIGH_LEVEL
);
143 EfiStatus
= PcRtcInit (&mModuleGlobal
);
144 if (EFI_ERROR (EfiStatus
)) {
149 &gEfiExtendedSalRtcServicesProtocolGuid
,
151 PcRtcEsalServicesClassCommonEntry
,
153 PcRtcEsalServicesClassCommonEntry
,
155 PcRtcEsalServicesClassCommonEntry
,
157 PcRtcEsalServicesClassCommonEntry
,
159 PcRtcEsalServicesClassCommonEntry
,
161 PcRtcEsalServicesClassCommonEntry
,
163 PcRtcEsalServicesClassCommonEntry
,
165 PcRtcEsalServicesClassCommonEntry
,
170 // the following code is to initialize the RTC fields in case the values read
171 // back from CMOS are invalid at the first time.
173 EfiStatus
= PcRtcGetTime (&Time
, &Capabilities
, &mModuleGlobal
);
174 if (EFI_ERROR (EfiStatus
)) {
175 Time
.Second
= RTC_INIT_SECOND
;
176 Time
.Minute
= RTC_INIT_MINUTE
;
177 Time
.Hour
= RTC_INIT_HOUR
;
178 Time
.Day
= RTC_INIT_DAY
;
179 Time
.Month
= RTC_INIT_MONTH
;
180 Time
.Year
= RTC_INIT_YEAR
;
181 PcRtcSetTime (&Time
, &mModuleGlobal
);