2 Provides Set/Get time operations.
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
11 PC_RTC_MODULE_GLOBALS mModuleGlobal
;
13 EFI_HANDLE mHandle
= NULL
;
16 Returns the current time and date information, and the time-keeping capabilities
17 of the hardware platform.
19 @param Time A pointer to storage to receive a snapshot of the current time.
20 @param Capabilities An optional pointer to a buffer to receive the real time
21 clock device's capabilities.
23 @retval EFI_SUCCESS The operation completed successfully.
24 @retval EFI_INVALID_PARAMETER Time is NULL.
25 @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error.
32 OUT EFI_TIME_CAPABILITIES
*Capabilities OPTIONAL
35 return PcRtcGetTime (Time
, Capabilities
, &mModuleGlobal
);
39 Sets the current local time and date information.
41 @param Time A pointer to the current time.
43 @retval EFI_SUCCESS The operation completed successfully.
44 @retval EFI_INVALID_PARAMETER A time field is out of range.
45 @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error.
54 return PcRtcSetTime (Time
, &mModuleGlobal
);
58 Returns the current wakeup alarm clock setting.
60 @param Enabled Indicates if the alarm is currently enabled or disabled.
61 @param Pending Indicates if the alarm signal is pending and requires acknowledgement.
62 @param Time The current alarm setting.
64 @retval EFI_SUCCESS The alarm settings were returned.
65 @retval EFI_INVALID_PARAMETER Enabled is NULL.
66 @retval EFI_INVALID_PARAMETER Pending is NULL.
67 @retval EFI_INVALID_PARAMETER Time is NULL.
68 @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error.
69 @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.
74 PcRtcEfiGetWakeupTime (
80 return PcRtcGetWakeupTime (Enabled
, Pending
, Time
, &mModuleGlobal
);
85 Sets the system wakeup alarm clock time.
87 @param Enabled Enable or disable the wakeup alarm.
88 @param Time If Enable is TRUE, the time to set the wakeup alarm for.
89 If Enable is FALSE, then this parameter is optional, and may be NULL.
91 @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled.
92 If Enable is FALSE, then the wakeup alarm was disabled.
93 @retval EFI_INVALID_PARAMETER A time field is out of range.
94 @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error.
95 @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.
100 PcRtcEfiSetWakeupTime (
102 IN EFI_TIME
*Time OPTIONAL
105 return PcRtcSetWakeupTime (Enabled
, Time
, &mModuleGlobal
);
109 The user Entry Point for PcRTC module.
111 This is the entry point for PcRTC module. It installs the UEFI runtime service
112 including GetTime(),SetTime(),GetWakeupTime(),and SetWakeupTime().
114 @param ImageHandle The firmware allocated handle for the EFI image.
115 @param SystemTable A pointer to the EFI System Table.
117 @retval EFI_SUCCESS The entry point is executed successfully.
118 @retval Others Some error occurs when executing this entry point.
124 IN EFI_HANDLE ImageHandle
,
125 IN EFI_SYSTEM_TABLE
*SystemTable
131 EfiInitializeLock (&mModuleGlobal
.RtcLock
, TPL_CALLBACK
);
132 mModuleGlobal
.CenturyRtcAddress
= GetCenturyRtcAddress ();
134 Status
= PcRtcInit (&mModuleGlobal
);
135 ASSERT_EFI_ERROR (Status
);
137 Status
= gBS
->CreateEventEx (
140 PcRtcAcpiTableChangeCallback
,
142 &gEfiAcpi10TableGuid
,
145 ASSERT_EFI_ERROR (Status
);
147 Status
= gBS
->CreateEventEx (
150 PcRtcAcpiTableChangeCallback
,
155 ASSERT_EFI_ERROR (Status
);
157 gRT
->GetTime
= PcRtcEfiGetTime
;
158 gRT
->SetTime
= PcRtcEfiSetTime
;
159 gRT
->GetWakeupTime
= PcRtcEfiGetWakeupTime
;
160 gRT
->SetWakeupTime
= PcRtcEfiSetWakeupTime
;
162 Status
= gBS
->InstallMultipleProtocolInterfaces (
164 &gEfiRealTimeClockArchProtocolGuid
,
168 ASSERT_EFI_ERROR (Status
);